1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Add hasType check

This commit is contained in:
Matthew Brown 2016-10-03 01:01:24 -04:00
parent c178e5c882
commit 1d10d8e8a2

View File

@ -3920,20 +3920,22 @@ class StatementsChecker
$array_type = $context_type;
for ($i = 0; $i < $nesting + 1; $i++) {
if ($i < $nesting) {
if ($array_type->types['array']->type_params[1]->isEmpty()) {
$new_empty = clone $empty_type;
if ($array_type->hasArray()) {
if ($i < $nesting) {
if ($array_type->types['array']->type_params[1]->isEmpty()) {
$new_empty = clone $empty_type;
$new_empty->types['array']->type_params[0] = $key_type;
$new_empty->types['array']->type_params[0] = $key_type;
$array_type->types['array']->type_params[1] = $new_empty;
continue;
$array_type->types['array']->type_params[1] = $new_empty;
continue;
}
$array_type = $array_type->types['array']->type_params[1];
}
else {
$array_type->types['array']->type_params[0] = $key_type;
}
$array_type = $array_type->types['array']->type_params[1];
}
elseif (isset($array_type->types['array'])) {
$array_type->types['array']->type_params[0] = $key_type;
}
}