1
0
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:
orklah 2022-02-01 22:56:59 +01:00 committed by GitHub
commit ff2636eed8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -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()]);

View File

@ -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;