You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While reviewing #538, I found another false positive in Squiz.PHP.DisallowMultipleAssignments when the code checks for default values. If the function is missing the closing parenthesis (which is a parse error but could happen during live coding), the sniff will incorrectly throw an error.
I will open a PR to fix this error once #538 is merged to avoid conflicts.
Code sample
<?phpfunction missingClosingParenthesis($a =
To reproduce
Steps to reproduce the behavior:
Create a file called test.php with the code sample above.
Run phpcs test.php --standard=Squiz --sniffs=Squiz.PHP.DisallowMultipleAssignments test.php
See error message displayed
FILE: test.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
3 | ERROR | Assignments must be the first block of code on a line
----------------------------------------------------------------------
Expected behavior
The sniff should bail early if the function is missing the closing parenthesis instead of producing an error.
Versions (please complete the following information)
Operating System
Ubuntu 24.04
PHP version
8.3
PHP_CodeSniffer version
master
Standard
Squiz
Install type
git clone
Please confirm
I have searched the issue list and am not opening a duplicate issue.
Describe the bug
While reviewing #538, I found another false positive in
Squiz.PHP.DisallowMultipleAssignments
when the code checks for default values. If the function is missing the closing parenthesis (which is a parse error but could happen during live coding), the sniff will incorrectly throw an error.I will open a PR to fix this error once #538 is merged to avoid conflicts.
Code sample
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above.phpcs test.php --standard=Squiz --sniffs=Squiz.PHP.DisallowMultipleAssignments test.php
Expected behavior
The sniff should bail early if the function is missing the closing parenthesis instead of producing an error.
Versions (please complete the following information)
Please confirm
master
branch of PHP_CodeSniffer.The text was updated successfully, but these errors were encountered: