@@ -219,7 +219,7 @@ yield from baz();
$whitespaceTokenIndex = $index + 1;
- if ($tokens[$whitespaceTokenIndex]->equalsAny([',', ';', ')', [CT::T_ARRAY_SQUARE_BRACE_CLOSE]])) {
+ if ($tokens[$whitespaceTokenIndex]->equalsAny([',', ';', ')', [CT::T_ARRAY_SQUARE_BRACE_CLOSE], [CT::T_DESTRUCTURING_SQUARE_BRACE_CLOSE]])) {
continue;
}
@@ -2923,6 +2923,13 @@ new Dummy(/** b */);
foo(/* c */);
foo($a /* d */, $b);
$arr = [/* empty */];
+',
+ ];
+
+ yield 'before_destructuring_square_brace_close' => [
+ '<?php
+foreach ($fields as [$field/** @var string*/]) {
+}
',
];