File tree Expand file tree Collapse file tree 3 files changed +61
-0
lines changed
Expand file tree Collapse file tree 3 files changed +61
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Rector \PHPUnit \Tests \Issues \EmptyUnion ;
6+
7+ use Iterator ;
8+ use PHPUnit \Framework \Attributes \DataProvider ;
9+ use Rector \Testing \PHPUnit \AbstractRectorTestCase ;
10+
11+ final class EmptyUnionTest extends AbstractRectorTestCase
12+ {
13+ #[DataProvider('provideData ' )]
14+ public function test (string $ filePath ): void
15+ {
16+ $ this ->doTestFile ($ filePath );
17+ }
18+
19+ public static function provideData (): Iterator
20+ {
21+ return self ::yieldFilesFromDirectory (__DIR__ . '/Fixture ' );
22+ }
23+
24+ public function provideConfigFilePath (): string
25+ {
26+ return __DIR__ . '/config/configured_rule.php ' ;
27+ }
28+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Rector \PHPUnit \Tests \Issues \EmptyUnion \Fixture ;
4+
5+ use ArrayIterator ;
6+ use PHPUnit \Framework \TestCase ;
7+
8+ final class SomeTest extends TestCase
9+ {
10+ public function testSomething ()
11+ {
12+ $ this ->assertCount (0 , $ this ->someCall ());
13+ }
14+
15+ public function someCall (): ?ArrayIterator
16+ {
17+ return new ArrayIterator ([]);
18+ }
19+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ use Rector \Config \RectorConfig ;
6+ use Rector \PHPUnit \CodeQuality \Rector \MethodCall \AssertCountWithZeroToAssertEmptyRector ;
7+ use Rector \PHPUnit \CodeQuality \Rector \MethodCall \AssertEmptyNullableObjectToAssertInstanceofRector ;
8+
9+ return static function (RectorConfig $ rectorConfig ): void {
10+ $ rectorConfig ->rules ([
11+ AssertCountWithZeroToAssertEmptyRector::class,
12+ AssertEmptyNullableObjectToAssertInstanceofRector::class,
13+ ]);
14+ };
You can’t perform that action at this time.
0 commit comments