Closed mehdi-wb closed 1 year ago
I can't replicate this with any of the included standards so this may be an issue in one of the others you are using. The stacktrace also looks limited so I can't see which sniff the error is coming from.
Try replicating the issue with the WordPress and PHPCompat standards removed so you are just using the built-in standards. If that works, you'll need to report this to one of the other projects to take a look at. If you can get the full stacktrace of the error, we could work it out from there as well.
Thanks for your response. You are right, phpcs itself is not causing the issue...
I found the sniff that is causing the bug and excluded it in my ruleset - all works fine now:
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing"/>
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 code snippet bellow and notice that there are 2 spaces next to the $values parameter.
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