mirror of
https://github.com/danog/psalm.git
synced 2024-12-13 01:37:23 +01:00
allow Literals to be combined with preexisting IntRange
This commit is contained in:
parent
086d3777eb
commit
81e8bf3ff5
@ -1200,6 +1200,24 @@ class TypeCombiner
|
||||
}
|
||||
);
|
||||
|
||||
if (isset($combination->value_types['int'])) {
|
||||
$current_int_type = $combination->value_types['int'];
|
||||
if ($current_int_type instanceof TIntRange) {
|
||||
foreach ($combination->ints as $int) {
|
||||
if (!$current_int_type->contains($int->value)) {
|
||||
$current_int_type->min_bound = TIntRange::getNewLowestBound(
|
||||
$current_int_type->min_bound,
|
||||
$int->value
|
||||
);
|
||||
$current_int_type->max_bound = TIntRange::getNewHighestBound(
|
||||
$current_int_type->max_bound,
|
||||
$int->value
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$combination->ints = null;
|
||||
|
||||
if (!isset($combination->value_types['int'])) {
|
||||
|
Loading…
Reference in New Issue
Block a user