Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c4a9dff

Browse files
committed
[FrameworkBundle] Fix cache pool configuration with one adapter and one provider
1 parent 53a45b2 commit c4a9dff

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,13 +1012,17 @@ private function addCacheSection(ArrayNodeDefinition $rootNode)
10121012
->prototype('array')
10131013
->fixXmlConfig('adapter')
10141014
->beforeNormalization()
1015-
->ifTrue(function ($v) { return (isset($v['adapters']) || \is_array($v['adapter'] ?? null)) && isset($v['provider']); })
1016-
->thenInvalid('Pool cannot have a "provider" while "adapter" is set to a map')
1015+
->ifTrue(function ($v) { return isset($v['provider']) && ((\is_array($v['adapters'] ?? null) && 1 < \count($v['adapters'])) || (\is_array($v['adapter'] ?? null) && 1 < \count($v['adapter']))); })
1016+
->thenInvalid('Pool cannot have a "provider" while more than one adapter is defined.')
10171017
->end()
10181018
->children()
10191019
->arrayNode('adapters')
10201020
->performNoDeepMerging()
10211021
->info('One or more adapters to chain for creating the pool, defaults to "cache.app".')
1022+
->beforeNormalization()
1023+
->ifTrue(function ($v) { return !\is_array($v); })
1024+
->thenInvalid('Pool "adapters" must be a map')
1025+
->end()
10221026
->beforeNormalization()
10231027
->always()->then(function ($values) {
10241028
if ([0] === array_keys($values) && \is_array($values[0])) {

0 commit comments

Comments
 (0)