diff --git a/rules/TypeDeclaration/TypeAnalyzer/ReturnStrictTypeAnalyzer.php b/rules/TypeDeclaration/TypeAnalyzer/ReturnStrictTypeAnalyzer.php index 37e912c64c..a46be2bb2b 100644 --- a/rules/TypeDeclaration/TypeAnalyzer/ReturnStrictTypeAnalyzer.php +++ b/rules/TypeDeclaration/TypeAnalyzer/ReturnStrictTypeAnalyzer.php @@ -22,6 +22,7 @@ use PHPStan\Analyser\Scope; use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\Native\NativeFunctionReflection; +use PHPStan\Reflection\Native\NativeMethodReflection; use PHPStan\Reflection\ParametersAcceptorWithPhpDocs; use PHPStan\Type\MixedType; use PHPStan\Type\StaticType; @@ -122,7 +123,7 @@ public function resolveMethodCallReturnType(MethodCall | StaticCall | FuncCall $ $scope ); - if ($methodReflection instanceof NativeFunctionReflection) { + if ($methodReflection instanceof NativeFunctionReflection || $methodReflection instanceof NativeMethodReflection) { $returnType = $parametersAcceptorWithPhpDocs->getReturnType(); } elseif ($parametersAcceptorWithPhpDocs instanceof ParametersAcceptorWithPhpDocs) { // native return type is needed, as docblock can be false