Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Dec 19, 2022
1 parent 194f710 commit 8b4d5f8
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1538,15 +1538,20 @@ private static function handleArrayAccessOnKeyedArray(
&& $type->is_list
&& $type->properties[$key_value->value-1]->possibly_undefined
) {
$first = true;
for ($x = 0; $x < $key_value->value; $x++) {
if (!$properties[$x]->possibly_undefined) {
continue;
}
$properties[$x] = Type::combineUnionTypes(
$properties[$x],
$replacement_type,
);
if ($first) {
$first = false;
$properties[$x] = $properties[$x]->setPossiblyUndefined(true);
}
}
$properties[0] = $properties[0]->setPossiblyUndefined(
$replacement_type->possibly_undefined,
);
$properties[$key_value->value] = $properties[$key_value->value]->
setPossiblyUndefined(true)
;
Expand Down

0 comments on commit 8b4d5f8

Please sign in to comment.