Skip to content

Commit 54a57b4

Browse files
author
Maximilian Reichel
committed
Normalized rules array
1 parent fdd21c4 commit 54a57b4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

DependencyInjection/Configuration.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,18 @@ private function addFormatListenerSection(ArrayNodeDefinition $rootNode)
201201
->fixXmlConfig('rule', 'rules')
202202
->addDefaultsIfNotSet()
203203
->canBeUnset()
204+
->beforeNormalization()
205+
->ifTrue(function ($v) {
206+
// check if we got an assoc array in rules
207+
return isset($v['rules'])
208+
&& is_array($v['rules'])
209+
&& array_keys($v['rules']) !== range(0, count($v['rules']) - 1);
210+
})
211+
->then(function($v) {
212+
$v['rules'] = array($v['rules']);
213+
return $v;
214+
})
215+
->end()
204216
->children()
205217
->arrayNode('rules')
206218
->cannotBeOverwritten()

0 commit comments

Comments
 (0)