Vir*_*raj 5 php psr-2 phpcs php-7.1
我想运行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”不存在。有什么原因吗?
Gio*_*ani 10
根据当前的PHP 兼容性编码标准文档,您需要遵循以下步骤:
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"
}
Run Code Online (Sandbox Code Playgroud)
跑步composer update
测试用./vendor/bin/phpcs -p . --standard=PHPCompatibility