Skip to content

Commit cb6972e

Browse files
committed
cleanup
1 parent 992768b commit cb6972e

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/Analyser/MutatingScope.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4100,26 +4100,22 @@ private function generalizeType(Type $a, Type $b, int $depth): Type
41004100

41014101
$newMin = $min;
41024102
$newMax = $max;
4103-
$gotGreater = false;
4104-
$gotSmaller = false;
41054103
foreach ($constantIntegers['b'] as $int) {
4106-
if ($int->getValue() > $max) {
4104+
if ($int->getValue() > $newMax) {
41074105
$newMax = $int->getValue();
4108-
$gotGreater = true;
41094106
}
4110-
if ($int->getValue() >= $min) {
4107+
if ($int->getValue() >= $newMin) {
41114108
continue;
41124109
}
41134110

41144111
$newMin = $int->getValue();
4115-
$gotSmaller = true;
41164112
}
41174113

4118-
if ($gotGreater && $gotSmaller) {
4114+
if ($newMax > $max && $newMin < $min) {
41194115
$resultTypes[] = IntegerRangeType::fromInterval($newMin, $newMax);
4120-
} elseif ($gotGreater) {
4116+
} elseif ($newMax > $max) {
41214117
$resultTypes[] = IntegerRangeType::fromInterval($min, null);
4122-
} elseif ($gotSmaller) {
4118+
} elseif ($newMin < $min) {
41234119
$resultTypes[] = IntegerRangeType::fromInterval(null, $max);
41244120
} else {
41254121
$resultTypes[] = TypeCombinator::union($constantIntegersA, $constantIntegersB);

0 commit comments

Comments
 (0)