PHP Codesniffer standard for the Kohana Framework
These tests are meant to be a guide and may not be 100% accurate. If you find a bug please report it on the kohana issue tracker.
These tests require PHP Codesniffer
If you want the standard to be available system wide you can symlink them into the code sniffer dir like so:
git clone https://github.com/kohana/coding-standards.git kohana-coding-standards cd kohana-coding-standards sudo ln -sfn `pwd`/PHP/CodeSniffer/Standards/Kohana `pear config-get php_dir`/PHP/CodeSniffer/Standards/Kohana sudo ln -sfn `pwd`/test/PHP_CodeSniffer/CodeSniffer/Standards/Kohana `pear config-get test_dir`/PHP_CodeSniffer/CodeSniffer/Standards/Kohana
You can reference the standard like so:
phpcs --standard=Kohana system/classes/kohana
Or, if you don't want to install it system wide you can simply reference the local copy
phpcs --standard=path/to/coding-standard/PHP/CodeSniffer/Standards/Kohana system/classes/kohana
Like all things code related, sniffs need to be tested! To run the tests they need to be in the codesniffer dir (i.e. you should run the above commands to symlink the sniffs / tests in) and you need to patch phpcs' AllSniffs.php
Then just run the tests like so:
phpunit --bootstrap=`pear config-get php_dir`/PHP/CodeSniffer.php `pear config-get test_dir`/PHP_CodeSniffer/CodeSniffer/Standards/AllSniffs.php
- There are some problems with expressions in ternary operators
Please report any new issues to the K3 bug tracker and file it under "PHPCS Coding Standards"