@@ -1760,31 +1760,25 @@ private function integerRangeMath(Type $range, BinaryOp $node, Type $operand): T
1760
1760
[$ min , $ max ] = [$ max , $ min ];
1761
1761
}
1762
1762
1763
- if ($ operand instanceof IntegerRangeType
1764
- || ($ rangeMin === null || $ rangeMax === null )
1765
- || is_float ($ min )
1766
- || is_float ($ max )
1767
- ) {
1768
- if (is_float ($ min )) {
1769
- $ min = (int ) ceil ($ min );
1770
- }
1771
- if (is_float ($ max )) {
1772
- $ max = (int ) floor ($ max );
1773
- }
1774
-
1775
- // invert maximas on division with negative constants
1776
- if ((($ range instanceof ConstantIntegerType && $ range ->getValue () < 0 )
1777
- || ($ operand instanceof ConstantIntegerType && $ operand ->getValue () < 0 ))
1778
- && ($ min === null || $ max === null )) {
1779
- [$ min , $ max ] = [$ max , $ min ];
1780
- }
1763
+ if (is_float ($ min )) {
1764
+ $ min = (int ) ceil ($ min );
1765
+ }
1766
+ if (is_float ($ max )) {
1767
+ $ max = (int ) floor ($ max );
1768
+ }
1781
1769
1782
- if ($ min === null && $ max === null ) {
1783
- return new BenevolentUnionType ([new IntegerType (), new FloatType ()]);
1784
- }
1770
+ // invert maximas on division with negative constants
1771
+ if ((($ range instanceof ConstantIntegerType && $ range ->getValue () < 0 )
1772
+ || ($ operand instanceof ConstantIntegerType && $ operand ->getValue () < 0 ))
1773
+ && ($ min === null || $ max === null )) {
1774
+ [$ min , $ max ] = [$ max , $ min ];
1775
+ }
1785
1776
1786
- return TypeCombinator::union (IntegerRangeType::fromInterval ($ min , $ max ), new FloatType ());
1777
+ if ($ min === null && $ max === null ) {
1778
+ return new BenevolentUnionType ([new IntegerType (), new FloatType ()]);
1787
1779
}
1780
+
1781
+ return TypeCombinator::union (IntegerRangeType::fromInterval ($ min , $ max ), new FloatType ());
1788
1782
} elseif ($ node instanceof Expr \BinaryOp \ShiftLeft) {
1789
1783
if (!$ operand instanceof ConstantIntegerType) {
1790
1784
return new IntegerType ();
0 commit comments