Referenced sniff "PHPCSUtils" does not exist

1.9k Views Asked by At

I have PhpStorm and installed "squizlabs/php_codesniffer". When I try to use (e.g. modify the source code), PhpStorm sends me a little error every time, as

Referenced sniff "PHPCSUtils" does not exist

I tried to get that PHPCSUtils like that:

composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require phpcsstandards/phpcsutils:"^1.0"

from here: https://phpcsutils.com/

but it then says:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Root composer.json requires phpcsstandards/phpcsutils ^1.0, found phpcsstandards/phpcsutils[dev-stable, dev-develop, 1.0.0-alpha1, ..., 1.x-dev (alias of dev-stable)] but it does not match your minimum-stability.

When I try composer require phpcsstandards/phpcsutils:"dev-stable" I get

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Root composer.json requires phpcsstandards/phpcsutils dev-stable -> satisfiable by phpcsstandards/phpcsutils[dev-stable].
- phpcsstandards/phpcsutils dev-stable requires squizlabs/php_codesniffer ^3.7.1 || 4.0.x-dev@dev -> satisfiable by squizlabs/php_codesniffer[3.7.1] from composer repo (https://repo.packagist.org) but squizlabs/php_codesniffer is the root package and cannot be modified. See https://getcomposer.org/dep-on-root for details and assistance.

but that's a lie, I got 3.7.1 phpcodesniffer version:

phpcs --version

PHP_CodeSniffer version 3.7.1 (stable) by Squiz (http://www.squiz.net)

my composer.json is:

{
    "require": {
        "squizlabs/php_codesniffer": "^3.7"
    }
}

the phpcs composer.json is:

{
    "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
        }
    }
}
0

There are 0 best solutions below