Closed theMikeD closed 11 months ago
If everything works fine on the command line, this is not a WPCS issue, but a PHPStorm issue. I suggest you ask in a PHPStorm forum for support, though based on your description it sounds like PHPStorm is using a different PHPCS version than the one you installed in the project, which would explain the problem.
Suggest: close as asked in the wrong repo.
P.S.: you should be able to remove the "dealerdirect/phpcodesniffer-composer-installer": "^1.0"
requirement as that is now a dependency of WPCS, so to prevent conflicts in the future, you could just let WPCS (or rather PHPCSUtils) handle the supported versions.
As is usual in my life, the act of describing the issue has revealed the solution.
In my case, i had specified a folder in Preferences --> PHP --> Quality Tools, Installed Standards path. I had that set to vendor/wp-coding-standard/wpcs
and as soon as I cleared it and restarted, everything started working again. The lightbulb went off after reading the first FAq answer on this page and realizing that the standard would not have to be set manually any more.
At least there is a record for this in case someone else has the same issue.
@theMikeD Ah, yes, that very much explains it. Happy to hear that the PHPCSUtils FAQ helped you solve this.
At least there is a record for this in case someone else has the same issue.
THANK YOU @theMikeD. This was driving me mad.
Bug Description
I have installed the standards per the instructions using composer. I have then set phpStorm to use the project-specific
phpcs
et al, and the standards installed via composer all appear fine.However my phpStorm log is filled with
phpcs: ERROR: Referenced sniff "PHPCSUtils" does not exist
Minimal Code Snippet
The issue happens when phpStorm attempts to scan a php file.
Environment
I see the
phpcsstandards
folder invendor
The
vendor
folder is in a non-standard location, set byAdditional Context (optional)
I do not get the same warning running on the command line using
Tested Against
develop
Branch?develop
branch of WordPressCS.Don't know how to do this.