* 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\Phpdoc; use PhpCsFixer\Tests\Test\AbstractFixerTestCase; /** * @internal * * @covers \PhpCsFixer\Fixer\Phpdoc\PhpdocArrayTypeFixer * * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Phpdoc\PhpdocArrayTypeFixer> */ final class PhpdocArrayTypeFixerTest 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 [ <<<'PHP' */', '>>> $x */', '>>> $x */', '> */', ' */', ]; yield [ ' */', ' */', '|array|array|array */', '|float[]|array|string[] */', ]; yield [ <<<'PHP' } $foo * @param callable(array): array $bar */ PHP, <<<'PHP' * @var \Closure(iterable<\DateTime>): array * @var array|'No[][]'|array>|'No[]' */ PHP, <<<'PHP' ): void[] * @var Yes[]|'No[][]'|Yes[][]|'No[]' */ PHP, ]; yield [ <<<'PHP' $a * @param ?array> $b * @param ?'literal[]' $c */ PHP, <<<'PHP' */', ' */', ''; $input .= '[]'; } yield [ \sprintf('