bug #14859 Improve the config validation in TwigBundle (stof)
This PR was merged into the 2.3 branch.
Discussion
----------
Improve the config validation in TwigBundle
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #14858
| License | MIT
| Doc PR | n/a
This ensures we have better error messages in case of misconfiguration instead of having crappy errors from Twig (which does not validates its options fully either, missing these things)
Commits
-------
f4dfee3
Improve the config validation in TwigBundle
This commit is contained in:
commit
5c7cb563db
@ -129,13 +129,13 @@ class Configuration implements ConfigurationInterface
|
|||||||
->end()
|
->end()
|
||||||
->scalarNode('autoescape_service')->defaultNull()->end()
|
->scalarNode('autoescape_service')->defaultNull()->end()
|
||||||
->scalarNode('autoescape_service_method')->defaultNull()->end()
|
->scalarNode('autoescape_service_method')->defaultNull()->end()
|
||||||
->scalarNode('base_template_class')->example('Twig_Template')->end()
|
->scalarNode('base_template_class')->example('Twig_Template')->cannotBeEmpty()->end()
|
||||||
->scalarNode('cache')->defaultValue('%kernel.cache_dir%/twig')->end()
|
->scalarNode('cache')->defaultValue('%kernel.cache_dir%/twig')->end()
|
||||||
->scalarNode('charset')->defaultValue('%kernel.charset%')->end()
|
->scalarNode('charset')->defaultValue('%kernel.charset%')->end()
|
||||||
->scalarNode('debug')->defaultValue('%kernel.debug%')->end()
|
->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
|
||||||
->scalarNode('strict_variables')->end()
|
->booleanNode('strict_variables')->end()
|
||||||
->scalarNode('auto_reload')->end()
|
->scalarNode('auto_reload')->end()
|
||||||
->scalarNode('optimizations')->end()
|
->integerNode('optimizations')->min(-1)->end()
|
||||||
->arrayNode('paths')
|
->arrayNode('paths')
|
||||||
->normalizeKeys(false)
|
->normalizeKeys(false)
|
||||||
->useAttributeAsKey('paths')
|
->useAttributeAsKey('paths')
|
||||||
|
Reference in New Issue
Block a user