When running phpcs, ERROR: Referenced sniff "PHPCompatibility" does not exist is coming
When running phpcs, ERROR: Referenced sniff "PHPCompatibility" does not exist is coming
我想运行phpcs工具,但是这个错误来了,
ERROR: Referenced sniff "PHPCompatibility" does not exist
我运行 phpcs -i。那给了我,
The installed coding standards are PEAR, PSR1, Zend, Squiz, PSR12, PSR2, MySource and PHPCompatibility.
但是总是会出现这个错误,
错误:引用的嗅探 "PHPCompatibility" 不存在。
有什么原因吗?
根据当前 PHP Compatibility Coding Standard 文档,您需要执行以下步骤:
- 打开您的
composer.json
文件并将以下行添加到:
"require-dev": {
"phpcompatibility/php-compatibility": "*"
},
"prefer-stable" : true,
"scripts": {
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility",
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
}
运行 composer update
测试 ./vendor/bin/phpcs -p . --standard=PHPCompatibility
我想运行phpcs工具,但是这个错误来了,
ERROR: Referenced sniff "PHPCompatibility" does not exist
我运行 phpcs -i。那给了我,
The installed coding standards are PEAR, PSR1, Zend, Squiz, PSR12, PSR2, MySource and PHPCompatibility.
但是总是会出现这个错误, 错误:引用的嗅探 "PHPCompatibility" 不存在。 有什么原因吗?
根据当前 PHP Compatibility Coding Standard 文档,您需要执行以下步骤:
- 打开您的
composer.json
文件并将以下行添加到:
"require-dev": { "phpcompatibility/php-compatibility": "*" }, "prefer-stable" : true, "scripts": { "post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility", "post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility" }
运行
composer update
测试
./vendor/bin/phpcs -p . --standard=PHPCompatibility