private static function extractReturnTypeFromMethodReflection(MethodReflection $methodReflection)
{
$returnType = method_exists($methodReflection, 'getReturnType') ? $methodReflection->getReturnType() : null;
if (!$returnType) {
return null;
}
if (!method_exists($returnType, 'getName')) {
return self::expandLiteralType((string) $returnType, $methodReflection);
}
return ($returnType->allowsNull() ? '?' : '') . self::expandLiteralType($returnType->getName(), $methodReflection);
}