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

Breadcrumb

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

function InputOption::__construct

Same name in this branch
  1. 11.1.x vendor/symfony/console/Input/InputOption.php \Symfony\Component\Console\Input\InputOption::__construct()

Parameters

string|string[]|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts:

int|null $mode The option mode: One of the VALUE_* constants:

string|bool|int|float|string[]|null $default The default value (must be null for self::VALUE_NONE):

list<string>|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completionnull for self::VALUE_NONE):

Throws

InvalidArgumentException If option mode is invalid or incompatible

Overrides InputOption::__construct

File

vendor/composer/composer/src/Composer/Console/Input/InputOption.php, line 46

Class

InputOption
Backport suggested values definition from symfony/console 6.1+

Namespace

Composer\Console\Input

Code

public function __construct(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null, $suggestedValues = []) {
    parent::__construct($name, $shortcut, $mode, $description, $default);
    $this->suggestedValues = $suggestedValues;
    if ([] !== $suggestedValues && !$this->acceptValue()) {
        throw new LogicException('Cannot set suggested values if the option does not accept a value.');
    }
}

API Navigation

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