Skip to content

Commit

Permalink
Factory: uses ReflectionNamedType
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Mar 15, 2019
1 parent 0b79d86 commit acff8b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/PhpGenerator/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function fromMethodReflection(\ReflectionMethod $from): Method
$method->setVariadic($from->isVariadic());
$method->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
if ($from->hasReturnType()) {
$method->setReturnType((string) $from->getReturnType());
$method->setReturnType($from->getReturnType()->getName());
$method->setReturnNullable($from->getReturnType()->allowsNull());
}
return $method;
Expand All @@ -96,7 +96,7 @@ public function fromFunctionReflection(\ReflectionFunction $from)
$function->setComment(Helpers::unformatDocComment((string) $from->getDocComment()));
}
if ($from->hasReturnType()) {
$function->setReturnType((string) $from->getReturnType());
$function->setReturnType($from->getReturnType()->getName());
$function->setReturnNullable($from->getReturnType()->allowsNull());
}
return $function;
Expand All @@ -107,7 +107,7 @@ public function fromParameterReflection(\ReflectionParameter $from): Parameter
{
$param = new Parameter($from->getName());
$param->setReference($from->isPassedByReference());
$param->setTypeHint($from->hasType() ? (string) $from->getType() : null);
$param->setTypeHint($from->hasType() ? $from->getType()->getName() : null);
$param->setNullable($from->hasType() && $from->getType()->allowsNull());
if ($from->isDefaultValueAvailable()) {
$param->setDefaultValue($from->isDefaultValueConstant()
Expand Down

0 comments on commit acff8b1

Please sign in to comment.