src/Viserio/Bridge/Twig/Provider/TwigBridgeDataCollectorsServiceProvider.php
public static function extendTwigEnvironment(
        ContainerInterface $container,
        ?TwigEnvironment $twig = null
    ): ?TwigEnvironment {
        if ($twig !== null) {
            $options = self::resolveOptions($container->get('config'));

            if ($options['collector']['twig'] === true) {
                $twig->addExtension(new ProfilerExtension(
                    $container->get(Profile::class)
                ));
            }
        }

        return $twig;
    }
public static function extendTwigEnvironment(
        ContainerInterface $container,
        ?TwigEnvironment $twig = null
    ): ?TwigEnvironment {
        if ($twig !== null) {
            $options = self::resolveOptions($container->get('config'));

            if ($options['collector']['twig'] === true) {
                $twig->addExtension(new ProfilerExtension(
                    $container->get(Profile::class)
                ));
            }
        }

        return $twig;
    }
Wrap Twig Environment.

@param \Psr\Container\ContainerInterface $container
@param null|\Twig\Environment            $twig

@return null|\Twig\Environment