function Command::addArgument
Adds an argument.
Parameters
$mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL:
$default The default value (for InputArgument::OPTIONAL mode only):
array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion:
Return value
$this
Throws
InvalidArgumentException When argument mode is not valid
2 methods override Command::addArgument()
- LazyCommand::addArgument in vendor/
symfony/ console/ Command/ LazyCommand.php - TraceableCommand::addArgument in vendor/
symfony/ console/ Command/ TraceableCommand.php - Adds an argument.
File
-
vendor/
symfony/ console/ Command/ Command.php, line 412
Class
- Command
- Base class for all commands.
Namespace
Symfony\Component\Console\CommandCode
public function addArgument(string $name, ?int $mode = null, string $description = '', mixed $default = null, array|\Closure $suggestedValues = []) : static {
$this->definition
->addArgument(new InputArgument($name, $mode, $description, $default, $suggestedValues));
$this->fullDefinition?->addArgument(new InputArgument($name, $mode, $description, $default, $suggestedValues));
return $this;
}