* 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\FunctionNotation; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @internal * * @covers \PhpCsFixer\Fixer\FunctionNotation\StaticLambdaFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\FunctionNotation\StaticLambdaFixer> */ final class StaticLambdaFixerTest 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 'sample' => [ " [ ' null;$b=static fn() => null;', ' null;$b=fn() => null;', ]; yield [ ' null;', ' null;', ]; yield [ ' null;', ' null;', ]; yield [ ' null; echo $this->foo();', ' null; echo $this->foo();', ]; yield [ ' null ?> foo();', ' null ?> foo();', ]; yield [ ' var_dump($this); $a(); } } ', ]; yield [ ' "bar"]) => [];', ' "bar"]) => [];', ]; yield [ ' $item->getName(), $this->getItems() ); } }', ' $item->getName(), $this->getItems() ); } }', ]; yield [ ' $item->getName(1, $this->foo()), $this->getItems() ); } }', ]; yield [ ' \'this\']; var_dump(${$a[0]}); }; } } ', ]; yield [ 'abc(); ', ]; yield [ ' $this, [] ); } } ', ]; } }