File tree 1 file changed +24
-0
lines changed
components/console/helpers
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::
216
216
217
217
The ``setAutocompleterCallback() `` method was introduced in Symfony 4.3.
218
218
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
+
219
243
Hiding the User's Response
220
244
~~~~~~~~~~~~~~~~~~~~~~~~~~
221
245
You can’t perform that action at this time.
0 commit comments