Describe the bug
The fixer fails to fix a standard violation if a chained assignment is wrapped.
Code sample
Custom ruleset
<?xml version="1.0"?>
<ruleset>
<rule ref="Generic.Formatting.MultipleStatementAlignment"/>
</ruleset>
To reproduce
$ phpcs --standard=ruleset.xml test.php
FILE: test.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
3 | WARNING | [x] Equals sign not aligned with surrounding assignments;
| | expected 6 spaces but found 1 space
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------
$ phpcbf --standard=ruleset.xml test.php
PHPCBF RESULT SUMMARY
----------------------------------------------------------------------
FILE FIXED REMAINING
----------------------------------------------------------------------
test.php FAILED TO FIX
----------------------------------------------------------------------
A TOTAL OF 0 ERRORS WERE FIXED IN 1 FILE
----------------------------------------------------------------------
PHPCBF FAILED TO FIX 1 FILE
----------------------------------------------------------------------
$ phpcbf --standard=ruleset.xml -vv test.php
Generic.Formatting.MultipleStatementAlignment:381 replaced token 4 (T_WHITESPACE on line 3) "·=" => "······="
* fixed 1 violations, starting loop 2 *
Generic.Formatting.MultipleStatementAlignment:381 replaced token 4 (T_WHITESPACE on line 3) "······=" => "···········="
* fixed 1 violations, starting loop 3 *
Generic.Formatting.MultipleStatementAlignment:381 replaced token 4 (T_WHITESPACE on line 3) "···········=" => "················="
* fixed 1 violations, starting loop 4 *
...
* fixed 1 violations, starting loop 51 *
*** Reached maximum number of loops with 1 violations left unfixed ***
Expected behavior
The fixer does not fail to fix the violation.
Versions (please complete the following information)
|
|
| Operating System |
MacOS 10.15 |
| PHP version |
8.5 |
| PHP_CodeSniffer version |
4.0.1 |
| Standard |
custom |
| Install type |
Composer |
Additional context
Add any other context about the problem here.
Please confirm
Describe the bug
The fixer fails to fix a standard violation if a chained assignment is wrapped.
Code sample
Custom ruleset
To reproduce
Expected behavior
The fixer does not fail to fix the violation.
Versions (please complete the following information)
Additional context
Add any other context about the problem here.
Please confirm
4.xbranch of PHP_CodeSniffer.