Search code examples
drupalphpcs

Referenced sniff "SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" does not exist


Just installed php_codesniffer and coder:

composer global require "squizlabs/php_codesniffer=*"
composer global require drupal/coder

After installation, run phpcs -i and the result is as follows:

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

But when I use git commit, I get an error:

ERROR: Referenced sniff "SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" does not exist

My php version is 7.4. Where am I going wrong?


Solution

  • Excuting an order:

     phpcs --config-set installed_paths /homeriverz/.config/composer/vendor/phpcompatibility/php-compatibility,/homeriverz/.config/composer/vendor/drupal/coder/coder_sniffer,/homeriverz/.config/composer/vendor/slevomat /coding-standard
    

    If not, reinstall php_codesniffer and drupal/coder.