diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index ec4f79c7205..719faf12fca 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -72,21 +72,21 @@ method:: // a callback to return the label for a given choice // if a placeholder is used, its empty value (null) may be passed but // its label is defined by its own "placeholder" option - 'choice_label' => function(?Category $category) { + 'choice_label' => function (?Category $category) { return $category ? strtoupper($category->getName()) : ''; }, // returns the html attributes for each option input (may be radio/checkbox) - 'choice_attr' => function(?Category $category) { + 'choice_attr' => function (?Category $category) { return $category ? ['class' => 'category_'.strtolower($category->getName())] : []; }, // every option can use a string property path or any callable that get // passed each choice as argument, but it may not be needed - 'group_by' => function() { + 'group_by' => function () { // randomly assign things into 2 groups return rand(0, 1) == 1 ? 'Group A' : 'Group B'; }, // a callback to return whether a category is preferred - 'preferred_choices' => function(?Category $category) { + 'preferred_choices' => function (?Category $category) { return $category && 100 < $category->getArticleCounts(); }, ]); @@ -190,7 +190,7 @@ if you want to take advantage of lazy loading:: // ... $builder->add('constants', ChoiceType::class, [ - 'choice_loader' => new CallbackChoiceLoader(function() { + 'choice_loader' => new CallbackChoiceLoader(function () { return StaticClass::getConstants(); }), ]); diff --git a/reference/forms/types/options/choice_attr.rst.inc b/reference/forms/types/options/choice_attr.rst.inc index b86b7450778..acb0fc677aa 100644 --- a/reference/forms/types/options/choice_attr.rst.inc +++ b/reference/forms/types/options/choice_attr.rst.inc @@ -33,7 +33,7 @@ If an array, the keys of the ``choices`` array must be used as keys:: 'No' => false, 'Maybe' => null, ], - 'choice_attr' => function($choice, $key, $value) { + 'choice_attr' => function ($choice, $key, $value) { // adds a class like attending_yes, attending_no, etc return ['class' => 'attending_'.strtolower($key)]; },