Skip to content

GenericFormatting.MultipleStatementAlignment false positive when assigning values inside an array #2048

Closed
@ping-localhost

Description

@ping-localhost

As of 860196a this sniff reports an error for the following snippet:

$file = new File('phpunit', [
    $token_1 = new Token(Token::T_WORD, 'foobar', 1, 0),
    $token_2 = new Token(Token::T_WHITESPACE, ' ', 1, 6),
    $token_3 = new Token(Token::T_WORD, 'barbaz', 1, 7),
    $token_4 = new Token(Token::T_SEMICOLON, ';', 1, 13),
]);

PHPCBF incorrectly/unexpectedly fixes the snippet to the following:

$file        = new File('phpunit', [
    $token_1 = new Token(Token::T_WORD, 'foobar', 1, 0),
    $token_2 = new Token(Token::T_WHITESPACE, ' ', 1, 6),
    $token_3 = new Token(Token::T_WORD, 'barbaz', 1, 7),
    $token_4 = new Token(Token::T_SEMICOLON, ';', 1, 13),
]);

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