The PHP_CodeSniffer Coding Standard to check against the Doctrine Coding Standard.
You have three possibilities to use the Doctrine Coding Standard with PHP_CodeSniffer in a particular project.
You can install the Doctrine Coding Standard as a plugin into your global system PHP_CodeSniffer installation:
$ cd /path/to/phpcs/CodeSniffer/Standards $ php composer create-project doctrine/coding-standard Doctrine ~0.1@devThen you can use it like (assuming that you have the phpcs binary in your search path):
$ phpcs --standard=Doctrine /path/to/some/file/to/sniff.phpOr even set it as default standard (assuming that you have the phpcs binary in your search path):
$ phpcs --config-set default_standard DoctrineAnd just sniff a particular file with (assuming that you have the phpcs binary in your search path):
$ phpcs /path/to/some/file/to/sniff.phpYou also can install the Doctrine Coding Standard globally:
$ php composer global require doctrine/coding-standard:~0.1@devThen you can use it like:
$ phpcs --standard=~/.composer/vendor/doctrine/coding-standard/Doctrine /path/to/some/file/to/sniff.phpOr even set it as default standard:
$ phpcs --config-set default_standard ~/.composer/vendor/doctrine/coding-standard/DoctrineAnd just sniff a particular file with:
$ phpcs /path/to/some/file/to/sniff.phpYou can install the Doctrine Coding Standard anywhere you want:
$ php composer create-project doctrine/coding-standard /path/to/coding-standard/Doctrine ~0.1@devThen you can use it like:
$ ./vendor/bin/phpcs --standard=. /path/to/some/file/to/sniff.phpYou can install the Doctrine Coding Standard as a composer dependency to your particular project. Just add the following block to your project's composer.json file:
$ php composer require doctrine/coding-standard:~0.1@devThen you can use it like:
$ ./vendor/bin/phpcs --standard=vendor/doctrine/coding-standard/Doctrine /path/to/some/file/to/sniff.phpIf you are contributing to the Doctrine Coding Standard and want to test your contribution, you have to make sure all dependencies are correctly installed:
$ php composer install --prefer-sourceThe option --prefer-source is particularly necessary to ensure the test suite from PHP_CodeSniffer is installed. Otherwise the test suite for the Doctrine Coding Standard won't work!
Run the test suite with:
$ ./vendor/bin/phpunit
