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:
Fabien Potencier 2015-06-04 15:38:55 +02:00
commit 5c7cb563db
1 changed files with 4 additions and 4 deletions

View File

@ -129,13 +129,13 @@ class Configuration implements ConfigurationInterface
->end()
->scalarNode('autoescape_service')->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('charset')->defaultValue('%kernel.charset%')->end()
->scalarNode('debug')->defaultValue('%kernel.debug%')->end()
->scalarNode('strict_variables')->end()
->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
->booleanNode('strict_variables')->end()
->scalarNode('auto_reload')->end()
->scalarNode('optimizations')->end()
->integerNode('optimizations')->min(-1)->end()
->arrayNode('paths')
->normalizeKeys(false)
->useAttributeAsKey('paths')