Skip to content

Fixer conflict: WhiteSpace_OperatorSpacing vs Arrays_ArrayDeclaration #986

@jrfnl

Description

@jrfnl

While testing some improvements to the ArrayIndentation sniff, I became aware of a fixer conflict unrelated to that sniff, but triggered by some test code I was using.

The fixer goes into the typical 50-loop sequence and ends with unfixed errors.

Example code which will trigger the issue:

get_current_screen()->add_help_tab( array(
		'id'		=> <<<EOD
Here comes some text.
EOD
,
) );

get_current_screen()->add_help_tab( array(
'id'		=> <<<EOD
Here comes some text.
EOD
. '</hr>',
) );

Strangely enough I can't reproduce the issue with just one of the two function calls. For some reason, both have to be there to trigger the issue.

Relevant part of the debug log:

        E: [Line 4] Expected 0 spaces between "=>" and comma; 1 found (WordPress.Arrays.ArrayDeclara
tion.SpaceBeforeComma)
        WordPress_Sniffs_Arrays_ArrayDeclarationSniff (line 604) replaced token 16 (T_WHITESPACE) "
," => ","
        * fixed 2 violations, starting loop 3 *
        E: [Line 4] Expected 1 space after "=>"; 0 found (WordPress.WhiteSpace.OperatorSpacing.NoSpa
ceAfter)
        => Changeset started by WordPress_Sniffs_WhiteSpace_OperatorSpacingSniff (line 186)
                Q: WordPress_Sniffs_WhiteSpace_OperatorSpacingSniff (line 187) replaced token 15 (T_
DOUBLE_ARROW) "=>" => "=> "
                A: WordPress_Sniffs_WhiteSpace_OperatorSpacingSniff (line 188) replaced token 15 (T_
DOUBLE_ARROW) "=>" => "=> "
        => Changeset ended: 1 changes applied
        * fixed 1 violations, starting loop 4 *
        E: [Line 4] Expected 0 spaces between "=>" and comma; 1 found (WordPress.Arrays.ArrayDeclara
tion.SpaceBeforeComma)
        WordPress_Sniffs_Arrays_ArrayDeclarationSniff (line 604) replaced token 16 (T_WHITESPACE) "
," => ","
        * fixed 1 violations, starting loop 5 *
        E: [Line 4] Expected 1 space after "=>"; 0 found (WordPress.WhiteSpace.OperatorSpacing.NoSpa
ceAfter)
        => Changeset started by WordPress_Sniffs_WhiteSpace_OperatorSpacingSniff (line 186)
                Q: WordPress_Sniffs_WhiteSpace_OperatorSpacingSniff (line 187) replaced token 15 (T_
DOUBLE_ARROW) "=>" => "=> "
                A: WordPress_Sniffs_WhiteSpace_OperatorSpacingSniff (line 188) replaced token 15 (T_
DOUBLE_ARROW) "=>" => "=> "
        => Changeset ended: 1 changes applied
        * fixed 1 violations, starting loop 6 *

Both the involved sniffs are - partial - copies of upstream sniffs, so any fix found for this issue should also be pulled upstream.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions