When running phpcs, ERROR: Referenced sniff "PHPCompatibility" does not exist is coming

7k Views Asked by At

I want to run phpcs tool, but this error is coming,

ERROR: Referenced sniff "PHPCompatibility" does not exist I ran phpcs -i. That gave me ,

The installed coding standards are PEAR, PSR1, Zend, Squiz, PSR12, PSR2, MySource and PHPCompatibility.

But Always this error is coming, ERROR: Referenced sniff "PHPCompatibility" does not exist. Any reasons ?

1

There are 1 best solutions below

0
Giovani On BEST ANSWER

According currently PHP Compatibility Coding Standard documentation you need to follow this steps:

  1. Open your composer.json file and add the following lines to:
"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"
}
  1. run composer update

  2. Test with ./vendor/bin/phpcs -p . --standard=PHPCompatibility