From 84c0554595bec0c65b06afa02a3bdb59fb2bc782 Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Fri, 31 May 2019 01:49:54 -0400 Subject: [PATCH] Get function analyser once per method --- src/Psalm/Internal/Codebase/ClassLikes.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 2a976a541e5..a3b283bfee9 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -931,6 +931,11 @@ private function checkMethodReferences(ClassLikeStorage $classlike_storage, Meth && isset($project_analyzer->getIssuesToFix()['MissingParamType']) ) { if ($method_storage->possible_param_types && $method_storage->location) { + $function_analyzer = $project_analyzer->getFunctionLikeAnalyzer( + $method_id, + $method_storage->location->file_path + ); + foreach ($method_storage->possible_param_types as $offset => $possible_type) { if (!isset($method_storage->params[$offset])) { continue; @@ -942,11 +947,6 @@ private function checkMethodReferences(ClassLikeStorage $classlike_storage, Meth continue; } - $function_analyzer = $project_analyzer->getFunctionLikeAnalyzer( - $method_id, - $method_storage->location->file_path - ); - $function_analyzer->addOrUpdateParamType( $project_analyzer, $param_name,