From 874a67a1b02f235b5593c91a5c75b634295e786d Mon Sep 17 00:00:00 2001 From: orklah Date: Sat, 9 Oct 2021 01:04:31 +0200 Subject: [PATCH] allow any integer range to be satisfied by TNonspecificLiteralInt --- .../Internal/Type/Comparator/IntegerRangeComparator.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Psalm/Internal/Type/Comparator/IntegerRangeComparator.php b/src/Psalm/Internal/Type/Comparator/IntegerRangeComparator.php index 33607b97c..0290e1610 100644 --- a/src/Psalm/Internal/Type/Comparator/IntegerRangeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/IntegerRangeComparator.php @@ -5,6 +5,7 @@ namespace Psalm\Internal\Type\Comparator; use Psalm\Type\Atomic; use Psalm\Type\Atomic\TInt; use Psalm\Type\Atomic\TIntRange; +use Psalm\Type\Atomic\TNonspecificLiteralInt; use Psalm\Type\Atomic\TPositiveInt; use Psalm\Type\Union; @@ -55,6 +56,10 @@ class IntegerRangeComparator return true; } + if (get_class($container_atomic_types['int']) === TNonspecificLiteralInt::class) { + return true; + } + if (get_class($container_atomic_types['int']) === TPositiveInt::class) { if ($input_type_part->isPositive()) { return true;