-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Describe the bug
A fixable rule violation is cannot be auto-fixed.
Code sample
<?php
function test($value)
{
if (
($value == 1 ||
$value == 2)
&&
($value == 3 ||
$value == 4)
) {
return 5;
}
return 6;
}Custom ruleset
None.
To reproduce
Steps to reproduce the behavior:
- Run
phpcs -s --standard=PSR12 test.php
FILE: /home/morozov/Projects/phpcs-playground/test.php
------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
5 | ERROR | [x] Boolean operators between conditions must be at the beginning or end of the
| | line, but not both
| | (PSR12.ControlStructures.BooleanOperatorPlacement.FoundMixed)
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------
Time: 44ms; Memory: 6MB
- Run
phpcbf --standard=PSR12 test.php
PHPCBF RESULT SUMMARY
----------------------------------------------------------------------
FILE FIXED REMAINING
----------------------------------------------------------------------
/home/morozov/Projects/phpcs-playground/test.php FAILED TO FIX
----------------------------------------------------------------------
A TOTAL OF 0 ERRORS WERE FIXED IN 1 FILE
----------------------------------------------------------------------
PHPCBF FAILED TO FIX 1 FILE
----------------------------------------------------------------------
Time: 46ms; Memory: 6MB
Expected behavior
The violation is fixed.
Versions (please complete the following information):
- OS: Linux
- PHP: 7.4.9
- PHPCS: 3.5.6
- Standard: Squiz