First of all we have to have installed on our system
PHP
usinghomebrew
you can follow my post PHP on Mavericks with Homebrew to accomplished it.
Then we have to install CodeSniffer
using PEAR
with the following command:
pear install PHP_CodeSniffer
We can check our PHPcs
version with the following command:
phpcs --version
Then we have to install the specific CakePHP
sniffer:
pear channel-discover pear.cakephp.org
We could see the following error:
could not create lock file: fopen(/usr/local/Cellar/php55/5.5.9/lib/php/.lock): failed to open stream: Permission denied
If that´s your case you can run the following commands to change the permissions:
chmod -R ug+w /usr/local/Cellar/php55/5.5.9/lib/php
pear config-set php_ini /usr/local/etc/php/5.5/php.ini
And then try again the instalation:
pear channel-discover pear.cakephp.org
pear install cakephp/CakePHP_CodeSniffer
Once we have everything installed we can use our Sniffer
for CakePHP
like that:
phpcs --standard=CakePHP ~/PATH/OUR_FILE.php