function ChoiceQuestion::__construct
Parameters
string $question The question to ask to the user:
array $choices The list of available choices:
string|bool|int|float|null $default The default answer to return:
Overrides Question::__construct
File
-
vendor/
symfony/ console/ Question/ ChoiceQuestion.php, line 32
Class
- ChoiceQuestion
- Represents a choice question.
Namespace
Symfony\Component\Console\QuestionCode
public function __construct(string $question, array $choices, string|bool|int|float|null $default = null) {
if (!$choices) {
throw new \LogicException('Choice question must have at least 1 choice available.');
}
parent::__construct($question, $default);
$this->setValidator($this->getDefaultValidator());
$this->setAutocompleterValues($choices);
}