Skip to content

Commit 0c441a1

Browse files
committed
Simplify int range key super type checks a bit more
1 parent 298261c commit 0c441a1

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Analyser/TypeSpecifier.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,8 +1103,7 @@ private function specifyTypesForCountFuncCall(
11031103
$sizeType instanceof IntegerRangeType
11041104
&& $sizeType->getMin() !== null
11051105
&& ($sizeType->getMax() ?? $sizeType->getMin()) <= ConstantArrayTypeBuilder::ARRAY_COUNT_LIMIT
1106-
&& $arrayType->getKeyType()->isSuperTypeOf(IntegerRangeType::fromInterval(0, $sizeType->getMin() - 1))->yes()
1107-
&& ($sizeType->getMax() === null || $arrayType->getKeyType()->isSuperTypeOf(IntegerRangeType::fromInterval(0, $sizeType->getMax() - 1))->yes())
1106+
&& $arrayType->getKeyType()->isSuperTypeOf(IntegerRangeType::fromInterval(0, ($sizeType->getMax() ?? $sizeType->getMin()) - 1))->yes()
11081107
) {
11091108
// turn optional offsets non-optional
11101109
$valueTypesBuilder = ConstantArrayTypeBuilder::createEmpty();

0 commit comments

Comments
 (0)