* 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\ArrayNotation; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @internal * * @covers \PhpCsFixer\Fixer\ArrayNotation\YieldFromArrayToYieldsFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\ArrayNotation\YieldFromArrayToYieldsFixer> */ final class YieldFromArrayToYieldsFixerTest 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 [ ' true; yield "foo" => foo(1, 2); yield "bar" => function ($x, $y) { return max($x, $y); }; yield "baz" => function () { yield [1, 2]; }; '.' }', ' true, "foo" => foo(1, 2), "bar" => function ($x, $y) { return max($x, $y); }, "baz" => function () { yield [1, 2]; }, ]; }', ]; yield [ ' [yield 1, yield from [2, 3]], fn() => [yield from [1, 2], yield 3], fn() => [yield from array(1, 2), yield 3] ]; } ', ]; yield [ ' [ '