Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SymfonyStyle.php

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\Style

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal