Reputation: 432
I'm trying to set up PHPCS to run with PSR2 by default instead of having to specify it on each run.
I set the default with phpcs --config-set standard PSR2
When I check the configuration, it appears to be set:
$ phpcs --config-show
Using config file: /usr/bin/CodeSniffer.conf
standard: PSR2
When I actually run it on files, it runs as PEAR:
$ phpcs -v transarray.php
Registering sniffs in the PEAR standard... DONE (28 sniffs registered)
Creating file list... DONE (1 files in queue)
Changing into directory /root
Processing transarray.php [PHP => 136 tokens in 26 lines]... DONE in 2ms (11 errors, 0 warnings)
...
If I run phpcs --standard=PSR2 ...
it works correctly, but I would rather not have to include that every single time I run it.
The code errors reported match the standards in use.
Upvotes: 2
Views: 710
Reputation: 3912
According to the documentation you have to use default_standard
as configuration key. So the command must be:
phpcs --config-set default_standard PSR2
Upvotes: 2