Skip to content

Commit 5a99b8d

Browse files
author
Jens
committed
Call the "getName" method on the reflection type instead of the deprecated "__toString" method.
1 parent 8711488 commit 5a99b8d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/FieldsBuilder.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,9 @@ private function mapReturnType(ReflectionMethod $refMethod, DocBlock $docBlockOb
308308
$returnType = $refMethod->getReturnType();
309309
if ($returnType !== null) {
310310
$typeResolver = new \phpDocumentor\Reflection\TypeResolver();
311-
$phpdocType = $typeResolver->resolve((string) $returnType);
311+
$phpdocType = $typeResolver->resolve(
312+
$returnType->getName()
313+
);
312314
$phpdocType = $this->resolveSelf($phpdocType, $refMethod->getDeclaringClass());
313315
} else {
314316
$phpdocType = new Mixed_();
@@ -490,10 +492,11 @@ private function mapParameters(array $refParameters, DocBlock $docBlock): array
490492
$parameterType = $parameter->getType();
491493
$allowsNull = $parameterType === null ? true : $parameterType->allowsNull();
492494

493-
$type = (string) $parameterType;
494-
if ($type === '') {
495+
if ($parameterType === null) {
495496
throw MissingTypeHintException::missingTypeHint($parameter);
496497
}
498+
499+
$type = $parameterType->getName();
497500
$phpdocType = $typeResolver->resolve($type);
498501
$phpdocType = $this->resolveSelf($phpdocType, $parameter->getDeclaringClass());
499502

0 commit comments

Comments
 (0)