Skip to content
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

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

Closed
ping-localhost opened this issue Jun 7, 2018 · 1 comment

Comments

@ping-localhost
Copy link

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),
]);
@gsherwood gsherwood added this to Selected for Development (v3) in PHPCS v3 Development Jun 7, 2018
@gsherwood gsherwood moved this from Selected for Development (v3) to Selected for Development (v4) in PHPCS v3 Development Jun 7, 2018
@gsherwood gsherwood removed this from Selected for Development (v4) in PHPCS v3 Development Jun 7, 2018
@gsherwood gsherwood added this to the 3.3.1 milestone Jun 7, 2018
@gsherwood gsherwood added this to Selected for Development (v3) in PHPCS v3 Development Jun 7, 2018
@gsherwood gsherwood moved this from Selected for Development to In Progress in PHPCS v3 Development Jun 8, 2018
@gsherwood gsherwood changed the title False positive MultipleStatementAlignmentSniff GenericFormatting.MultipleStatementAlignment false positive when assigning values inside an array Jun 8, 2018
gsherwood added a commit that referenced this issue Jun 8, 2018
…positive when assigning values inside an array
@gsherwood
Copy link
Member

Thanks for reporting this. I found the problem and have put in a file. It will be in the 3.3.1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
PHPCS v3 Development
Ready for Release
Development

No branches or pull requests

2 participants