Skip to content

Commit 6b0f6f2

Browse files
committed
add docblock iterable
1 parent 692346d commit 6b0f6f2

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

rector.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
__DIR__ . '/tests/FilterTest.php',
2727
],
2828
])
29+
->withSets([
30+
__DIR__ . '/vendor/rector/rector/config/set/type-declaration-docblocks.php',
31+
])
2932
->withParallel()
3033
->withRootFiles()
3134
->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])

tests/AtLeastTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
final class AtLeastTest extends TestCase
1313
{
14+
/**
15+
* @param int[]|string[] $data
16+
*/
1417
#[DataProvider('onceDataProvider')]
1518
public function testOnce(array $data, callable $filter, bool $expected): void
1619
{
@@ -20,6 +23,9 @@ public function testOnce(array $data, callable $filter, bool $expected): void
2023
);
2124
}
2225

26+
/**
27+
* @return Iterator<mixed>
28+
*/
2329
public static function onceDataProvider(): Iterator
2430
{
2531
yield [
@@ -44,6 +50,9 @@ public static function onceDataProvider(): Iterator
4450
];
4551
}
4652

53+
/**
54+
* @param int[]|string[] $data
55+
*/
4756
#[DataProvider('twiceDataProvider')]
4857
public function testTwice(array $data, callable $filter, bool $expected): void
4958
{
@@ -54,6 +63,9 @@ public function testTwice(array $data, callable $filter, bool $expected): void
5463
}
5564

5665
// phpcs:disable
66+
/**
67+
* @return Iterator<mixed>
68+
*/
5769
public static function twiceDataProvider(): Iterator
5870
{
5971
yield [
@@ -79,6 +91,9 @@ public static function twiceDataProvider(): Iterator
7991
}
8092

8193
// phpcs:enable
94+
/**
95+
* @param int[]|bool[]|null[]|string[] $data
96+
*/
8297
#[DataProvider('timesDataProvider')]
8398
public function testTimes(array $data, callable $filter, bool $expected): void
8499
{
@@ -88,6 +103,9 @@ public function testTimes(array $data, callable $filter, bool $expected): void
88103
);
89104
}
90105

106+
/**
107+
* @return Iterator<mixed>
108+
*/
91109
public static function timesDataProvider(): Iterator
92110
{
93111
yield [

tests/FinderTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public function testFirst(iterable $data, callable $filter, mixed $expected): vo
3030
);
3131
}
3232

33+
/**
34+
* @return Iterator<mixed>
35+
*/
3336
public static function firstDataProvider(): Iterator
3437
{
3538
yield [
@@ -63,6 +66,9 @@ public function testFirstReturnKey(iterable $data, callable $filter, mixed $expe
6366
);
6467
}
6568

69+
/**
70+
* @return Iterator<mixed>
71+
*/
6672
public static function firstReturnKeyDataProvider(): Iterator
6773
{
6874
yield [
@@ -96,6 +102,9 @@ public function testLast(iterable $data, callable $filter, mixed $expected): voi
96102
);
97103
}
98104

105+
/**
106+
* @return Iterator<mixed>
107+
*/
99108
public static function lastDataProvider(): Iterator
100109
{
101110
$generator = static function (): Generator {
@@ -165,6 +174,9 @@ public function testLastReturnKey(iterable $data, callable $filter, mixed $expec
165174
);
166175
}
167176

177+
/**
178+
* @return Iterator<mixed>
179+
*/
168180
public static function lastReturnKeyDataProvider(): Iterator
169181
{
170182
$generator = static function (): Generator {
@@ -234,6 +246,9 @@ public function testLastReturnKeyResortKey(iterable $data, callable $filter, mix
234246
);
235247
}
236248

249+
/**
250+
* @return Iterator<array<int, (array<int, int>|Closure(mixed $datum):bool|int|null)>>
251+
*/
237252
public static function lastReturnKeyResortKeyDataProvider(): Iterator
238253
{
239254
yield [
@@ -260,6 +275,9 @@ public function testLastKeepCurrentOriginalData(): void
260275
$this->assertSame(DateTime::class, current($data)::class);
261276
}
262277

278+
/**
279+
* @param array<int|string, int> $expected
280+
*/
263281
#[DataProvider('rowsDataProvider')]
264282
public function testRows(iterable $data, callable $filter, array $expected): void
265283
{
@@ -269,6 +287,9 @@ public function testRows(iterable $data, callable $filter, array $expected): voi
269287
);
270288
}
271289

290+
/**
291+
* @return Iterator<mixed>
292+
*/
272293
public static function rowsDataProvider(): Iterator
273294
{
274295
yield [
@@ -299,6 +320,9 @@ public static function rowsDataProvider(): Iterator
299320
];
300321
}
301322

323+
/**
324+
* @param int[] $expected
325+
*/
302326
#[DataProvider('rowsDataProviderPreserveKey')]
303327
public function testRowsPreserveKey(iterable $data, callable $filter, array $expected): void
304328
{
@@ -308,6 +332,9 @@ public function testRowsPreserveKey(iterable $data, callable $filter, array $exp
308332
);
309333
}
310334

335+
/**
336+
* @return Iterator<array<int, (array|Closure(mixed $datum):bool)>>
337+
*/
311338
public static function rowsDataProviderPreserveKey(): Iterator
312339
{
313340
yield [

tests/OnlyTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
final class OnlyTest extends TestCase
1414
{
15+
/**
16+
* @param int[]|string[] $data
17+
*/
1518
#[DataProvider('onceDataProvider')]
1619
public function testOnce(array $data, callable $filter, bool $expected): void
1720
{
@@ -22,6 +25,9 @@ public function testOnce(array $data, callable $filter, bool $expected): void
2225
}
2326

2427
// phpcs:disable
28+
/**
29+
* @return Iterator<mixed>
30+
*/
2531
public static function onceDataProvider(): Iterator
2632
{
2733
yield [
@@ -47,6 +53,9 @@ public static function onceDataProvider(): Iterator
4753
}
4854

4955
// phpcs:enable
56+
/**
57+
* @param stdClass[]|int[]|string[]|bool[] $data
58+
*/
5059
#[DataProvider('twiceDataProvider')]
5160
public function testTwice(array $data, callable $filter, bool $expected): void
5261
{
@@ -57,6 +66,9 @@ public function testTwice(array $data, callable $filter, bool $expected): void
5766
}
5867

5968
// phpcs:disable
69+
/**
70+
* @return Iterator<mixed>
71+
*/
6072
public static function twiceDataProvider(): Iterator
6173
{
6274
yield [
@@ -82,6 +94,9 @@ public static function twiceDataProvider(): Iterator
8294
}
8395

8496
// phpcs:enable
97+
/**
98+
* @param int[]|string[] $data
99+
*/
85100
#[DataProvider('timesDataProvider')]
86101
public function testTimes(array $data, callable $filter, bool $expected): void
87102
{
@@ -91,6 +106,9 @@ public function testTimes(array $data, callable $filter, bool $expected): void
91106
);
92107
}
93108

109+
/**
110+
* @return Iterator<mixed>
111+
*/
94112
public static function timesDataProvider(): Iterator
95113
{
96114
yield [

0 commit comments

Comments
 (0)