private function getLoaderPaths(Environment $twig): array
    {
        /** @var \Twig\Loader\FilesystemLoader $loader */
        $loader = $twig->getLoader();

        if (! $loader instanceof FilesystemLoader) {
            return [];
        }

        $loaderPaths = [];

        foreach ($loader->getNamespaces() as $namespace) {
            $paths = $loader->getPaths($namespace);

            if (FilesystemLoader::MAIN_NAMESPACE === $namespace) {
                $namespace = '(None)';
            } else {
                $namespace = '@' . $namespace;
            }

            $loaderPaths[$namespace] = $paths;
        }

        return $loaderPaths;
    }