getReturnType(); if (!$returnType) { return null; } if ($returnType instanceof ReflectionUnionType) { return null; } return $returnType->getName(); } public static function getFunctionParameter(string $fn, int $index): ?ReflectionParameter { $func = self::getFunction($fn); if (!$func) { return null; } $args = $func->getParameters(); if ($index >= count($args)) { return null; } return $args[$index]; } }