提问人:John Smith 提问时间:12/8/2022 最后编辑:John Smith 更新时间:12/11/2022 访问量:1367
引用的嗅探“PHPCSUtils”不存在
Referenced sniff "PHPCSUtils" does not exist
问:
我有 PhpStorm 并安装了“squizlabs/php_codesniffer”。当我尝试使用(例如修改源代码)时,PhpStorm 每次都会向我发送一个小错误,因为
引用的嗅探“PHPCSUtils”不存在
我试图让PHPCSUtils像这样:
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require phpcsstandards/phpcsutils:"^1.0"
但它接着说:
您的要求无法解析为一组可安装的软件包。
问题 1 - 根composer.json需要 phpcsstandards/phpcsutils ^1.0,找到 phpcsstandards/phpcsutils[dev-stable, dev-develop,
1.0.0-alpha1, ..., 1.x-dev (dev-stable 的别名)] 但它与您的 最小稳定性。
当我尝试时,我得到composer require phpcsstandards/phpcsutils:"dev-stable"
您的要求无法解析为一组可安装的软件包。
问题 1 - 根composer.json需要 phpcsstandards/phpcsutils dev-stable -phpcsstandards/phpcsutils[
dev-stable] 满足的 >。
- phpcsstandards/phpcsutils dev-stable 需要 squizlabs/php_codesniffer ^3.7.1 ||4.0.x-dev@dev -> 满足 来自 Composer 存储库的 squizlabs/php_codesniffer[3.7.1] (https://repo.packagist.org) 但 squizlabs/php_codesniffer 是根 包,并且无法修改。有关详细信息和帮助,请参阅 https://getcomposer.org/dep-on-root。
但那是谎言,我得到了 3.7.1 phpcodesniffer 版本:
phpcs --version
PHP_CodeSniffer 版本 3.7.1 (稳定版) 由 Squiz (http://www.squiz.net)
我的composer.json是:
{
"require": {
"squizlabs/php_codesniffer": "^3.7"
}
}
PHPCS composer.json是:
{
"name": "squizlabs/php_codesniffer",
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
"type": "library",
"keywords": [
"phpcs",
"standards"
],
"homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
"license": "BSD-3-Clause",
"authors": [
{
"name": "Greg Sherwood",
"role": "lead"
}
],
"support": {
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki",
"source": "https://github.com/squizlabs/PHP_CodeSniffer"
},
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"require": {
"php": ">=5.4.0",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"ext-simplexml": "*"
},
"require-dev": {
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"bin": [
"bin/phpcs",
"bin/phpcbf"
],
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
答: 暂无答案
评论
minimum-stability
dev
composer require phpcsstandards/phpcsutils:"1.0.0-alpha4"
composer.json
phpcs composer.json
composer.json