1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Move memoisation after callmap branch

This commit is contained in:
Matthew Brown 2018-04-28 13:46:01 -04:00
parent 496256c2a5
commit 99da371ac4

View File

@ -582,18 +582,6 @@ class MethodCallChecker extends \Psalm\Checker\Statements\Expression\CallChecker
$context->getPhantomClasses()
);
}
if (!$stmt->args && $var_id) {
if ($config->memoize_method_calls) {
$method_var_id = $var_id . '->' . $method_name_lc . '()';
if (isset($context->vars_in_scope[$method_var_id])) {
$return_type_candidate = clone $context->vars_in_scope[$method_var_id];
} else {
$context->vars_in_scope[$method_var_id] = $return_type_candidate;
}
}
}
} else {
$returns_by_ref =
$returns_by_ref
@ -614,6 +602,18 @@ class MethodCallChecker extends \Psalm\Checker\Statements\Expression\CallChecker
}
}
if (!$stmt->args && $var_id) {
if ($config->memoize_method_calls) {
$method_var_id = $var_id . '->' . $method_name_lc . '()';
if (isset($context->vars_in_scope[$method_var_id])) {
$return_type_candidate = clone $context->vars_in_scope[$method_var_id];
} elseif ($return_type_candidate) {
$context->vars_in_scope[$method_var_id] = $return_type_candidate;
}
}
}
if ($config->after_method_checks) {
$file_manipulations = [];