Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/private/Console/CommandAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function configure(): void {
}
$default = $reflection->hasDefaultValue() ? $reflection->getDefaultValue() : null;

$this->addArgument($arg->name, $mode, $arg->description, $default);
$this->addArgument($arg->name, $mode, $arg->description, $default, $arg->suggestedValues);
}

foreach ($this->options as $option) {
Expand Down Expand Up @@ -169,7 +169,7 @@ public function configure(): void {
throw new \LogicException(\sprintf('The option "$%s" of "%s" must have a default value of false.', $name, $reflection->getSourceName()));
}

$this->addOption($option->name, $option->shortcut, InputOption::VALUE_OPTIONAL, $option->description, $default);
$this->addOption($option->name, $option->shortcut, InputOption::VALUE_OPTIONAL, $option->description, $default, $option->suggestedValues);
continue;
}

Expand Down Expand Up @@ -201,7 +201,7 @@ public function configure(): void {
$mode = InputOption::VALUE_REQUIRED;
}

$this->addOption($option->name, $option->shortcut, $mode, $option->description, $default);
$this->addOption($option->name, $option->shortcut, $mode, $option->description, $default, $option->suggestedValues);
}
}

Expand Down
2 changes: 2 additions & 0 deletions lib/public/Console/Attribute/Argument.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ final class Argument {
*
* @param string $description The description of the argument, displayed with the help page
* @param string $name The name of the argument
* @param array|\Closure $suggestedValues An array or a closure that provides suggested values for the argument.
* @since 35.0.0
*/
public function __construct(
public string $description = '',
public string $name = '',
public array|\Closure $suggestedValues = [],
) {
}
}
2 changes: 2 additions & 0 deletions lib/public/Console/Attribute/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ final class Option {
* @param string $description The description of the option, displayed with the help page
* @param string $name The name of the option
* @param array|string|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
* @param array|\Closure $suggestedValues An array or a closure that provides suggested values for the option.
* @since 35.0.0
*/
public function __construct(
public string $description = '',
public string $name = '',
public array|string|null $shortcut = null,
public array|\Closure $suggestedValues = [],
) {
}
}
Loading