diff --git a/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php b/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php index 4a6ed7f17..29d7c1413 100644 --- a/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/ArrayTypeComparator.php @@ -149,7 +149,6 @@ class ArrayTypeComparator if ($container_type_part instanceof TKeyedArray) { if ($container_type_part->is_list) { - /** @var TList|TNonEmptyList */ $container_type_part = $container_type_part->isNonEmpty() ? Type::getNonEmptyListAtomic($container_type_part->getGenericValueType()) : Type::getListAtomic($container_type_part->getGenericValueType()); diff --git a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php index 443c52020..a9a0352a7 100644 --- a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php +++ b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php @@ -2247,8 +2247,10 @@ class SimpleAssertionReconciler extends Reconciler if ($type->isArrayAccessibleWithStringKey($codebase)) { if (get_class($type) === TArray::class) { $array_types[] = new TNonEmptyArray($type->type_params); - } elseif (get_class($type) === TList::class) { - $array_types[] = Type::getNonEmptyListAtomic($type->type_param); + } elseif ($type instanceof TKeyedArray && $type->is_list) { + $properties = $type->properties; + $properties[0] = $properties[0]->setPossiblyUndefined(false); + $array_types[] = $type->setProperties($properties); } else { $array_types[] = $type; }