1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-03 10:07:52 +01:00

Resolve tests with suppression "UndefinedMethod"

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
```
This commit is contained in:
Ivan Sidorov 2024-02-14 20:40:35 +00:00
parent 5a66742e70
commit 8a70bc2506

View File

@ -710,7 +710,7 @@ final class AtomicStaticCallAnalyzer
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(
@ -727,9 +727,7 @@ final class AtomicStaticCallAnalyzer
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'