Skip to content

Commit 795c2fb

Browse files
committed
add fixture with same-array union
1 parent befd410 commit 795c2fb

2 files changed

Lines changed: 61 additions & 1 deletion

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\AddReturnDocblockDataProviderRector\Fixture;
4+
5+
use Nette\Utils\FileSystem;
6+
use PHPUnit\Framework\Attributes\DataProvider;
7+
use PHPUnit\Framework\TestCase;
8+
9+
final class UnionSameArrayType extends TestCase
10+
{
11+
#[DataProvider('provideData')]
12+
public function testSomething()
13+
{
14+
}
15+
16+
public static function provideData(): \Iterator
17+
{
18+
yield ['...', __DIR__ . '/Source/expected/expected.txt'];
19+
yield ["-old\n+new", __DIR__ . '/Source/expected/expected_old_new.txt'];
20+
21+
yield [
22+
FileSystem::read('...'),
23+
__DIR__ . '/Fixture/expected_with_full_diff_by_phpunit.diff',
24+
];
25+
}
26+
}
27+
28+
?>
29+
-----
30+
<?php
31+
32+
namespace Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\AddReturnDocblockDataProviderRector\Fixture;
33+
34+
use Nette\Utils\FileSystem;
35+
use PHPUnit\Framework\Attributes\DataProvider;
36+
use PHPUnit\Framework\TestCase;
37+
38+
final class UnionSameArrayType extends TestCase
39+
{
40+
#[DataProvider('provideData')]
41+
public function testSomething()
42+
{
43+
}
44+
45+
/**
46+
* @return \Iterator<array<int, string>>
47+
*/
48+
public static function provideData(): \Iterator
49+
{
50+
yield ['...', __DIR__ . '/Source/expected/expected.txt'];
51+
yield ["-old\n+new", __DIR__ . '/Source/expected/expected_old_new.txt'];
52+
53+
yield [
54+
FileSystem::read('...'),
55+
__DIR__ . '/Fixture/expected_with_full_diff_by_phpunit.diff',
56+
];
57+
}
58+
}
59+
60+
?>

tests/Console/Formatter/ColorConsoleDiffFormatterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function test(string $content, string $expectedFormattedFileContent): voi
2929
}
3030

3131
/**
32-
* @return Iterator<(array<int, string>|array<int, string>)>
32+
* @return Iterator<array<int, string>>
3333
*/
3434
public static function provideData(): Iterator
3535
{

0 commit comments

Comments
 (0)