File tree Expand file tree Collapse file tree
rules-tests/CodeQuality/Rector/Class_/YieldDataProviderRector/Fixture Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Rector \PHPUnit \Tests \CodeQuality \Rector \Class_ \YieldDataProviderRector \Fixture ;
4+
5+ use PHPUnit \Framework \TestCase ;
6+
7+ final class UseDataProviderTest extends TestCase
8+ {
9+ #[\PHPUnit \Framework \Attributes \DataProvider('dataProvider ' )]
10+ public function test (string $ val1 , string $ val2 ): void
11+ {
12+ }
13+
14+ public static function dataProvider (): iterable
15+ {
16+ yield from [
17+ ['value3 ' , 'value4 ' ],
18+ ['value5 ' , 'value6 ' ],
19+ ['value7 ' , 'value8 ' ],
20+ ];
21+
22+ if (PHP_VERSION_ID < 80100 ) {
23+ return ;
24+ }
25+
26+ yield ['value1 ' , 'value2 ' ];
27+ }
28+
29+ }
30+
31+ ?>
32+ -----
33+ <?php
34+
35+ namespace Rector \PHPUnit \Tests \CodeQuality \Rector \Class_ \YieldDataProviderRector \Fixture ;
36+
37+ use PHPUnit \Framework \TestCase ;
38+
39+ final class UseDataProviderTest extends TestCase
40+ {
41+ #[\PHPUnit \Framework \Attributes \DataProvider('dataProvider ' )]
42+ public function test (string $ val1 , string $ val2 ): void
43+ {
44+ }
45+
46+ public static function dataProvider (): \Iterator
47+ {
48+ yield ['value3 ' , 'value4 ' ];
49+ yield ['value5 ' , 'value6 ' ];
50+ yield ['value7 ' , 'value8 ' ];
51+
52+ if (PHP_VERSION_ID < 80100 ) {
53+ return ;
54+ }
55+
56+ yield ['value1 ' , 'value2 ' ];
57+ }
58+
59+ }
60+
61+ ?>
You can’t perform that action at this time.
0 commit comments