25 if ($reflection->returnsReference()) {
30 $typeReflection = $reflection->getReturnType();
32 if ($typeReflection instanceof \ReflectionNamedType) {
33 $typeName = $typeReflection->getName();
35 if ($typeReflection->allowsNull()) {
38 } elseif ($typeReflection !==
null) {
39 throw new \LogicException(
"Unsupported reflection type " . get_class($typeReflection));
42 return new self($typeName, $flags);