'PHP Codesniffer phpcs: ERROR: the squizlabs/php_codesniffer/CodeSniffer.conf.dist coding standard is not installed in PhpStorm [closed]

I have a Drupal 8 installation where I want to use the squizlabs/php_codesniffer with PhpStorm.

I installed phpcs with Composer by following this documentation from Drupal itself https://www.drupal.org/docs/contributed-modules/code-review-module/installing-coder-sniffer#s-composer-installer-plugin. I installed it with this command composer global require drupal/coder dealerdirect/phpcodesniffer-composer-installer which also installs squizlabs/php_codesniffer. At this point everything is working and phpcs is installed in my users .composer folder.

When I execute phpcs --config-show I get this output: (version 3.6.1)

Using config file: /Users/myusername/.composer/vendor/squizlabs/php_codesniffer/CodeSniffer.conf

installed_paths: /Users/myusername/.composer/vendor/drupal/coder/coder_sniffer,/Users/myusername/.composer/vendor/sirbrillig/phpcs-variable-analysis

Looks fine in my opinion.

PhpStorm version 2021.2.2

Next step was setting up CodeSniffer in PhpStorm which I did like this:

PHP_CodeSniffer settings in PhpStorm

CodeSniffer was validated and seems to be OK. PhpStorm as well recognized the Drupal coding standard as you see here:

Quality Tools PHP_CodeSniffer validation

When I save all the settings and open a File I get this error message in the PhpStorm Event Log:

11:51   PHP_CodeSniffer
        phpcs: ERROR: the "/Users/myusername/Sites/projects/features/vendor/squizlabs/php_codesniffer/CodeSniffer.conf.dist" coding standard is not installed. The installed coding standards are PEAR, Zend, PSR2, MySource, Squiz, PSR1, PSR12, Drupal, DrupalPractice and VariableAnalysis
        Open PHPCodeSniffer Inspection Settings 

I have absolutely no idea why it needs to check the projects php_codesniffer and why this coding standard needs to be installed. Does somebody have an idea why this could be happening? I tried clearing PhpStorm Cache but that didn't help.

Thank you in advance!



Solution 1:[1]

I managed to fix it myself. For those who still need a solution I need to disappoint you. I just deleted my project and installed it again. After that the error doesn't appear anymore. This proves that phpcs or Drupal isn't the issue. It was my project setup.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1