* 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\ClassReferenceNameCasingFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Casing\ClassReferenceNameCasingFixer> */ final class ClassReferenceNameCasingFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } /** * @return iterable */ public static function provideFixCases(): iterable { yield [ 'exception;', ]; yield [ ' exception];', ]; yield [ ' null, null, new class {}); \Closure::bind(fn () => null, null, new class {}); Foo\Bar::bind(fn () => null, null, new class {}); \A\B\Bar::bind(fn () => null, null, new class {}); ', ' null, null, new class {}); \CLOSURE::bind(fn () => null, null, new class {}); Foo\Bar::bind(fn () => null, null, new class {}); \A\B\Bar::bind(fn () => null, null, new class {}); ', ]; yield [ "set('sonata.exporter.writer.xml', EXCEPTION::class); ", ]; yield [ '{error}; ', ]; yield [ '{\error}; ', ]; yield ['doTest($expected, $input); } /** * @return iterable */ public static function provideFix80Cases(): iterable { yield [ 'exception instanceof Exception) {};', ]; } /** * @dataProvider provideFix81Cases * * @requires PHP 8.1 */ public function testFix81(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } /** * @return iterable */ public static function provideFix81Cases(): iterable { yield [ ' [ ' [ '