Describe the bug
A combination of an array element comma on a new line preceded by a comment makes code is unfixable but the attempt to fix it prevents fixing the rest of the violations in the file.
Code sample
<?php
function test()
{
return [
'foo'
// Comment
,
];
}
Custom ruleset
None.
To reproduce
Steps to reproduce the behavior:
- Run
phpcbf --standard=Squiz 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: 426ms; Memory: 12MB
Expected behavior
The Squiz.Arrays.ArrayDeclaration.SpaceBeforeComma violation above is not reported as fixable and is not attempted to be fixed.
Versions (please complete the following information):
- OS: Linux
- PHP: 7.4.9
- PHPCS: 3.5.6
- Standard: Squiz