diff --git a/src/Fixer/Alias/ArrayPushFixer.php b/src/Fixer/Alias/ArrayPushFixer.php index 43f4ae4f3a1..9f4c05d47e4 100644 --- a/src/Fixer/Alias/ArrayPushFixer.php +++ b/src/Fixer/Alias/ArrayPushFixer.php @@ -197,8 +197,6 @@ private function getSecondArgumentEnd(Tokens $tokens, int $index, int $endIndex) return null; } - $index = $tokens->getNextMeaningfulToken($index); - for (; $index <= $endIndex; ++$index) { $blockType = Tokens::detectBlockType($tokens[$index]); diff --git a/tests/Fixer/Alias/ArrayPushFixerTest.php b/tests/Fixer/Alias/ArrayPushFixerTest.php index 3b7527e3dc1..9d7bc437eec 100644 --- a/tests/Fixer/Alias/ArrayPushFixerTest.php +++ b/tests/Fixer/Alias/ArrayPushFixerTest.php @@ -113,6 +113,26 @@ public function provideFixCases(): iterable ', ]; + yield 'simple traditional array' => [ + ' [ + ' [ + ' [ + '$a(1,2), $c);', ]; + yield 'push multiple short' => [ + ' [ '