protected function resolveServiceArgument(string $name, ReflectionClass $type, ReflectionParameter $param)
    {
        $type_class = $type->getName();

        if ($type_class === $name) {
            throw new RuntimeException('class '.$type_class.' can not depend on itself');
        }

        try {
            return $this->traverseTree($name, $type_class);
        } catch (\Exception $e) {
            if ($param->isDefaultValueAvailable() && null === $param->getDefaultValue()) {
                return null;
            }

            throw $e;
        }
    }