PHPCompatibility / PHPCompatibilityWP

PHPCompatibility ruleset for WordPress projects
GNU Lesser General Public License v3.0
179 stars 11 forks source link

"If all went well, you will now see..." #48

Closed AlchemyUnited closed 1 year ago

AlchemyUnited commented 1 year ago

The README says' "If all went well, you will now see that the PHPCompatibility, PHPCompatibilityWP and some more PHPCompatibility standards are installed for PHP_CodeSniffer."

But I guess all did not go well because I don't see PHPCompatibilityWP in the vendor/bin/phpcs -i list.

afaik, I didn't get any errors from the composer'ing. Maybe these details will help?

$ composer --version Composer version 2.6.3 2023-09-15 09:38:21

$ composer show phpcompatibility/php-compatibility name : phpcompatibility/php-compatibility descrip. : A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility. keywords : compatibility, phpcs, standards versions : * 9.3.5

$ composer show phpcompatibility/phpcompatibility-wp name : phpcompatibility/phpcompatibility-wp descrip. : A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress. keywords : compatibility, phpcs, standards, static analysis, wordpress versions : * 2.1.4

$ composer show phpcompatibility/phpcompatibility-paragonie name : phpcompatibility/phpcompatibility-paragonie descrip. : A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries. keywords : compatibility, paragonie, phpcs, polyfill, standards, static analysis versions : * 1.3.2

When I try using --standard=PHPCompatibilityWP as a commandline arg, I get

"ERROR: the "PHPCompatibilityWP" coding standard is not installed. The installed coding standards are MySource, PEAR, PSR1, PSR2, PSR12, Squiz, Zend and PHPCompatibility"


I've been trying to troubleshoot this for hours :( I've lost track of the number of times I've run composer clear-cache, composer dump-autoload, and composer update.

Any tips and insights would be appreciared.

jrfnl commented 1 year ago

@AlchemyUnited Can you run composer info and show me the output ? The main thing I want to check is whether you installed the Composer PHPCS plugin - dealerdirect/phpcodesniffer-composer-installer - (as instructed in the README) or not.

If you don't have a Composer plugin installed to manage the installed_paths setting for PHP_CodeSniffer, run the following from the command-line:

composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require --dev dealerdirect/phpcodesniffer-composer-installer:"^0.7" phpcompatibility/phpcompatibility-wp:"*"

If you didn't install the Composer PHPCS plugin, that explains why the standards don't show up when running vendor/bin/phpcs -i.

jrfnl commented 1 year ago

I'm going to close this issue as based on the other ticket you opened, you managed to get things working....