File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
components/console/helpers Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,30 @@ provide a callback function to dynamically generate suggestions::
216216
217217 The ``setAutocompleterCallback() `` method was introduced in Symfony 4.3.
218218
219+ Do not Trim the Answer
220+ ~~~~~~~~~~~~~~~~~~~~~~
221+
222+ You can also specify if you want to not trim the answer by setting it directly with
223+ :method: `Symfony\\ Component\\ Console\\ Question\\ Question::setTrimmable `::
224+
225+ use Symfony\Component\Console\Question\Question;
226+
227+ // ...
228+ public function execute(InputInterface $input, OutputInterface $output)
229+ {
230+ // ...
231+ $helper = $this->getHelper('question');
232+
233+ $question = new Question('What is the name of the child?');
234+ $question->setTrimmable(false);
235+ // if the users inputs 'elsa ' it will not be trimmed and you will get 'elsa ' as value
236+ $name = $helper->ask($input, $output, $question);
237+ }
238+
239+ .. versionadded :: 4.4
240+
241+ The ``setTrimmable() `` method was introduced in Symfony 4.4.
242+
219243Hiding the User's Response
220244~~~~~~~~~~~~~~~~~~~~~~~~~~
221245
You can’t perform that action at this time.
0 commit comments