8

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 ?

Viraj Amarasinghe
  • 911
  • 10
  • 20

1 Answers1

9

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

Giovani
  • 2,459
  • 1
  • 21
  • 16