1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-13 17:57:37 +01:00
This commit is contained in:
orklah 2021-09-16 19:59:12 +02:00
parent 25f78b5d54
commit 0f17a2590c

View File

@ -1326,10 +1326,10 @@ class ArithmeticOpAnalyzer
}
} elseif ($right_type_part->isPositive()) {
if ($left_type_part->isPositiveOrZero()) {
if ($left_type_part->max_bound !== null) {
//we now that the result will be a range between 0 and $left->max - 1
if ($right_type_part->max_bound !== null) {
//we now that the result will be a range between 0 and $right->max - 1
$new_result_type = new Type\Union(
[new TIntRange(0, $left_type_part->max_bound - 1)]
[new TIntRange(0, $right_type_part->max_bound - 1)]
);
} else {
$new_result_type = new Type\Union([new TIntRange(0, null)]);