1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-04 02:27:59 +01:00

Merge pull request #6617 from orklah/nonspecific-literal-int

allow any integer range to be satisfied by TNonspecificLiteralInt
This commit is contained in:
orklah 2021-10-09 01:12:46 +02:00 committed by GitHub
commit 49abfcb71b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;