private function getDependenciesRecursive($path, $dependencies = [])
    {
        $raw = $this->resolver->raw($path);
        if ($raw !== null) {
            $path = $raw;
        }

        preg_match_all('#%([^/\\\\]+)%#', $path, $matches);
        foreach ($matches[1] as $alias) {
            if (!in_array($alias, $dependencies, true)) {
                $dependencies[] = $alias;
            }

            if (isset($this->resolving[$alias])) {
                throw new PathResolutionException('Failed to resolve path dependencies. Infinite recursion detected.');
            }

            $this->resolving[$alias] = true;
            try {
                $dependencies = $this->getDependenciesRecursive($alias, $dependencies);
            } finally {
                unset($this->resolving[$alias]);
            }
        }

        return $dependencies;
    }