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
Then running ./bin/phpcs --standard=Squiz --sniffs=Squiz.Formatting.OperatorBracket test.php shows the following output:
FILE: *******/test.php
--------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------
6 | ERROR | [x] Operation must be bracketed
--------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------
Running ./bin/phpcbf --standard=Squiz --sniffs=Squiz.Formatting.OperatorBracket test.php results in the following code in test.php:
Duplicated from here, as requested.
Describe the bug
The autofixer fixes the
Squiz.Formatting.OperatorBracket.MissingBrackets
in a specific case with the??
operator by malrforming the existing logic:Instead of bracketing the whole statement, it brackets part of it, thus changing the behavior of the affecting line
Code sample
becomes
although it should have become
if I'm not completely mistaken
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample aboveVersions (please complete the following information)
Additional context
Add any other context about the problem here.
Please confirm:
master
branch of PHP_CodeSniffer.The text was updated successfully, but these errors were encountered: