diff --git a/src/Framework/MockObject/MockMethod.php b/src/Framework/MockObject/MockMethod.php index 39e7ac22d52..1d94d46b5e6 100644 --- a/src/Framework/MockObject/MockMethod.php +++ b/src/Framework/MockObject/MockMethod.php @@ -102,7 +102,7 @@ public static function fromReflection(ReflectionMethod $method, bool $callOrigin } if ($method->hasReturnType()) { - $returnType = (string) $method->getReturnType(); + $returnType = $method->getReturnType()->getName(); } else { $returnType = ''; } @@ -301,8 +301,8 @@ private static function getMethodParameters(ReflectionMethod $method, bool $forC $nullable = '?'; } - if ($parameter->hasType() && (string) $parameter->getType() !== 'self') { - $typeDeclaration = $parameter->getType() . ' '; + if ($parameter->hasType() && $parameter->getType()->getName() !== 'self') { + $typeDeclaration = $parameter->getType()->getName() . ' '; } else { try { $class = $parameter->getClass();