Skip to content

Commit c0daee9

Browse files
committed
minor #20586 [Console] Adding associative array (ThomasLandauer)
This PR was merged into the 6.4 branch. Discussion ---------- [Console] Adding associative array Page: https://symfony.com/doc/6.4/components/console/helpers/questionhelper.html#let-the-user-choose-from-a-list-of-answers Commits ------- b9e2005 [Console] Adding associative array
2 parents e5e62c4 + b9e2005 commit c0daee9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/console/helpers/questionhelper.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ but ``red`` could be set instead (could be more explicit)::
128128
$question = new ChoiceQuestion(
129129
'Please select your favorite color (defaults to red)',
130130
// choices can also be PHP objects that implement __toString() method
131-
['red', 'blue', 'yellow'],
131+
['red', 'blue', 'yellow'], // pass an associative array to display custom indices: [3 => 'red', 7 => 'blue']
132132
0
133133
);
134134
$question->setErrorMessage('Color %s is invalid.');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy