From 5a99b8d83b474f6eb88dc806dbcbe6f72f70861e Mon Sep 17 00:00:00 2001 From: Jens Date: Tue, 8 Oct 2019 22:17:25 +0200 Subject: [PATCH] Call the "getName" method on the reflection type instead of the deprecated "__toString" method. --- src/FieldsBuilder.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/FieldsBuilder.php b/src/FieldsBuilder.php index 3664bd62a5..50c81eb439 100644 --- a/src/FieldsBuilder.php +++ b/src/FieldsBuilder.php @@ -308,7 +308,9 @@ private function mapReturnType(ReflectionMethod $refMethod, DocBlock $docBlockOb $returnType = $refMethod->getReturnType(); if ($returnType !== null) { $typeResolver = new \phpDocumentor\Reflection\TypeResolver(); - $phpdocType = $typeResolver->resolve((string) $returnType); + $phpdocType = $typeResolver->resolve( + $returnType->getName() + ); $phpdocType = $this->resolveSelf($phpdocType, $refMethod->getDeclaringClass()); } else { $phpdocType = new Mixed_(); @@ -490,10 +492,11 @@ private function mapParameters(array $refParameters, DocBlock $docBlock): array $parameterType = $parameter->getType(); $allowsNull = $parameterType === null ? true : $parameterType->allowsNull(); - $type = (string) $parameterType; - if ($type === '') { + if ($parameterType === null) { throw MissingTypeHintException::missingTypeHint($parameter); } + + $type = $parameterType->getName(); $phpdocType = $typeResolver->resolve($type); $phpdocType = $this->resolveSelf($phpdocType, $parameter->getDeclaringClass());