Skip to content

Commit c2e15f0

Browse files
committed
Add a test case where the context is truthy
1 parent 6fceb73 commit c2e15f0

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
@@ -176,4 +176,16 @@ public function test14($array) {
176176
}
177177
assertType("array<mixed>", $array);
178178
}
179+
180+
/**
181+
* @param array<mixed> $array
182+
*/
183+
public function test15($array) {
184+
if (array_all($array, fn ($value) => is_int($value)) === true) {
185+
assertType("array<int>", $array);
186+
} else {
187+
assertType("array<mixed>", $array);
188+
}
189+
assertType("array<mixed>", $array);
190+
}
179191
}

0 commit comments

Comments
 (0)