mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Merge pull request #7558 from orklah/tweaksToArrays
sealed keyed arrays
This commit is contained in:
commit
ff2636eed8
@ -230,6 +230,7 @@ class CastAnalyzer
|
||||
if ($type instanceof Scalar) {
|
||||
$keyed_array = new TKeyedArray([new Union([$type])]);
|
||||
$keyed_array->is_list = true;
|
||||
$keyed_array->sealed = true;
|
||||
$permissible_atomic_types[] = $keyed_array;
|
||||
} elseif ($type instanceof TNull) {
|
||||
$permissible_atomic_types[] = new TArray([Type::getEmpty(), Type::getEmpty()]);
|
||||
|
@ -137,7 +137,9 @@ class ConstantTypeResolver
|
||||
}
|
||||
|
||||
if ($left instanceof TKeyedArray && $right instanceof TKeyedArray) {
|
||||
return new TKeyedArray($left->properties + $right->properties);
|
||||
$keyed_array = new TKeyedArray($left->properties + $right->properties);
|
||||
$keyed_array->sealed = true;
|
||||
return $keyed_array;
|
||||
}
|
||||
|
||||
return new TMixed;
|
||||
|
Loading…
Reference in New Issue
Block a user