@@ -420,7 +420,7 @@ public function configureOptions(OptionsResolver $resolver)
420420 $ resolver ->setAllowedTypes ('choice_value ' , array ('null ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ));
421421 $ resolver ->setAllowedTypes ('choice_attr ' , array ('null ' , 'array ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ));
422422 $ resolver ->setAllowedTypes ('preferred_choices ' , array ('array ' , '\Traversable ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ));
423- $ resolver ->setAllowedTypes ('group_by ' , array ('null ' , 'array ' , ' \Traversable ' , ' callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ));
423+ $ resolver ->setAllowedTypes ('group_by ' , array ('null ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ));
424424 }
425425
426426 /**
@@ -431,21 +431,6 @@ public function getName()
431431 return 'choice ' ;
432432 }
433433
434- private static function flipRecursive ($ choices , &$ output = array ())
435- {
436- foreach ($ choices as $ key => $ value ) {
437- if (is_array ($ value )) {
438- $ output [$ key ] = array ();
439- self ::flipRecursive ($ value , $ output [$ key ]);
440- continue ;
441- }
442-
443- $ output [$ value ] = $ key ;
444- }
445-
446- return $ output ;
447- }
448-
449434 /**
450435 * Adds the sub fields for an expanded choice field.
451436 *
@@ -503,14 +488,6 @@ private function addSubForm(FormBuilderInterface $builder, $name, ChoiceView $ch
503488
504489 private function createChoiceListView (ChoiceListInterface $ choiceList , array $ options )
505490 {
506- // If no explicit grouping information is given, use the structural
507- // information from the "choices" option for creating groups
508- if (!$ options ['group_by ' ] && $ options ['choices ' ]) {
509- $ options ['group_by ' ] = !$ options ['choices_as_values ' ]
510- ? self ::flipRecursive ($ options ['choices ' ])
511- : $ options ['choices ' ];
512- }
513-
514491 return $ this ->choiceListFactory ->createView (
515492 $ choiceList ,
516493 $ options ['preferred_choices ' ],
0 commit comments