diff --git a/tests/Fixer/Alias/ArrayPushFixerTest.php b/tests/Fixer/Alias/ArrayPushFixerTest.php index 89a1061cfe4..4632141de40 100644 --- a/tests/Fixer/Alias/ArrayPushFixerTest.php +++ b/tests/Fixer/Alias/ArrayPushFixerTest.php @@ -95,35 +95,25 @@ public function provideFixCases() ' [ 'bar, 1); - array_push(foo()->bar + 1, 1); - ', - ]; - yield 'different namespace and not a function call' => [ ' [ ' [ - ' [ ' [ - ' [ @@ -368,7 +280,7 @@ public function provideTestFixCases() continue; } - while (false) continue 2; + while (false) break 1; do { continue; @@ -379,7 +291,7 @@ public function provideTestFixCases() } foreach ($a as $b) continue; - for (; $i < 1; ++$i) continue 7; echo $i; + for (; $i < 1; ++$i) break 1; echo $i; for (;;) continue; while(false) continue; while(false) continue?>doTest($expected, $input); - } + foreach ($tests as $index => $test) { + yield $index => $test; + } - public function provideTestFixPhp70Cases() - { - return [ - [ - sprintf(' [ ' [ + '', - ], ]; } @@ -150,13 +147,10 @@ public function testDoNotFix($expected) public function provideDoNotFixCases() { - return [ + $tests = [ 'reference' => [ '', ], - 'super global, invalid from PHP7.1' => [ - '', - ], 'compact 1' => [ ' [ ' [ - ' [ ' $test) { + yield $index => $test; + } + + if (\PHP_VERSION_ID < 70100) { + yield 'super global, invalid from PHP7.1' => [ + '', + ]; + + yield 'super global' => [ + ' [ @@ -117,6 +115,17 @@ public function provideFixCases() yield 'unsafe repeated variable' => [ ' [ + 'a)(1, 2, 3, 4); + ($a["b"]["c"]->a)(1, 2, 3, 4); ($a::$b)(1, 2); - ($a[1]::$b[2]{3})([&$c], array(&$d)); + ($a[1]::$b[2][3])([&$c], array(&$d)); ', 'a, 1, 2, 3, 4); + call_user_func($a["b"]["c"]->a, 1, 2, 3, 4); call_user_func($a::$b, 1, 2); - call_user_func($a[1]::$b[2]{3}, [&$c], array(&$d)); + call_user_func($a[1]::$b[2][3], [&$c], array(&$d)); ', ]; yield [ @@ -180,7 +189,11 @@ public function provideFix70Cases() ' [ - '$a[0] ? : 1;', - '$a[0] ? __FILE__.$a.$b{2}.$c->$a[0] : 1;', - ]; - yield [ ' [ - '{$b} ? $bar{0} : $foo;', - ]; - yield [ '', '', ]; + + if (\PHP_VERSION_ID < 80000) { + yield [ + '{$b} ? $bar{0} : $foo;', + ]; + + yield [ + ' [ + '$a[0] ? : 1;', + '$a[0] ? __FILE__.$a.$b{2}.$c->$a[0] : 1;', + ]; + } } /** diff --git a/tests/Fixtures/Integration/set/@PHP74Migration.test b/tests/Fixtures/Integration/set/@PHP74Migration.test index 87824c3ea80..79f9a037fa2 100644 --- a/tests/Fixtures/Integration/set/@PHP74Migration.test +++ b/tests/Fixtures/Integration/set/@PHP74Migration.test @@ -3,4 +3,4 @@ Integration of @PHP74Migration. --RULESET-- {"@PHP74Migration": true} --REQUIREMENTS-- -{"php": 70400} +{"php": 70400, "php<": 80000}