Skip to content

Commit acff8b1

Browse files
committed
Factory: uses ReflectionNamedType
1 parent 0b79d86 commit acff8b1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/PhpGenerator/Factory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function fromMethodReflection(\ReflectionMethod $from): Method
7676
$method->setVariadic($from->isVariadic());
7777
$method->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
7878
if ($from->hasReturnType()) {
79-
$method->setReturnType((string) $from->getReturnType());
79+
$method->setReturnType($from->getReturnType()->getName());
8080
$method->setReturnNullable($from->getReturnType()->allowsNull());
8181
}
8282
return $method;
@@ -96,7 +96,7 @@ public function fromFunctionReflection(\ReflectionFunction $from)
9696
$function->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
9797
}
9898
if ($from->hasReturnType()) {
99-
$function->setReturnType((string) $from->getReturnType());
99+
$function->setReturnType($from->getReturnType()->getName());
100100
$function->setReturnNullable($from->getReturnType()->allowsNull());
101101
}
102102
return $function;
@@ -107,7 +107,7 @@ public function fromParameterReflection(\ReflectionParameter $from): Parameter
107107
{
108108
$param = new Parameter($from->getName());
109109
$param->setReference($from->isPassedByReference());
110-
$param->setTypeHint($from->hasType() ? (string) $from->getType() : null);
110+
$param->setTypeHint($from->hasType() ? $from->getType()->getName() : null);
111111
$param->setNullable($from->hasType() && $from->getType()->allowsNull());
112112
if ($from->isDefaultValueAvailable()) {
113113
$param->setDefaultValue($from->isDefaultValueConstant()

0 commit comments

Comments
 (0)