minor #32322 [FrameworkBundle] Simplified some code in the DI configuration (javiereguiluz)

This PR was submitted for the 3.4 branch but it was merged into the 4.4 branch instead (closes #32322).

Discussion
----------

[FrameworkBundle] Simplified some code in the DI configuration

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | -
| License       | MIT
| Doc PR        | not needed

Commits
-------

e6d76bae9f [FrameworkBundle] Simplified some code in the DI configuration
This commit is contained in:
Fabien Potencier 2019-07-03 14:24:01 +02:00
commit e07ed228b7

View File

@ -585,10 +585,7 @@ class Configuration implements ConfigurationInterface
->ifTrue(function ($v) { return \is_array($v) && isset($v['mime_type']); })
->then(function ($v) { return $v['mime_type']; })
->end()
->beforeNormalization()
->ifTrue(function ($v) { return !\is_array($v); })
->then(function ($v) { return [$v]; })
->end()
->beforeNormalization()->castToArray()->end()
->prototype('scalar')->end()
->end()
->end()
@ -646,10 +643,7 @@ class Configuration implements ConfigurationInterface
->fixXmlConfig('loader')
->children()
->arrayNode('loaders')
->beforeNormalization()
->ifTrue(function ($v) { return !\is_array($v); })
->then(function ($v) { return [$v]; })
->end()
->beforeNormalization()->castToArray()->end()
->prototype('scalar')->end()
->end()
->end()
@ -674,10 +668,7 @@ class Configuration implements ConfigurationInterface
->scalarNode('base_path')->defaultValue('')->end()
->arrayNode('base_urls')
->requiresAtLeastOneElement()
->beforeNormalization()
->ifTrue(function ($v) { return !\is_array($v); })
->then(function ($v) { return [$v]; })
->end()
->beforeNormalization()->castToArray()->end()
->prototype('scalar')->end()
->end()
->end()
@ -719,10 +710,7 @@ class Configuration implements ConfigurationInterface
->scalarNode('base_path')->defaultValue('')->end()
->arrayNode('base_urls')
->requiresAtLeastOneElement()
->beforeNormalization()
->ifTrue(function ($v) { return !\is_array($v); })
->then(function ($v) { return [$v]; })
->end()
->beforeNormalization()->castToArray()->end()
->prototype('scalar')->end()
->end()
->end()
@ -817,10 +805,7 @@ class Configuration implements ConfigurationInterface
->defaultValue(['loadValidatorMetadata'])
->prototype('scalar')->end()
->treatFalseLike([])
->validate()
->ifTrue(function ($v) { return !\is_array($v); })
->then(function ($v) { return (array) $v; })
->end()
->validate()->castToArray()->end()
->end()
->scalarNode('translation_domain')->defaultValue('validators')->end()
->booleanNode('strict_email')->end()