* 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\NoUnneededFinalMethodFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\ClassNotation\NoUnneededFinalMethodFixer> * * @phpstan-import-type _AutogeneratedInputConfiguration from \PhpCsFixer\Fixer\ClassNotation\NoUnneededFinalMethodFixer */ final class NoUnneededFinalMethodFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases * * @param _AutogeneratedInputConfiguration $configuration */ public function testFix(string $expected, ?string $input = null, array $configuration = []): void { $this->fixer->configure($configuration); $this->doTest($expected, $input); } public static function provideFixCases(): iterable { yield 'default' => [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ ' [ 'bar3(); } private function bar2(){ echo 1; } private function bar3(){ echo 2; } }', 'bar3(); } private function bar2(){ echo 1; } private final function bar3(){ echo 2; } }', ]; yield [ ' false], ]; } /** * @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 [ ' [ 'doTest($expected, $input); } /** * @return iterable */ public static function provideFix82Cases(): iterable { yield 'final readonly class - final after visibility method' => [ ' [ '