|
| 1 | +<?php declare(strict_types=1); |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of PHP CS Fixer: custom fixers. |
| 5 | + * |
| 6 | + * (c) 2018 Kuba Werłos |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view |
| 9 | + * the LICENSE file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +namespace Tests\Fixer; |
| 13 | + |
| 14 | +/** |
| 15 | + * @internal |
| 16 | + * |
| 17 | + * @covers \PhpCsFixerCustomFixers\Fixer\PhpdocTypeListFixer |
| 18 | + */ |
| 19 | +final class PhpdocTypeListFixerTest extends AbstractFixerTestCase |
| 20 | +{ |
| 21 | + public function testIsRisky(): void |
| 22 | + { |
| 23 | + self::assertRiskiness(false); |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * @dataProvider provideFixCases |
| 28 | + */ |
| 29 | + public function testFix(string $expected, ?string $input = null): void |
| 30 | + { |
| 31 | + $this->doTest($expected, $input); |
| 32 | + } |
| 33 | + |
| 34 | + /** |
| 35 | + * @return iterable<array{0: string, 1?: string}> |
| 36 | + */ |
| 37 | + public static function provideFixCases(): iterable |
| 38 | + { |
| 39 | + yield [ |
| 40 | + '<?php |
| 41 | + /** @var array<int, string> */ |
| 42 | + /** @var array<int, array<string, bool>> */ |
| 43 | + /** @var array<int, array{string, string, string}> */ |
| 44 | + ', |
| 45 | + ]; |
| 46 | + |
| 47 | + yield [ |
| 48 | + '<?php /** @var list<string> */', |
| 49 | + '<?php /** @var array<string> */', |
| 50 | + ]; |
| 51 | + |
| 52 | + yield [ |
| 53 | + '<?php /** @var list<list<list<string>>> */', |
| 54 | + '<?php /** @var array<array<array<string>>> */', |
| 55 | + ]; |
| 56 | + |
| 57 | + yield [ |
| 58 | + '<?php /** @var list<array<int, list<bool>>> */', |
| 59 | + '<?php /** @var array<array<int, array<bool>>> */', |
| 60 | + ]; |
| 61 | + |
| 62 | + yield [ |
| 63 | + '<?php /** @var array<int, list<array<string, bool>>> */', |
| 64 | + '<?php /** @var array<int, array<array<string, bool>>> */', |
| 65 | + ]; |
| 66 | + |
| 67 | + yield [ |
| 68 | + '<?php /** @var list<callable(int, int): string> */', |
| 69 | + '<?php /** @var array<callable(int, int): string> */', |
| 70 | + ]; |
| 71 | + |
| 72 | + yield [ |
| 73 | + '<?php /** @var non-empty-list<Type> */', |
| 74 | + '<?php /** @var non-empty-array<Type> */', |
| 75 | + ]; |
| 76 | + } |
| 77 | +} |
0 commit comments