Skip to content

Commit 4cf014e

Browse files
committed
Merge branch '4.4' into 5.4
* 4.4: [Form] Fix `selectedchoice` test link [Form] Improve `ChoiceType` CS
2 parents e5c3fd6 + 5ab1ff9 commit 4cf014e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

reference/forms/types/choice.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,21 +76,21 @@ method::
7676
// a callback to return the label for a given choice
7777
// if a placeholder is used, its empty value (null) may be passed but
7878
// its label is defined by its own "placeholder" option
79-
'choice_label' => function(?Category $category) {
79+
'choice_label' => function (?Category $category) {
8080
return $category ? strtoupper($category->getName()) : '';
8181
},
8282
// returns the html attributes for each option input (may be radio/checkbox)
83-
'choice_attr' => function(?Category $category) {
83+
'choice_attr' => function (?Category $category) {
8484
return $category ? ['class' => 'category_'.strtolower($category->getName())] : [];
8585
},
8686
// every option can use a string property path or any callable that get
8787
// passed each choice as argument, but it may not be needed
88-
'group_by' => function() {
88+
'group_by' => function () {
8989
// randomly assign things into 2 groups
9090
return rand(0, 1) == 1 ? 'Group A' : 'Group B';
9191
},
9292
// a callback to return whether a category is preferred
93-
'preferred_choices' => function(?Category $category) {
93+
'preferred_choices' => function (?Category $category) {
9494
return $category && 100 < $category->getArticleCounts();
9595
},
9696
]);
@@ -314,5 +314,5 @@ Field Variables
314314

315315
.. tip::
316316

317-
It's significantly faster to use the :ref:`form-twig-selectedchoice`
317+
It's significantly faster to use the :ref:`selectedchoice <form-twig-selectedchoice>`
318318
test instead when using Twig.

reference/forms/types/options/choice_attr.rst.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ If an array, the keys of the ``choices`` array must be used as keys::
3333
'No' => false,
3434
'Maybe' => null,
3535
],
36-
'choice_attr' => function($choice, $key, $value) {
36+
'choice_attr' => function ($choice, $key, $value) {
3737
// adds a class like attending_yes, attending_no, etc
3838
return ['class' => 'attending_'.strtolower($key)];
3939
},

reference/forms/types/options/choice_loader.rst.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if you want to take advantage of lazy loading::
1717
// ...
1818

1919
$builder->add('loaded_choices', ChoiceType::class, [
20-
'choice_loader' => new CallbackChoiceLoader(function() {
20+
'choice_loader' => new CallbackChoiceLoader(function () {
2121
return StaticClass::getConstants();
2222
}),
2323
]);

0 commit comments

Comments
 (0)