Closed
Description
The following example is marked as invalid by phpcs
1 $foobarbaz = array_map(
2 function ($n) {
3 return $n * $n;
4 },
5 [1, 2, 3]
6 );
7 $foo = 5;
This causes the following warning on line 7:
Generic.Formatting.MultipleStatementAlignment.IncorrectWarning
Basically, the $foo
is considered to be a new assignment block. The reason for this, I think, is the semicolon in the function closure on line 3. Phpcs thinks the assignment block has ended because the semicolon is in a different context.
The reason I think this should not happen is because PHPStorm automatically aligns the equals sign like the example given above. This is because of the code style option Assignment statement -> Align consecutive assignments
in PHPStorm.
Hence my question whether this can be added/fixed in phpcs?