From 120ba1f64cbafdfa97b43995d8830ad9a956ff56 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 26 Nov 2022 15:53:16 +0100 Subject: [PATCH] Refactoring --- .../Type/SimpleNegatedAssertionReconciler.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php b/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php index 2d0b5a205..520c1bd7f 100644 --- a/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php +++ b/src/Psalm/Internal/Type/SimpleNegatedAssertionReconciler.php @@ -522,18 +522,11 @@ class SimpleNegatedAssertionReconciler extends Reconciler $array_atomic_type = $existing_var_atomic_types['array']; $redundant = true; - if (($array_atomic_type instanceof TNonEmptyArray - || $array_atomic_type instanceof TNonEmptyList) - && ($count === null - || $array_atomic_type->count >= $count - || $array_atomic_type->min_count >= $count) - ) { - $redundant = false; - - $existing_var_type->removeType('array'); - } elseif ($array_atomic_type instanceof TKeyedArray) { - if ($array_atomic_type->fallback_params === null && $count !== null) { - $prop_max_count = count($array_atomic_type->properties); + if ($array_atomic_type instanceof TKeyedArray) { + if ($count !== null) { + $prop_max_count = $array_atomic_type->fallback_params === null + ? count($array_atomic_type->properties) + : INF; $prop_min_count = 0; foreach ($array_atomic_type->properties as $property_type) { if (!$property_type->possibly_undefined) {