PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
10.68k
stars
1.48k
forks
source link
Auto fix of Squiz.Formatting.OperatorBracket.MissingBrackets is incorrect when working with ?? operator #3930
Open
leonidasmi opened 12 months ago
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.