From aaa9451740bd8a76b9760e60057ca7e77369c6f3 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 17 Oct 2022 11:04:41 +0200 Subject: [PATCH] Possible fix --- src/Psalm/Internal/Type/TypeCombiner.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Psalm/Internal/Type/TypeCombiner.php b/src/Psalm/Internal/Type/TypeCombiner.php index bc25398c72c..1e528170289 100644 --- a/src/Psalm/Internal/Type/TypeCombiner.php +++ b/src/Psalm/Internal/Type/TypeCombiner.php @@ -1167,8 +1167,7 @@ private static function scrapeIntProperties( } if ($type instanceof TLiteralInt) { - $combination->ints ??= []; - if (count($combination->ints) < $literal_limit) { + if ($combination->ints !== null && count($combination->ints) < $literal_limit) { $combination->ints[$type_key] = $type; } else { $combination->ints[$type_key] = $type; @@ -1214,6 +1213,7 @@ private static function scrapeIntProperties( ) { $combination->value_types['int'] = new TInt(); } + $combination->ints = null; } elseif ($type instanceof TIntRange) { $type = clone $type; if ($combination->ints) { @@ -1239,9 +1239,8 @@ private static function scrapeIntProperties( } } else { $combination->value_types['int'] = $type; + $combination->ints = null; } - - $combination->ints = null; } }