New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixer conflict: WhiteSpace_OperatorSpacing vs Arrays_ArrayDeclaration #986

Closed
jrfnl opened this Issue Jun 19, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@jrfnl
Contributor

jrfnl commented Jun 19, 2017

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.

@jrfnl

This comment has been minimized.

Show comment
Hide comment
@jrfnl

jrfnl Jun 21, 2017

Contributor

Still investigating this one - also see: squizlabs/PHP_CodeSniffer#1522

Contributor

jrfnl commented Jun 21, 2017

Still investigating this one - also see: squizlabs/PHP_CodeSniffer#1522

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment