Copied!

Represents a command line argument.

CloneableInstantiable
Constants
public Symfony\Component\Console\Input\InputArgument::IS_ARRAY = 4
 

The argument accepts multiple values and turn them into an array (e.g. 'app:foo bar baz' will result in value ['bar', 'baz']).

public Symfony\Component\Console\Input\InputArgument::OPTIONAL = 2
 

Providing an argument is optional (e.g. 'app:foo' and 'app:foo bar' are both allowed). This is the default behavior of arguments.

public Symfony\Component\Console\Input\InputArgument::REQUIRED = 1
 

Providing an argument is required (e.g. just 'app:foo' is not allowed).

Methods
public __construct(string $name, ?int $mode = NULL, string $description = '', array|string|int|float|bool|?null $default = NULL, Closure|array $suggestedValues = [])
 
  • param string $name The argument name
  • param string $description A description text
  • param string|bool|int|float|array|null $default The default value (for self::OPTIONAL mode only)
  • param array|callable $suggestedValues The values used for input completion
  • throws \InvalidArgumentException When argument mode is not valid
public complete(Symfony\Component\Console\Completion\CompletionInput $input, Symfony\Component\Console\Completion\CompletionSuggestions $suggestions) : void
 

Supplies suggestions when command resolves possible completion options for input.

  • see \Command::complete()
public getDefault() : array|string|int|float|bool|?null
 

Returns the default value.

public getDescription() : string
 

Returns the description text.

public getName() : string
 

Returns the argument name.

public hasCompletion() : bool
 

Returns true if the argument has values for input completion.

public isArray() : bool
 

Returns true if the argument can take multiple values.

  • return bool true if mode is self::IS_ARRAY, false otherwise
public isRequired() : bool
 

Returns true if the argument is required.

  • return bool true if parameter mode is self::REQUIRED, false otherwise
public setDefault(array|string|int|float|bool|?null $default) : void
 

Sets the default value.

Properties
private array|string|int|float|bool|?null $default
private string $description
private int $mode
private string $name
private Closure|array $suggestedValues
© 2025 Bruce Wells
Search Namespaces \ Classes
Configuration