|
@@ -877,6 +877,24 @@ switch ($a) {
|
|
|
'<?php function test() {return yield from 1 === $a ? $c : $d;};',
|
|
|
'<?php function test() {return yield from $a === 1 ? $c : $d;};',
|
|
|
];
|
|
|
+
|
|
|
+ yield [
|
|
|
+ '<?php if (1_000 === $b);',
|
|
|
+ '<?php if ($b === 1_000);',
|
|
|
+ ];
|
|
|
+
|
|
|
+ yield [
|
|
|
+ '<?php fn() => $c === array(1) ? $b : $d;',
|
|
|
+ null,
|
|
|
+ [
|
|
|
+ 'less_and_greater' => false,
|
|
|
+ ],
|
|
|
+ ];
|
|
|
+
|
|
|
+ yield [
|
|
|
+ '<?php $a ??= 4 === $b ? 2 : 3;',
|
|
|
+ '<?php $a ??= $b === 4 ? 2 : 3;',
|
|
|
+ ];
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1089,52 +1107,6 @@ while (2 !== $b = array_pop($c));
|
|
|
];
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @dataProvider provideFixPhp74Cases
|
|
|
- */
|
|
|
- public function testFixPhp74(string $expected, ?string $input): void
|
|
|
- {
|
|
|
- $this->doTest($expected, $input);
|
|
|
- }
|
|
|
-
|
|
|
- public static function provideFixPhp74Cases(): iterable
|
|
|
- {
|
|
|
- yield [
|
|
|
- '<?php if (1_000 === $b);',
|
|
|
- '<?php if ($b === 1_000);',
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Test with the inverse config.
|
|
|
- *
|
|
|
- * @param _AutogeneratedInputConfiguration $configuration
|
|
|
- *
|
|
|
- * @dataProvider providePHP74CasesInverseCases
|
|
|
- */
|
|
|
- public function testPHP74CasesInverse(string $expected, ?string $input = null, array $configuration = []): void
|
|
|
- {
|
|
|
- $this->fixer->configure($configuration);
|
|
|
-
|
|
|
- $this->doTest($expected, $input);
|
|
|
- }
|
|
|
-
|
|
|
- public static function providePHP74CasesInverseCases(): iterable
|
|
|
- {
|
|
|
- yield [
|
|
|
- '<?php fn() => $c === array(1) ? $b : $d;',
|
|
|
- null,
|
|
|
- [
|
|
|
- 'less_and_greater' => false,
|
|
|
- ],
|
|
|
- ];
|
|
|
-
|
|
|
- yield [
|
|
|
- '<?php $a ??= 4 === $b ? 2 : 3;',
|
|
|
- '<?php $a ??= $b === 4 ? 2 : 3;',
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* @dataProvider provideFixPrePHP80Cases
|
|
|
*
|