* Dariusz RumiƄski * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ namespace PhpCsFixer\Tests\Fixer\Casing; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @internal * * @covers \PhpCsFixer\Fixer\Casing\NativeTypeDeclarationCasingFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Casing\NativeTypeDeclarationCasingFixer> */ final class NativeTypeDeclarationCasingFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } public static function provideFixCases(): iterable { yield [ 'c || $this->d; } } function C(float $a): array { return [$a];} function D(array $a): array { return [$a];} ', 'c || $this->d; } } function C(FLOAT $a): ARRAY { return [$a];} function D(ARRAY $a): ARRAY { return [$a];} ', ]; yield [ ' 1;', ' 1;', ]; yield [ ' [ ' [ ' [ 'doTest($expected, $input); } /** * @return iterable */ public static function provideFix80Cases(): iterable { yield [ ' [ ' 1;', ' 1;', ]; yield [ ' [ ' [ ' [ ' 1;', ' 1;', ]; yield 'union Types' => [ 'doTest($expected, $input); } /** * @return iterable */ public static function provideFix81Cases(): iterable { yield 'return type `never`' => [ ' [ 'doTest($expected, $input); } /** * @return iterable */ public static function provideFix82Cases(): iterable { yield 'disjunctive normal form types in arrow function' => [ ' 1;', ' 1;', ]; yield 'iterable: disjunctive normal form types in arrow function' => [ ' 1;', ' 1;', ]; foreach (['true', 'false', 'null'] as $type) { yield \sprintf('standalone type `%s` in class method', $type) => [ \sprintf(' [ \sprintf(' [ \sprintf(' [ \sprintf(' $A);', $type), \sprintf(' $A);', strtoupper($type)), ]; } yield 'intersection Types' => [ 'doTest($expected, $input); } /** * @return iterable */ public static function provideFix83Cases(): iterable { yield 'simple case' => [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ '