sudo cp /private/etc/php.ini.default /private/etc/php.ini;
sudo php /usr/lib/php/install-pear-nozlib.phar;
pear config-set php_ini /private/etc/php.ini;
pecl config-set php_ini /private/etc/php.ini;
sudo pear upgrade-all;
sudo pear install PHP_CodeSniffer;
Do not forget to add
/usr/lib/php/pear/to your include_path
Settings > Languages & Frameworks > PHP > CodeSniffer
put the path for phpcs (locate it with which phpcs in your terminal) and validate it, apply and we're done.
Settings > Editor > Inspections > PHP > PHP Code Sniffer validation
Enable it and search in the screen for Coding Standard and pick PSR2
Example http://gielberkers.com/setup-php-codesniffer-phpstorm-osx/
I was facing another error when running
phpcsin terminal on zsh:mac os x phpcs command not foundThis can be resolved by getting the
binpath forphpcs, by running below command in terminal:pear config-get bin_dirThis shows something like
/usr/local/opt/php@7.0/binThen add an environment variable in
~/.zshrc. Simply add the following line in~/.zshrc:export PATH=/usr/local/opt/php@7.0/bin:$PATH