1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-11 00:39:38 +01:00
This commit is contained in:
Daniil Gentili 2022-11-26 16:23:22 +01:00
parent e2da9c9dc4
commit 3f710a80af
2 changed files with 4 additions and 3 deletions

View File

@ -149,7 +149,6 @@ class ArrayTypeComparator
if ($container_type_part instanceof TKeyedArray) { if ($container_type_part instanceof TKeyedArray) {
if ($container_type_part->is_list) { if ($container_type_part->is_list) {
/** @var TList|TNonEmptyList */
$container_type_part = $container_type_part->isNonEmpty() $container_type_part = $container_type_part->isNonEmpty()
? Type::getNonEmptyListAtomic($container_type_part->getGenericValueType()) ? Type::getNonEmptyListAtomic($container_type_part->getGenericValueType())
: Type::getListAtomic($container_type_part->getGenericValueType()); : Type::getListAtomic($container_type_part->getGenericValueType());

View File

@ -2247,8 +2247,10 @@ class SimpleAssertionReconciler extends Reconciler
if ($type->isArrayAccessibleWithStringKey($codebase)) { if ($type->isArrayAccessibleWithStringKey($codebase)) {
if (get_class($type) === TArray::class) { if (get_class($type) === TArray::class) {
$array_types[] = new TNonEmptyArray($type->type_params); $array_types[] = new TNonEmptyArray($type->type_params);
} elseif (get_class($type) === TList::class) { } elseif ($type instanceof TKeyedArray && $type->is_list) {
$array_types[] = Type::getNonEmptyListAtomic($type->type_param); $properties = $type->properties;
$properties[0] = $properties[0]->setPossiblyUndefined(false);
$array_types[] = $type->setProperties($properties);
} else { } else {
$array_types[] = $type; $array_types[] = $type;
} }