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

Clone all types on assignment

This commit is contained in:
Matthew Brown 2017-12-17 23:22:26 -05:00
parent 5d9ce5433a
commit 2ec09b26d2
2 changed files with 6 additions and 2 deletions

View File

@ -1132,6 +1132,8 @@ class CallChecker
$class_type->from_docblock = false;
$context->removeVarFromConflictingClauses($var_id, null, $statements_checker);
$context->vars_in_scope[$var_id] = $class_type;
}
}
@ -2649,6 +2651,8 @@ class CallChecker
}
$context->removeVarFromConflictingClauses($var_id, null, $statements_checker);
$context->vars_in_scope[$var_id] = $input_type;
}
}

View File

@ -552,7 +552,7 @@ class ExpressionChecker
$context->vars_possibly_in_scope[$var_name] = true;
$stmt->inferredType = Type::getMixed();
} else {
$stmt->inferredType = $context->vars_in_scope[$var_name];
$stmt->inferredType = clone $context->vars_in_scope[$var_name];
}
} else {
$stmt->inferredType = Type::getMixed();
@ -669,7 +669,7 @@ class ExpressionChecker
}
}
} else {
$stmt->inferredType = $context->vars_in_scope[$var_name];
$stmt->inferredType = clone $context->vars_in_scope[$var_name];
}
return null;