Skip to content

Commit 4196932

Browse files
committed
test maybe null
1 parent 28f6ee1 commit 4196932

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,15 @@ function firstInCondition(array $array): mixed
7272
assertType('list<string>', $array);
7373
return null;
7474
}
75+
76+
/** @param list<string> $array */
77+
function maybeNull(array $array, ?int $nullOrInt, ?string $nullOrString): void
78+
{
79+
if (array_key_first($array) !== $nullOrInt) {
80+
assertType('list<string>', $array);
81+
}
82+
if (array_key_first($array) !== $nullOrString) {
83+
assertType('list<string>', $array);
84+
}
85+
assertType('list<string>', $array);
86+
}

0 commit comments

Comments
 (0)