Skip to content

Squiz.Arrays.ArrayDeclaration fixer removes comments between array keyword and open parentheses #1570

@jrfnl

Description

@jrfnl

The auto-fixer for Squiz.Arrays.ArrayDeclaration.SpaceAfterKeyword could potentially remove comments which are between the array keyword and the open parenthesis as it removes tokens without checking that these are T_WHITESPACE.

While this is, of course, ugly code, I still don't think the fixer should be allowed to be triggered if there is anything, but whitespace, between the array keyword and the open parenthesis. It should just report the issue.

Test cases:

$a = array
// comment
( 'a', 'b' );

$a = array /* comment */ ( 'a', 'b' );

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions