Skip to content

Commit 6be0c13

Browse files
committed
another test
1 parent 18eea1c commit 6be0c13

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/PHPStan/Analyser/nsrt/bug-14081.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,20 @@ function lastNotNull(array $array): mixed
6666
}
6767
return null;
6868
}
69+
70+
/** @param list<string> $array */
71+
function noIf(array $array): void
72+
{
73+
$key = array_key_first($array);
74+
assertType('int<0, max>|null', $key);
75+
assertType('list<string>', $array);
76+
assertType('string', $array[$key]);
77+
78+
if ($array === []) {
79+
return;
80+
}
81+
$key = array_key_first($array);
82+
assertType('int<0, max>', $key);
83+
assertType('non-empty-list<string>', $array);
84+
assertType('string', $array[$key]);
85+
}

0 commit comments

Comments
 (0)