-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Named arg + Constant = "Type Constant is not used in this file" (phpcs v3.10.0) #504
Comments
@LastDragon-ru Thank you for reporting this. Definitely a bug in the 3.10.0 release and definitely related to named parameters. Unfortunate that nobody caught this during the testing period. Minimal code sample it can be reproduced with: preg_split($r, $h, flags: PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); Symptom: close parenthesis of the function call gets incorrectly tokenized as
I'll have a look. |
@LastDragon-ru @momala454 PR #507 should fix this. I would appreciate it if you could test the fix. If you need it, you can download the PHAR files containing the patch here: https://github.com/PHPCSStandards/PHP_CodeSniffer/actions/runs/9173810442 |
It fixes the problem, thanks |
Thanks for testing @momala454! |
Yep, no error anymore |
Thanks @LastDragon-ru for testing and confirming! |
Sorry, I'm not sure this is related to phpcs or slevomat, so I've posted it in both repos 🤷♂️
slevomat/coding-standard#1680
Describe the bug
Since phpcs v3.10.0 the code generate false positive errors about unused constants. Seems it is caused by named arg (no error without it).
Code sample
Custom ruleset
Expected behavior
No errors.
The text was updated successfully, but these errors were encountered: