diff --git a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php index df15c6997..5d1067b80 100644 --- a/src/Psalm/Internal/Type/SimpleAssertionReconciler.php +++ b/src/Psalm/Internal/Type/SimpleAssertionReconciler.php @@ -733,11 +733,11 @@ class SimpleAssertionReconciler extends Reconciler // Impossible $existing_var_type->removeType('array'); $redundant = false; - } elseif ($assertion->count === $prop_min_count) { - // Redundant - $redundant = true; } elseif ($array_atomic_type->fallback_params === null) { - if ($assertion->count > $prop_max_count) { + if ($assertion->count === $prop_min_count) { + // Redundant + $redundant = true; + } elseif ($assertion->count > $prop_max_count) { // Impossible $existing_var_type->removeType('array'); $redundant = false; diff --git a/src/Psalm/Type.php b/src/Psalm/Type.php index a3ea4e7d2..20d1dc869 100644 --- a/src/Psalm/Type.php +++ b/src/Psalm/Type.php @@ -463,7 +463,7 @@ abstract class Type return new TKeyedArray( [$of->setPossiblyUndefined(true)], null, - [self::getInt(), $of], + [new Union([new TIntRange(0, null)]), $of], true, $from_docblock ); @@ -477,7 +477,7 @@ abstract class Type return new TKeyedArray( [$of->setPossiblyUndefined(false)], null, - [self::getInt(), $of], + [new Union([new TIntRange(0, null)]), $of], true, $from_docblock );