@@ -70,7 +70,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
7070
7171 // Check if the choices already contain the empty value
7272 // Only add the placeholder option if this is not the case
73- if (null !== $ options ['placeholder ' ] && 0 === \count ($ choiceList ->getChoicesForValues (array ( '' ) ))) {
73+ if (null !== $ options ['placeholder ' ] && 0 === \count ($ choiceList ->getChoicesForValues ([ '' ] ))) {
7474 $ placeholderView = new ChoiceView (null , '' , $ options ['placeholder ' ]);
7575
7676 // "placeholder" is a reserved name
@@ -108,7 +108,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
108108 $ unknownValues = $ valueMap ;
109109
110110 // Reconstruct the data as mapping from child names to values
111- $ data = array () ;
111+ $ data = [] ;
112112
113113 /** @var FormInterface $child */
114114 foreach ($ form as $ child ) {
@@ -184,15 +184,15 @@ public function buildView(FormView $view, FormInterface $form, array $options)
184184 ? $ form ->getConfig ()->getAttribute ('choice_list_view ' )
185185 : $ this ->createChoiceListView ($ choiceList , $ options );
186186
187- $ view ->vars = array_replace ($ view ->vars , array (
187+ $ view ->vars = array_replace ($ view ->vars , [
188188 'multiple ' => $ options ['multiple ' ],
189189 'expanded ' => $ options ['expanded ' ],
190190 'preferred_choices ' => $ choiceListView ->preferredChoices ,
191191 'choices ' => $ choiceListView ->choices ,
192192 'separator ' => '------------------- ' ,
193193 'placeholder ' => null ,
194194 'choice_translation_domain ' => $ choiceTranslationDomain ,
195- ) );
195+ ] );
196196
197197 // The decision, whether a choice is selected, is potentially done
198198 // thousand of times during the rendering of a template. Provide a
@@ -255,7 +255,7 @@ public function configureOptions(OptionsResolver $resolver)
255255 }
256256
257257 if ($ options ['multiple ' ]) {
258- return array () ;
258+ return [] ;
259259 }
260260
261261 return '' ;
@@ -296,16 +296,16 @@ public function configureOptions(OptionsResolver $resolver)
296296 return $ choiceTranslationDomain ;
297297 };
298298
299- $ resolver ->setDefaults (array (
299+ $ resolver ->setDefaults ([
300300 'multiple ' => false ,
301301 'expanded ' => false ,
302- 'choices ' => array () ,
302+ 'choices ' => [] ,
303303 'choice_loader ' => null ,
304304 'choice_label ' => null ,
305305 'choice_name ' => null ,
306306 'choice_value ' => null ,
307307 'choice_attr ' => null ,
308- 'preferred_choices ' => array () ,
308+ 'preferred_choices ' => [] ,
309309 'group_by ' => null ,
310310 'empty_data ' => $ emptyData ,
311311 'placeholder ' => $ placeholderDefault ,
@@ -317,20 +317,20 @@ public function configureOptions(OptionsResolver $resolver)
317317 'data_class ' => null ,
318318 'choice_translation_domain ' => true ,
319319 'trim ' => false ,
320- ) );
320+ ] );
321321
322322 $ resolver ->setNormalizer ('placeholder ' , $ placeholderNormalizer );
323323 $ resolver ->setNormalizer ('choice_translation_domain ' , $ choiceTranslationDomainNormalizer );
324324
325- $ resolver ->setAllowedTypes ('choices ' , array ( 'null ' , 'array ' , '\Traversable ' ) );
326- $ resolver ->setAllowedTypes ('choice_translation_domain ' , array ( 'null ' , 'bool ' , 'string ' ) );
327- $ resolver ->setAllowedTypes ('choice_loader ' , array ( 'null ' , 'Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface ' ) );
328- $ resolver ->setAllowedTypes ('choice_label ' , array ( 'null ' , 'bool ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ) );
329- $ resolver ->setAllowedTypes ('choice_name ' , array ( 'null ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ) );
330- $ resolver ->setAllowedTypes ('choice_value ' , array ( 'null ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ) );
331- $ resolver ->setAllowedTypes ('choice_attr ' , array ( 'null ' , 'array ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ) );
332- $ resolver ->setAllowedTypes ('preferred_choices ' , array ( 'array ' , '\Traversable ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ) );
333- $ resolver ->setAllowedTypes ('group_by ' , array ( 'null ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ) );
325+ $ resolver ->setAllowedTypes ('choices ' , [ 'null ' , 'array ' , '\Traversable ' ] );
326+ $ resolver ->setAllowedTypes ('choice_translation_domain ' , [ 'null ' , 'bool ' , 'string ' ] );
327+ $ resolver ->setAllowedTypes ('choice_loader ' , [ 'null ' , 'Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface ' ] );
328+ $ resolver ->setAllowedTypes ('choice_label ' , [ 'null ' , 'bool ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ] );
329+ $ resolver ->setAllowedTypes ('choice_name ' , [ 'null ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ] );
330+ $ resolver ->setAllowedTypes ('choice_value ' , [ 'null ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ] );
331+ $ resolver ->setAllowedTypes ('choice_attr ' , [ 'null ' , 'array ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ] );
332+ $ resolver ->setAllowedTypes ('preferred_choices ' , [ 'array ' , '\Traversable ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ] );
333+ $ resolver ->setAllowedTypes ('group_by ' , [ 'null ' , 'callable ' , 'string ' , 'Symfony\Component\PropertyAccess\PropertyPath ' ] );
334334 }
335335
336336 /**
@@ -367,13 +367,13 @@ private function addSubForms(FormBuilderInterface $builder, array $choiceViews,
367367 */
368368 private function addSubForm (FormBuilderInterface $ builder , string $ name , ChoiceView $ choiceView , array $ options )
369369 {
370- $ choiceOpts = array (
370+ $ choiceOpts = [
371371 'value ' => $ choiceView ->value ,
372372 'label ' => $ choiceView ->label ,
373373 'attr ' => $ choiceView ->attr ,
374374 'translation_domain ' => $ options ['translation_domain ' ],
375375 'block_name ' => 'entry ' ,
376- ) ;
376+ ] ;
377377
378378 if ($ options ['multiple ' ]) {
379379 $ choiceType = __NAMESPACE__ .'\CheckboxType ' ;
@@ -397,7 +397,7 @@ private function createChoiceList(array $options)
397397 }
398398
399399 // Harden against NULL values (like in EntityType and ModelType)
400- $ choices = null !== $ options ['choices ' ] ? $ options ['choices ' ] : array () ;
400+ $ choices = null !== $ options ['choices ' ] ? $ options ['choices ' ] : [] ;
401401
402402 return $ this ->choiceListFactory ->createListFromChoices ($ choices , $ options ['choice_value ' ]);
403403 }
0 commit comments