Skip to content

Commit b1f45d0

Browse files
committed
Better fix
1 parent c73d0db commit b1f45d0

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Diff for: phpstan-baseline.neon

-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
parameters:
22
ignoreErrors:
3-
-
4-
message: "#^Casting to int something that's already int\\.$#"
5-
count: 2
6-
path: src/Analyser/MutatingScope.php
7-
83
-
94
message: "#^Only numeric types are allowed in pre\\-decrement, bool\\|float\\|int\\|string\\|null given\\.$#"
105
count: 1

Diff for: src/Analyser/MutatingScope.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -4922,6 +4922,13 @@ private static function generalizeType(Type $a, Type $b): Type
49224922
$gotSmaller = true;
49234923
}
49244924

4925+
if ($min === PHP_INT_MIN) {
4926+
$min = null;
4927+
}
4928+
if ($max === PHP_INT_MAX) {
4929+
$max = null;
4930+
}
4931+
49254932
if ($gotGreater && $gotSmaller) {
49264933
$resultTypes[] = new IntegerType();
49274934
} elseif ($gotGreater) {
@@ -5498,7 +5505,7 @@ private function integerRangeMath(Type $range, Expr $node, Type $operand): Type
54985505
}
54995506
}
55005507

5501-
return IntegerRangeType::fromInterval($min !== null ? (int) $min : null, $max !== null ? (int) $max : null);
5508+
return IntegerRangeType::fromInterval($min, $max);
55025509
}
55035510

55045511
}

0 commit comments

Comments
 (0)