diff --git a/src/Psalm/Internal/Codebase/Methods.php b/src/Psalm/Internal/Codebase/Methods.php index 37631e603d9..cea74876f2c 100644 --- a/src/Psalm/Internal/Codebase/Methods.php +++ b/src/Psalm/Internal/Codebase/Methods.php @@ -920,6 +920,12 @@ public function getMethodReturnTypeLocation( $storage = $this->getStorage($method_id); + // if function exists in stubs and in analyzed code + // use the return type location of the analyzed code instead of the stubbed location + if ($storage->stubbed) { + return null; + } + if (!$storage->return_type_location) { $overridden_method_ids = $this->getOverriddenMethodIds($method_id);