diff --git a/src/Analyser/MutatingScope.php b/src/Analyser/MutatingScope.php index db31ce7669..b5e7ee2c71 100644 --- a/src/Analyser/MutatingScope.php +++ b/src/Analyser/MutatingScope.php @@ -6391,6 +6391,13 @@ private function getStaticCallType(Expr\StaticCall $node): ?Type ); if ($callType === null) { $callType = new ErrorType(); + if ( + !$node->class instanceof Name + && count($staticMethodCalledOnType->getObjectClassNames()) === 0 + && $staticMethodCalledOnType->hasMethod($node->name->toString()) !== TrinaryLogic::createNo() + ) { + $callType = new MixedType(); + } } if ($node->class instanceof Expr) { diff --git a/tests/PHPStan/Analyser/nsrt/bug-9844.php b/tests/PHPStan/Analyser/nsrt/bug-9844.php new file mode 100644 index 0000000000..a6ec9c098d --- /dev/null +++ b/tests/PHPStan/Analyser/nsrt/bug-9844.php @@ -0,0 +1,17 @@ +