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 5fd3c5c commit d9a2d10Copy full SHA for d9a2d10
tests/PHPStan/Analyser/nsrt/bug-13546.php
@@ -61,3 +61,14 @@ function mixedLast(mixed $mixed): void
61
}
62
assertType('mixed~array<mixed, mixed>', $mixed);
63
64
+
65
+/** @param list<string> $array */
66
+function firstInCondition(array $array): mixed
67
+{
68
+ if (($key = array_key_first($array)) !== null) {
69
+ assertType('list<string>', $array); // could be 'non-empty-list<string>'
70
+ return $array[$key];
71
+ }
72
+ assertType('list<string>', $array);
73
+ return null;
74
+}
0 commit comments