Skip to content

Update questionhelper.rst #17205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions components/console/helpers/questionhelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ if you want to know a bundle name, you can add this to your command::

// ... do something with the bundleName

return Commande::SUCCESS;
return Command::SUCCESS;
}

The user will be asked "Please enter the name of the bundle". They can type
Expand Down Expand Up @@ -124,7 +124,7 @@ from a predefined list::

// ... do something with the color

return Commande::SUCCESS;
return Command::SUCCESS;
}

.. versionadded:: 5.2
Expand Down Expand Up @@ -166,7 +166,7 @@ this use :method:`Symfony\\Component\\Console\\Question\\ChoiceQuestion::setMult
$colors = $helper->ask($input, $output, $question);
$output->writeln('You have just selected: ' . implode(', ', $colors));

return Commande::SUCCESS;
return Command::SUCCESS;
}

Now, when the user enters ``1,2``, the result will be:
Expand Down Expand Up @@ -197,7 +197,7 @@ will be autocompleted as the user types::

// ... do something with the bundleName

return Commande::SUCCESS;
return Command::SUCCESS;
}

In more complex use cases, it may be necessary to generate suggestions on the
Expand Down Expand Up @@ -236,7 +236,7 @@ provide a callback function to dynamically generate suggestions::

// ... do something with the filePath

return Commande::SUCCESS;
return Command::SUCCESS;
}

Do not Trim the Answer
Expand All @@ -260,7 +260,7 @@ You can also specify if you want to not trim the answer by setting it directly w

// ... do something with the name

return Commande::SUCCESS;
return Command::SUCCESS;
}

Accept Multiline Answers
Expand Down Expand Up @@ -291,7 +291,7 @@ the response to a question should allow multiline answers by passing ``true`` to

// ... do something with the answer

return Commande::SUCCESS;
return Command::SUCCESS;
}

Multiline questions stop reading user input after receiving an end-of-transmission
Expand Down Expand Up @@ -319,7 +319,7 @@ convenient for passwords::

// ... do something with the password

return Commande::SUCCESS;
return Command::SUCCESS;
}

.. caution::
Expand Down Expand Up @@ -351,7 +351,7 @@ convenient for passwords::

// ...

return Commande::SUCCESS;
return Command::SUCCESS;
}

Normalizing the Answer
Expand Down Expand Up @@ -382,7 +382,7 @@ method::

// ... do something with the bundleName

return Commande::SUCCESS;
return Command::SUCCESS;
}

.. caution::
Expand Down Expand Up @@ -426,7 +426,7 @@ method::

// ... do something with the bundleName

return Commande::SUCCESS;
return Command::SUCCESS;
}

The ``$validator`` is a callback which handles the validation. It should
Expand Down Expand Up @@ -488,7 +488,7 @@ You can also use a validator with a hidden question::

// ... do something with the password

return Commande::SUCCESS;
return Command::SUCCESS;
}

Testing a Command that Expects Input
Expand Down