diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php index 48c50ed0c..c9dce4d14 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/StaticMethod/AtomicStaticCallAnalyzer.php @@ -789,7 +789,7 @@ final class AtomicStaticCallAnalyzer } } - if (!$callstatic_method_exists || $class_storage->hasSealedMethods($config)) { + if ($naive_method_exists || !$callstatic_method_exists || $class_storage->hasSealedMethods($config)) { $does_method_exist = MethodAnalyzer::checkMethodExists( $codebase, $method_id, diff --git a/tests/AssertAnnotationTest.php b/tests/AssertAnnotationTest.php index 972e2e3d7..5263a5267 100644 --- a/tests/AssertAnnotationTest.php +++ b/tests/AssertAnnotationTest.php @@ -90,6 +90,36 @@ class AssertAnnotationTest extends TestCase $this->analyzeFile('somefile.php', new Context()); } + public function testAssertsAllongCallStaticMethodWork(): void + { + $this->addFile( + 'somefile.php', + 'analyzeFile('somefile.php', new Context()); + } + public function testAssertInvalidDocblockMessageDoesNotIncludeTrace(): void { $this->expectException(CodeException::class);