From 5d24b351dc8eb470d449b27288fc38f37d6ee992 Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Thu, 12 Nov 2020 09:14:40 -0500 Subject: [PATCH] Use the same docblock as the source params, if possible --- src/Psalm/Internal/Codebase/Methods.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Psalm/Internal/Codebase/Methods.php b/src/Psalm/Internal/Codebase/Methods.php index 7458c0a0f..db1eddda9 100644 --- a/src/Psalm/Internal/Codebase/Methods.php +++ b/src/Psalm/Internal/Codebase/Methods.php @@ -740,6 +740,20 @@ class Methods $candidate_type = null; + if (isset($class_storage->documenting_method_ids[$appearing_method_name])) { + $overridden_method_id = $class_storage->documenting_method_ids[$appearing_method_name]; + + $overridden_storage = $this->getStorage($overridden_method_id); + + if ($overridden_storage->return_type) { + if ($overridden_storage->return_type->isNull()) { + return Type::getVoid(); + } + + return clone $overridden_storage->return_type; + } + } + foreach ($class_storage->overridden_method_ids[$appearing_method_name] as $overridden_method_id) { $overridden_storage = $this->getStorage($overridden_method_id);