Skip to content

Commit 386e18c

Browse files
authored
Add phpdoc for iterators in unit tests
1 parent 547aff4 commit 386e18c

File tree

4 files changed

+70
-1
lines changed

4 files changed

+70
-1
lines changed

tests/PHPStan/Type/BenevolentUnionTypeTest.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
class BenevolentUnionTypeTest extends PHPStanTestCase
2121
{
2222

23+
/**
24+
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
25+
*/
2326
public static function dataCanAccessProperties(): Iterator
2427
{
2528
yield [
@@ -49,6 +52,9 @@ public function testCanAccessProperties(BenevolentUnionType $type, TrinaryLogic
4952
);
5053
}
5154

55+
/**
56+
* @return Iterator<int, array{BenevolentUnionType, string, TrinaryLogic}>
57+
*/
5258
public static function dataHasProperty(): Iterator
5359
{
5460
yield [
@@ -87,6 +93,9 @@ public function testHasProperty(BenevolentUnionType $type, string $propertyName,
8793
);
8894
}
8995

96+
/**
97+
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
98+
*/
9099
public static function dataCanCallMethods(): Iterator
91100
{
92101
yield [
@@ -116,6 +125,9 @@ public function testCanCanCallMethods(BenevolentUnionType $type, TrinaryLogic $e
116125
);
117126
}
118127

128+
/**
129+
* @return Iterator<int, array{BenevolentUnionType, string, TrinaryLogic}>
130+
*/
119131
public static function dataHasMethod(): Iterator
120132
{
121133
yield [
@@ -151,6 +163,9 @@ public function testHasMethod(BenevolentUnionType $type, string $methodName, Tri
151163
);
152164
}
153165

166+
/**
167+
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
168+
*/
154169
public static function dataCanAccessConstants(): Iterator
155170
{
156171
yield [
@@ -180,6 +195,9 @@ public function testCanAccessConstants(BenevolentUnionType $type, TrinaryLogic $
180195
);
181196
}
182197

198+
/**
199+
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
200+
*/
183201
public static function dataIsIterable(): Iterator
184202
{
185203
yield [
@@ -215,6 +233,9 @@ public function testIsIterable(BenevolentUnionType $type, TrinaryLogic $expected
215233
);
216234
}
217235

236+
/**
237+
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
238+
*/
218239
public static function dataIsIterableAtLeastOnce(): Iterator
219240
{
220241
yield [
@@ -250,6 +271,9 @@ public function testIsIterableAtLeastOnce(BenevolentUnionType $type, TrinaryLogi
250271
);
251272
}
252273

274+
/**
275+
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
276+
*/
253277
public static function dataIsArray(): Iterator
254278
{
255279
yield [
@@ -279,6 +303,9 @@ public function testIsArray(BenevolentUnionType $type, TrinaryLogic $expectedRes
279303
);
280304
}
281305

306+
/**
307+
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
308+
*/
282309
public static function dataIsString(): Iterator
283310
{
284311
yield [
@@ -311,6 +338,9 @@ public function testIsString(BenevolentUnionType $type, TrinaryLogic $expectedRe
311338
);
312339
}
313340

341+
/**
342+
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
343+
*/
314344
public static function dataIsNumericString(): Iterator
315345
{
316346
yield [
@@ -342,6 +372,9 @@ public function testIsNumericString(BenevolentUnionType $type, TrinaryLogic $exp
342372
);
343373
}
344374

375+
/**
376+
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
377+
*/
345378
public static function dataIsNonFalsyString(): Iterator
346379
{
347380
yield [
@@ -373,6 +406,9 @@ public function testIsNonFalsyString(BenevolentUnionType $type, TrinaryLogic $ex
373406
);
374407
}
375408

409+
/**
410+
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
411+
*/
376412
public static function dataIsLiteralString(): Iterator
377413
{
378414
yield [
@@ -404,6 +440,9 @@ public function testIsLiteralString(BenevolentUnionType $type, TrinaryLogic $exp
404440
);
405441
}
406442

443+
/**
444+
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
445+
*/
407446
public static function dataIsOffsetAccesible(): Iterator
408447
{
409448
yield [
@@ -439,6 +478,9 @@ public function testIsOffsetAccessible(BenevolentUnionType $type, TrinaryLogic $
439478
);
440479
}
441480

481+
/**
482+
* @return Iterator<int, array{BenevolentUnionType, ConstantStringType, TrinaryLogic}>
483+
*/
442484
public static function dataHasOffsetValueType(): Iterator
443485
{
444486
yield [
@@ -477,6 +519,9 @@ public function testHasOffsetValue(BenevolentUnionType $type, Type $offsetType,
477519
);
478520
}
479521

522+
/**
523+
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
524+
*/
480525
public static function dataIsCallable(): Iterator
481526
{
482527
yield [
@@ -506,6 +551,9 @@ public function testIsCallable(BenevolentUnionType $type, TrinaryLogic $expected
506551
);
507552
}
508553

554+
/**
555+
* @return Iterator<int, array{BenevolentUnionType, TrinaryLogic}>
556+
*/
509557
public static function dataIsCloneable(): Iterator
510558
{
511559
yield [

tests/PHPStan/Type/IntersectionTypeTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
class IntersectionTypeTest extends PHPStanTestCase
2929
{
3030

31+
/**
32+
* @return Iterator<int, array{Type, Type, TrinaryLogic}>
33+
*/
3134
public static function dataAccepts(): Iterator
3235
{
3336
$intersectionType = new IntersectionType([
@@ -70,7 +73,7 @@ public static function dataAccepts(): Iterator
7073
}
7174

7275
#[DataProvider('dataAccepts')]
73-
public function testAccepts(IntersectionType $type, Type $otherType, TrinaryLogic $expectedResult): void
76+
public function testAccepts(Type $type, Type $otherType, TrinaryLogic $expectedResult): void
7477
{
7578
$actualResult = $type->accepts($otherType, true)->result;
7679
$this->assertSame(
@@ -121,6 +124,9 @@ public function testIsCallable(IntersectionType $type, TrinaryLogic $expectedRes
121124
);
122125
}
123126

127+
/**
128+
* @return Iterator<int, array{IntersectionType, Type, TrinaryLogic}>
129+
*/
124130
public static function dataIsSuperTypeOf(): Iterator
125131
{
126132
$intersectionTypeA = new IntersectionType([
@@ -242,6 +248,9 @@ public function testIsSuperTypeOf(IntersectionType $type, Type $otherType, Trina
242248
);
243249
}
244250

251+
/**
252+
* @return Iterator<int, array{IntersectionType, Type, TrinaryLogic}>
253+
*/
245254
public static function dataIsSubTypeOf(): Iterator
246255
{
247256
$intersectionTypeA = new IntersectionType([

tests/PHPStan/Type/ObjectTypeTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,9 @@ public function testAccepts(
557557
);
558558
}
559559

560+
/**
561+
* @return Iterator<int, array{ObjectType, string, TrinaryLogic}>
562+
*/
560563
public static function dataHasConstant(): Iterator
561564
{
562565
yield [

tests/PHPStan/Type/UnionTypeTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public function testIsCallable(UnionType $type, TrinaryLogic $expectedResult): v
8787
);
8888
}
8989

90+
/**
91+
* @return Iterator<int, array{Type}>
92+
*/
9093
public static function dataSelfCompare(): Iterator
9194
{
9295
$reflectionProvider = self::createReflectionProvider();
@@ -166,6 +169,9 @@ public function testSelfCompare(Type $type): void
166169
);
167170
}
168171

172+
/**
173+
* @return Iterator<array-key, array{UnionType, Type, TrinaryLogic}>
174+
*/
169175
public static function dataIsSuperTypeOf(): Iterator
170176
{
171177
$unionTypeA = new UnionType([
@@ -460,6 +466,9 @@ public function testIsSuperTypeOf(UnionType $type, Type $otherType, TrinaryLogic
460466
);
461467
}
462468

469+
/**
470+
* @return Iterator<int, array{UnionType, Type, TrinaryLogic}>
471+
*/
463472
public static function dataIsSubTypeOf(): Iterator
464473
{
465474
$unionTypeA = new UnionType([

0 commit comments

Comments
 (0)