* 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\ClassNotation; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @author Filippo Tessarotto * * @internal * * @covers \PhpCsFixer\Fixer\ClassNotation\ProtectedToPrivateFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\ClassNotation\ProtectedToPrivateFixer> */ final class ProtectedToPrivateFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } /** * @return iterable */ public static function provideFixCases(): iterable { $attributesAndMethodsOriginal = self::getAttributesAndMethods(true); $attributesAndMethodsFixed = self::getAttributesAndMethods(false); yield 'final-extends' => [ " [ " [ " [ " [ " [ " [ ' [ " [ " [ " [ " [ " [ " [ ' [ "doTest($expected, $input); } /** * @return iterable */ public static function provideFix80Cases(): iterable { yield [ 'doTest($expected, $input); } /** * @return iterable */ public static function provideFix81Cases(): iterable { yield [ ' [ // ' [ 'test(); ', 'test(); ', ]; yield 'enum with trait' => [ 'getFoo(); } } enum DocumentStats { use NamedDocumentStatus; case DRAFT; private function getFoo(): string { return "X"; } } echo DocumentStats::DRAFT->getStatusName(); ', 'getFoo(); } } enum DocumentStats { use NamedDocumentStatus; case DRAFT; protected function getFoo(): string { return "X"; } } echo DocumentStats::DRAFT->getStatusName(); ', ]; } /** * @dataProvider provideFix82Cases * * @requires PHP 8.2 */ public function testFix82(string $expected, string $input): void { $this->doTest($expected, $input); } /** * @return iterable */ public static function provideFix82Cases(): iterable { yield 'final readonly' => [ ' [ '