@@ -15,6 +15,11 @@ first argument, an :class:`Symfony\\Component\\Console\\Output\\OutputInterface`
1515instance as the second argument and a
1616:class: `Symfony\\ Component\\ Console\\ Question\\ Question ` as last argument.
1717
18+ .. note ::
19+
20+ As an alternative, consider using the
21+ :ref: `SymfonyStyle <symfony-style-questions >` to ask questions.
22+
1823Asking the User for Confirmation
1924--------------------------------
2025
@@ -82,9 +87,9 @@ if you want to know a bundle name, you can add this to your command::
8287 $question = new Question('Please enter the name of the bundle', 'AcmeDemoBundle');
8388
8489 $bundleName = $helper->ask($input, $output, $question);
85-
90+
8691 // ... do something with the bundleName
87-
92+
8893 return Command::SUCCESS;
8994 }
9095
@@ -120,7 +125,7 @@ from a predefined list::
120125 $output->writeln('You have just selected: '.$color);
121126
122127 // ... do something with the color
123-
128+
124129 return Command::SUCCESS;
125130 }
126131
@@ -162,7 +167,7 @@ this use :method:`Symfony\\Component\\Console\\Question\\ChoiceQuestion::setMult
162167
163168 $colors = $helper->ask($input, $output, $question);
164169 $output->writeln('You have just selected: ' . implode(', ', $colors));
165-
170+
166171 return Command::SUCCESS;
167172 }
168173
@@ -191,9 +196,9 @@ will be autocompleted as the user types::
191196 $question->setAutocompleterValues($bundles);
192197
193198 $bundleName = $helper->ask($input, $output, $question);
194-
199+
195200 // ... do something with the bundleName
196-
201+
197202 return Command::SUCCESS;
198203 }
199204
@@ -230,9 +235,9 @@ provide a callback function to dynamically generate suggestions::
230235 $question->setAutocompleterCallback($callback);
231236
232237 $filePath = $helper->ask($input, $output, $question);
233-
238+
234239 // ... do something with the filePath
235-
240+
236241 return Command::SUCCESS;
237242 }
238243
@@ -254,9 +259,9 @@ You can also specify if you want to not trim the answer by setting it directly w
254259 $question->setTrimmable(false);
255260 // if the users inputs 'elsa ' it will not be trimmed and you will get 'elsa ' as value
256261 $name = $helper->ask($input, $output, $question);
257-
262+
258263 // ... do something with the name
259-
264+
260265 return Command::SUCCESS;
261266 }
262267
@@ -285,9 +290,9 @@ the response to a question should allow multiline answers by passing ``true`` to
285290 $question->setMultiline(true);
286291
287292 $answer = $helper->ask($input, $output, $question);
288-
293+
289294 // ... do something with the answer
290-
295+
291296 return Command::SUCCESS;
292297 }
293298
@@ -313,9 +318,9 @@ convenient for passwords::
313318 $question->setHiddenFallback(false);
314319
315320 $password = $helper->ask($input, $output, $question);
316-
321+
317322 // ... do something with the password
318-
323+
319324 return Command::SUCCESS;
320325 }
321326
@@ -347,7 +352,7 @@ convenient for passwords::
347352 QuestionHelper::disableStty();
348353
349354 // ...
350-
355+
351356 return Command::SUCCESS;
352357 }
353358
@@ -376,9 +381,9 @@ method::
376381 });
377382
378383 $bundleName = $helper->ask($input, $output, $question);
379-
384+
380385 // ... do something with the bundleName
381-
386+
382387 return Command::SUCCESS;
383388 }
384389
@@ -420,9 +425,9 @@ method::
420425 $question->setMaxAttempts(2);
421426
422427 $bundleName = $helper->ask($input, $output, $question);
423-
428+
424429 // ... do something with the bundleName
425-
430+
426431 return Command::SUCCESS;
427432 }
428433
@@ -482,9 +487,9 @@ You can also use a validator with a hidden question::
482487 $question->setMaxAttempts(20);
483488
484489 $password = $helper->ask($input, $output, $question);
485-
490+
486491 // ... do something with the password
487-
492+
488493 return Command::SUCCESS;
489494 }
490495
0 commit comments