我想运行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”不存在。 有什么原因吗?
答案 0 :(得分:1)
根据当前的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