Skip to content

Commit 4133a04

Browse files
committed
test ast based offset
1 parent 5f2620c commit 4133a04

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

+11
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,14 @@ function getItemsByModifiedIndex(array $items): array
3535
assertType('non-empty-array<int<0, max>, int>', $items);
3636
return $items;
3737
}
38+
39+
/** @param list<int> $list */
40+
function testKeepListAfterIssetIndex(array $list, int $i): void
41+
{
42+
if (isset($list[$i])) {
43+
assertType('list<int>', $list);
44+
$list[$i] = 21;
45+
assertType('non-empty-list<int>', $list);
46+
}
47+
assertType('list<int>', $list);
48+
}

0 commit comments

Comments
 (0)