Question

Is it possible to run PHP Codesniffer from a .phar file? What does the following documentation, taken from a Sublime Text 2 plugin at https://github.com/benmatselby/sublime-phpcs, mean?

If you have installed php-cs-fixer, phpmd or phpcs via homebrew then please make sure that you define the "*_executable_path" option to the .phar application and not the wrapper script that is placed in your bin folder, as this will cause odd behaviour.

sudo find / -name '*.phar' doesn't bring up any PHP Codesniffer files on Mac OS X Mountain Lion. I have set phpcs_executable_path = /usr/local/Cellar/php-code-sniffer/1.4.4/libexec/phpcs in the plugin but Codesniffer does not run.

unknown-58-b0-35-73-71-82:bin scisteffan$ ls -la /usr/local/bin | grep phpcs
lrwxr-xr-x    1 scisteffan  admin       42 16 Mar 13:38 phpcs -> ../Cellar/php-code-sniffer/1.4.4/bin/phpcs

unknown-58-b0-35-73-71-82:bin scisteffan$ ls -la /usr/local/Cellar/php-code-sniffer/1.4.4/bin | grep phpcs
lrwxr-xr-x   1 scisteffan  admin   54  8 Mar 11:52 phpcs -> /usr/local/Cellar/php-code-sniffer/1.4.4/libexec/phpcs

Furthermore, phpcs works if I install it using pear install and link it into Sublime Text 2. Just can't figure out how to link it with php-code-sniffer

Was it helpful?

Solution

This is a little late but here is a link that shows you how to do this easier: http://philsturgeon.co.uk/blog/2013/08/php-static-analysis-in-sublime-text

You will have to do some Googling on how to set up Homebrew. This should get you going in the right direction.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top