src/Viserio/Provider/Twig/Engine/TwigEngine.php
protected function addExtensions(Environment $twig, array $config): Environment
    {
        if (isset($config['extensions']) && \is_array($config['extensions'])) {
            foreach ($config['extensions'] as $extension) {
                if ($this->container !== null && \is_string($extension) && $this->container->has($extension)) {
                    $twig->addExtension($this->container->get($extension));
                } elseif (\is_object($extension) && $extension instanceof ExtensionInterface) {
                    $twig->addExtension($extension);
                } else {
                    throw new RuntimeException(\sprintf(
                        'Twig extension [%s] is not a object.',
                        $extension
                    ));
                }
            }
        }

        return $twig;
    }
protected function addExtensions(Environment $twig, array $config): Environment
    {
        if (isset($config['extensions']) && \is_array($config['extensions'])) {
            foreach ($config['extensions'] as $extension) {
                if ($this->container !== null && \is_string($extension) && $this->container->has($extension)) {
                    $twig->addExtension($this->container->get($extension));
                } elseif (\is_object($extension) && $extension instanceof ExtensionInterface) {
                    $twig->addExtension($extension);
                } else {
                    throw new RuntimeException(\sprintf(
                        'Twig extension [%s] is not a object.',
                        $extension
                    ));
                }
            }
        }

        return $twig;
    }
Add extensions to twig environment.

@param \Twig\Environment $twig
@param array             $config

@throws \Viserio\Component\Contract\View\Exception\RuntimeException

@return \Twig\Environment