core-bundle/src/DependencyInjection/Compiler/MakeServicesPublicPass.php
public function process(ContainerBuilder $container): void
    {
        static $services = [
            'assets.packages',
            'fragment.handler',
            'lexik_maintenance.driver.factory',
            'monolog.logger.contao',
            'security.authentication.trust_resolver',
            'security.firewall.map',
            'security.logout_url_generator',
        ];

        foreach ($services as $service) {
            if (!$container->hasDefinition($service)) {
                continue;
            }

            $definition = $container->getDefinition($service);
            $definition->setPublic(true);
        }

        static $aliases = [
            'database_connection',
            'swiftmailer.mailer',
        ];

        foreach ($aliases as $alias) {
            if (!$container->hasAlias($alias)) {
                continue;
            }

            $alias = $container->getAlias($alias);
            $alias->setPublic(true);
        }
    }
public function process(ContainerBuilder $container): void
    {
        static $services = [
            'assets.packages',
            'fragment.handler',
            'lexik_maintenance.driver.factory',
            'monolog.logger.contao',
            'security.authentication.trust_resolver',
            'security.firewall.map',
            'security.logout_url_generator',
        ];

        foreach ($services as $service) {
            if (!$container->hasDefinition($service)) {
                continue;
            }

            $definition = $container->getDefinition($service);
            $definition->setPublic(true);
        }

        static $aliases = [
            'database_connection',
            'swiftmailer.mailer',
        ];

        foreach ($aliases as $alias) {
            if (!$container->hasAlias($alias)) {
                continue;
            }

            $alias = $container->getAlias($alias);
            $alias->setPublic(true);
        }
    }
{@inheritdoc}