function SymfonyStyle::choice
Overrides StyleInterface::choice
File
-
vendor/
symfony/ console/ Style/ SymfonyStyle.php, line 234
Class
- SymfonyStyle
- Output decorator helpers for the Symfony Style Guide.
Namespace
Symfony\Component\Console\StyleCode
public function choice(string $question, array $choices, mixed $default = null, bool $multiSelect = false) : mixed {
if (null !== $default) {
$values = array_flip($choices);
$default = $values[$default] ?? $default;
}
$questionChoice = new ChoiceQuestion($question, $choices, $default);
$questionChoice->setMultiselect($multiSelect);
return $this->askQuestion($questionChoice);
}