Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ?

like image 216
Viraj Amarasinghe Avatar asked Jun 29 '18 07:06

Viraj Amarasinghe


1 Answers

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

like image 70
Giovani Avatar answered Sep 29 '22 21:09

Giovani