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

MultipleStatementAlignment breaks on comment in the end of an array #3175

Open
ComiR opened this issue Nov 26, 2020 · 0 comments
Open

MultipleStatementAlignment breaks on comment in the end of an array #3175

ComiR opened this issue Nov 26, 2020 · 0 comments

Comments

@ComiR
Copy link

ComiR commented Nov 26, 2020

Generic.Formatting.MultipleStatementAlignment
If an array contains a comment as the last element, the alignment of the assignments breaks (wrong warnings and fixes).
#1848 already fixed this for comments not on the last line.

Code sample

$foo = array(
    // Some comment before.
    'a' => 'b',
);
$barbar = 'bar';

$foo = array(
    'a' => 'b',
    // Some comment in between.
    'b' => 'c',
);
$barbar = 'bar';

$foo = array(
    'a' => 'b',
    // Some comment after.
);
$barbar = 'bar';

Expected output

$foo    = array(
    // Some comment before.
    'a' => 'b',
);
$barbar = 'bar';

$foo    = array(
    'a' => 'b',
    // Some comment in between.
    'b' => 'c',
);
$barbar = 'bar';

$foo    = array(
    'a' => 'b',
    // Some comment after.
);
$barbar = 'bar';

Actual output

$foo    = array(
    // Some comment before.
    'a' => 'b',
);
$barbar = 'bar';

$foo    = array(
    'a' => 'b',
    // Some comment in between.
    'b' => 'c',
);
$barbar = 'bar';

$foo = array(
    'a' => 'b',
    // Some comment after.
);
$barbar = 'bar';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant