Skip to content

Commit

Permalink
Resolve tests with suppression "UndefinedMethod"
Browse files Browse the repository at this point in the history
Apply suggestions from code review.

Resolved problems:
```
1) MagicMethodAnnotationTest::testValidCode with data set "magicStaticMethodInheritanceWithoutCallStatic"
Psalm\Exception\CodeException: UnusedPsalmSuppress - src/somefile.php:9:58 - This suppression is never used

2) MagicMethodAnnotationTest::testValidCode with data set "magicStaticMethodInheritanceWithoutCallStatic_WithReturnAndManyArgs"
Psalm\Exception\CodeException: TooManyArguments - src/somefile.php:9:6 - Too many arguments for B::bar - expecting 0 but saw 2
```
  • Loading branch information
issidorov committed Feb 14, 2024
1 parent 9fd0e38 commit 206daa8
Showing 1 changed file with 2 additions and 4 deletions.
Expand Up @@ -710,7 +710,7 @@ private static function handleNamedCall(
return false;
}
}
} elseif ($found_method_and_class_storage) {
} elseif ($found_method_and_class_storage && ($naive_method_exists || $with_pseudo)) {
[$pseudo_method_storage, $defining_class_storage] = $found_method_and_class_storage;

if (self::checkPseudoMethod(
Expand All @@ -727,9 +727,7 @@ private static function handleNamedCall(
return false;
}

if ($pseudo_method_storage->return_type
&& ($naive_method_exists || $with_pseudo)
) {
if ($pseudo_method_storage->return_type) {
return true;
}
} elseif ($stmt->class instanceof PhpParser\Node\Name && $stmt->class->getFirst() === 'parent'
Expand Down

0 comments on commit 206daa8

Please sign in to comment.