mirror of
https://github.com/danog/psalm.git
synced 2024-12-11 16:59:45 +01:00
If we do not know, do not assume
This commit is contained in:
parent
cb09a190ce
commit
c1ca6c27d5
@ -1911,10 +1911,7 @@ class StatementsChecker
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($stmt->keyVar) {
|
if ($stmt->keyVar) {
|
||||||
$foreach_context->vars_in_scope[$stmt->keyVar->name] = $key_type ?: new Type\Union([
|
$foreach_context->vars_in_scope[$stmt->keyVar->name] = $key_type ?: Type::getMixed();
|
||||||
new Type\Atomic('int'),
|
|
||||||
new Type\Atomic('string')
|
|
||||||
]);
|
|
||||||
$foreach_context->vars_possibly_in_scope[$stmt->keyVar->name] = true;
|
$foreach_context->vars_possibly_in_scope[$stmt->keyVar->name] = true;
|
||||||
$this->registerVariable($stmt->keyVar->name, $stmt->getLine());
|
$this->registerVariable($stmt->keyVar->name, $stmt->getLine());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user