* 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 */ final class NoUnneededFinalMethodFixerTest extends AbstractFixerTestCase { /** * @dataProvider provideFixCases */ public function testFix(string $expected, ?string $input = null): void { $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; } }', ]; } /** * @param array $config * * @dataProvider provideFixConfigCases */ public function testFixConfig(string $expected, string $input, array $config): void { $this->fixer->configure($config); $this->doTest($expected, $input); } public static function provideFixConfigCases(): iterable { yield [ ' false], ]; } /** * @dataProvider provideFix81Cases * * @requires PHP 8.1 */ public function testFix81(string $expected, ?string $input = null): void { $this->doTest($expected, $input); } public static function provideFix81Cases(): iterable { yield [ ' [ 'doTest($expected, $input); } public static function provideFix82Cases(): iterable { yield 'final readonly class - final after visibility method' => [ ' [ '