10000 [Twig] Fix Twig config extra keys · symfony/symfony@643bd6b · GitHub
[go: up one dir, main page]

Skip to content

Commit 643bd6b

Browse files
committed
[Twig] Fix Twig config extra keys
1 parent 9072ba8 commit 643bd6b

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,20 @@ public function load(array $configs, ContainerBuilder $container)
145145
}
146146
}
147147

148-
unset(
149-
$config['form'],
150-
$config['globals'],
151-
$config['extensions']
152-
);
153-
154148
if (isset($config['autoescape_service']) && isset($config['autoescape_service_method'])) {
155149
$config['autoescape'] = [new Reference($config['autoescape_service']), $config['autoescape_service_method']];
156150
}
157-
unset($config['autoescape_service'], $config['autoescape_service_method']);
158151

159-
$container->getDefinition('twig')->replaceArgument(1, $config);
152+
$container->getDefinition('twig')->replaceArgument(1, array_intersect_key($config, [
153+
'debug' => true,
154+
'charset' => true,
155+
'base_template_class' => true,
156+
'strict_variables' => true,
157+
'autoescape' => true,
158+
'cache' => true,
159+
'auto_reload' => true,
160+
'optimizations' => true,
161+
]));
160162

161163
$container->registerForAutoconfiguration(\Twig_ExtensionInterface::class)->addTag('twig.extension');
162164
$container->registerForAutoconfiguration(\Twig_LoaderInterface::class)->addTag('twig.loader');

0 commit comments

Comments
 (0)
0