Skip to content
Permalink
Browse files

Fix #1902 - template trait method when extended

  • Loading branch information...
muglug committed Jul 5, 2019
1 parent 20b7ff1 commit 457781bb0237b9fe39f42809dfaa0468c5b971b0
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php
@@ -1305,16 +1305,20 @@ public static function getClassTemplateParams(
) {
$calling_class_storage = $codebase->classlike_storage_provider->get($fq_class_name);
$non_trait_class_storage = $class_storage->is_trait
? $calling_class_storage
: $class_storage;
$template_types = $class_storage->template_types;
if ($calling_class_storage->template_type_extends
&& $method_name
&& !empty($class_storage->overridden_method_ids[$method_name])
&& !empty($non_trait_class_storage->overridden_method_ids[$method_name])
&& isset($class_storage->methods[$method_name])
&& (!isset($class_storage->methods[$method_name]->return_type)
&& (!isset($non_trait_class_storage->methods[$method_name]->return_type)
|| $class_storage->methods[$method_name]->inherited_return_type)
) {
foreach ($class_storage->overridden_method_ids[$method_name] as $overridden_method_id) {
foreach ($non_trait_class_storage->overridden_method_ids[$method_name] as $overridden_method_id) {
$overridden_storage = $codebase->methods->getStorage($overridden_method_id);
if (!$overridden_storage->return_type) {

0 comments on commit 457781b

Please sign in to comment.
You can’t perform that action at this time.