We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c265a6a commit e44e476Copy full SHA for e44e476
1 file changed
tests/PHPStan/Analyser/nsrt/array-all.php
@@ -2,6 +2,9 @@
2
3
namespace ArrayAll;
4
5
+use DateTime;
6
+use DateTimeImmutable;
7
+
8
use function PHPStan\Testing\assertType;
9
10
class Foo {
@@ -58,4 +61,22 @@ public function test6($array) {
58
61
assertType("array<mixed>", $array);
59
62
}
60
63
64
65
+ /**
66
+ * @param array<mixed> $array
67
+ */
68
+ public function test7($array) {
69
+ if (array_all($array, fn ($value) => $value instanceof DateTime)) {
70
+ assertType("array<DateTime>", $array);
71
+ }
72
73
74
75
76
77
+ public function test8($array) {
78
+ if (array_all($array, fn ($value) => $value instanceof DateTime || $value instanceof DateTimeImmutable)) {
79
+ assertType("array<DateTime|DateTimeImmutable>", $array);
80
81
82
0 commit comments