PHPCS默认不能设置为PSR2
PHPCS cannot be set to PSR2 by default
我正在尝试将 PHPCS 设置为 运行 默认情况下使用 PSR2 而不是必须在每个 运行.
上指定它
我将默认设置为 phpcs --config-set standard PSR2
当我检查配置时,它似乎设置为:
$ phpcs --config-show
Using config file: /usr/bin/CodeSniffer.conf
standard: PSR2
当我实际上 运行 它在文件上时,它 运行 作为 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)
...
如果我 运行 phpcs --standard=PSR2 ...
它工作正常,但我宁愿不必每次都包含它 运行 它。
报告的代码错误符合使用中的标准。
根据 documentation 你必须使用 default_standard
作为配置键。所以命令必须是:
phpcs --config-set default_standard PSR2
我正在尝试将 PHPCS 设置为 运行 默认情况下使用 PSR2 而不是必须在每个 运行.
上指定它我将默认设置为 phpcs --config-set standard PSR2
当我检查配置时,它似乎设置为:
$ phpcs --config-show
Using config file: /usr/bin/CodeSniffer.conf
standard: PSR2
当我实际上 运行 它在文件上时,它 运行 作为 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)
...
如果我 运行 phpcs --standard=PSR2 ...
它工作正常,但我宁愿不必每次都包含它 运行 它。
报告的代码错误符合使用中的标准。
根据 documentation 你必须使用 default_standard
作为配置键。所以命令必须是:
phpcs --config-set default_standard PSR2