Closed mehdi-wb closed 1 year ago
Closing as duplicate of numerous previous issues. This has been fixed a long time ago in develop
and we're working hard on getting WPCS 3.0.0 released.
Thanks but I tried using the develop branch "wp-coding-standards/wpcs": "dev-develop"
and I still experience the same issue...
That's impossible. Could it be that you have multiple PHPCS installs and that even though you installed develop
, when you triggered the command it used a different install which still uses 2.x ?
hmmm ok then let me double-check everything :)
@mehdi-wb Try using phpcs --config-show
and vendor/bin/phpcs --config-show
and look at the location of the config file, that should give you a good indication of which PHPCS install each is using. The output should also allow you to see which install of WPCS is being used, so you can double-check if it is the version you intended to use.
I will do that but in the meantime, I tried starting from scratch and removed my composer-loc.json file and vendor folder But looks like your develop branch is requiring a dependency version that does not exist for phpcsstandards/phpcsextra... I have Composer version 2.4.2
Updating dependencies Your requirements could not be resolved to an installable set of packages. wp-coding-standards/wpcs dev-develop requires phpcsstandards/phpcsextra ^1.0 -> found phpcsstandards/phpcsextra[dev-develop, 1.0.0-alpha1, 1.0.0-alpha2, 1.0.0-alpha3, 1.x-dev (alias of dev-develop)] but it does not match your minimum-stability.
So yeah looks like my package-lock.json was probably preventing the correct version from being installed...
I'll figure out a way to fix this and will report back Thanks for your help!
Yes, as it is develop
, you will need to set "minimum-stability": "dev"
in your composer.json
and things should then install without issue. You may want to combine it with "prefer-stable": true
.
Obviously, that will be resolved before the 3.0.0 release.
I was able to install the develop branch and all works well now thanks! Looking forward to the v3 release :)
@mehdi-wb Glad to hear it!
When declaring a function, if at least one extra space is added next to a parameter, the phpcs engine will crash with a php fatal error. See the code snippet below and notice that there are 2 spaces next to the $values parameter.
Excluding the
WordPress.WhiteSpace.ControlStructureSpacing
WordPress-Extra ruleset fixes the issue.Code sample
Custom ruleset
To reproduce Steps to reproduce the behavior:
phpcs
on your php fileExpected behavior PHPCS will fail and the file will not be checked/processed.
Versions:
composer.json