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

Breadcrumb

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

function InputArgument::__construct

Same name in this branch
  1. 11.1.x vendor/composer/composer/src/Composer/Console/Input/InputArgument.php \Composer\Console\Input\InputArgument::__construct()

Parameters

string $name The argument name:

int-mask-of<InputArgument::*>|null $mode The argument mode: a bit mask of self::REQUIRED, self::OPTIONAL and self::IS_ARRAY:

string $description A description text:

string|bool|int|float|array|null $default The default value (for self::OPTIONAL mode only):

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

Throws

InvalidArgumentException When argument mode is not valid

2 calls to InputArgument::__construct()
InputArgument::__construct in vendor/composer/composer/src/Composer/Console/Input/InputArgument.php
InputArgument::__construct in vendor/composer/composer/src/Composer/Console/Input/InputArgument.php
1 method overrides InputArgument::__construct()
InputArgument::__construct in vendor/composer/composer/src/Composer/Console/Input/InputArgument.php

File

vendor/symfony/console/Input/InputArgument.php, line 55

Class

InputArgument
Represents a command line argument.

Namespace

Symfony\Component\Console\Input

Code

public function __construct(string $name, ?int $mode = null, string $description = '', string|bool|int|float|array|null $default = null, \Closure|array $suggestedValues = []) {
    if (null === $mode) {
        $mode = self::OPTIONAL;
    }
    elseif ($mode >= self::IS_ARRAY << 1 || $mode < 1) {
        throw new InvalidArgumentException(\sprintf('Argument mode "%s" is not valid.', $mode));
    }
    $this->mode = $mode;
    $this->setDefault($default);
}

API Navigation

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