private function adjustNamespace(ReflectionMethod $method, string $type): string
    {
        $namespace = $method->getDeclaringClass()->getNamespaceName();
        if ($namespace) {
            $namespace = $namespace . '\\';
        }
        $namespacedType = $namespace . $type;

        return class_exists($namespacedType) ? $namespacedType : $type;
    }