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
'test' => $foo->prop ?? 'test_' . $bar,
becomes
'test' => ($foo->prop ?? 'test_') . $bar,
although it should have become
'test' => ($foo->prop ?? 'test_' . $bar),
if I'm not completely mistaken
To reproduce
Steps to reproduce the behavior:
- Create a file called
test.php
with the code sample above
- Run the autofixer
- Verify that you get changed behavior in the changed code.
Versions (please complete the following information)
|
|
Operating System |
Windows 10] |
PHP version |
7.4.3 |
PHP_CodeSniffer version |
[e.g., 3.5.5, master] |
Standard |
Squiz] |
Additional context
Add any other context about the problem here.
Please confirm: