Skip to content

Commit 2d9dbbb

Browse files
uekannuekann
authored andcommitted
Add new test case for array_all
1 parent 045e1cd commit 2d9dbbb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/PHPStan/Analyser/nsrt/array-all.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace ArrayAll;
44

5+
use DateTime;
6+
57
use function PHPStan\Testing\assertType;
68

79
class Foo {
@@ -58,4 +60,14 @@ public function test6($array) {
5860
assertType("array<mixed>", $array);
5961
}
6062
}
63+
64+
/**
65+
* @param array<mixed> $array
66+
*/
67+
public function test7($array) {
68+
if (array_all($array, fn ($value) => $value instanceof DateTime)) {
69+
assertType("array<DateTime>", $array);
70+
}
71+
}
72+
6173
}

0 commit comments

Comments
 (0)