Skip to content

PHPStorm unable to run phpcs inspection #390

Open
@Vinai

Description

Preconditions

  1. Tested on Magento Open Source 2.4.4 and Adobe Commerce 2.4.4
  2. PHP 8.1 (I haven't tried 7.4)
  3. PHPStorm version is 2021.2.4

Steps to reproduce

  1. Configure PHP interpreter in PHPStorm
  2. Configure phpcs in PHPStorm to use the Magento coding standard
  3. Enable the phpcs inspections

Expected result

  1. PHPStorm displays phpcs rule violations according to the configuration

Actual result

In the PHStorm event log the message is shown

ERROR: Referenced sniff "PHPCompatibility.FunctionUse.RemovedFunctions" does not exist

Additional Information

Running phpcs on the command line works

vendor/bin/phpcs --standard=vendor/magento/magento-coding-standard/Magento2 path/to/check

The same PHPStorm configuration works on Magento 2.4.3 with PHP 7.4.


If I remove the reference to that sniff from the Magento2/ruleset.xml, phpcs fails with a stacktrace where any other Magento2 rule extending from a PHPCompatibility rule class can't find the parent class.
Maybe this points to an autoload error?
However, I quick test by adding "PHPCompatibility\\:": "vendor/phpcompatibility/php-compatibility/PHPCompatibility/" to the root composer.json and dumping the composer autoloader did not change anything.

Metadata

Type

No type

Projects

  • Status

    Pull Request In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions