chore: update dependencies
This commit is contained in:
parent
30123b24d3
commit
8142cc3977
1219 changed files with 25379 additions and 15428 deletions
99
vendor/symfony/console/Command/Command.php
vendored
99
vendor/symfony/console/Command/Command.php
vendored
|
@ -39,20 +39,6 @@ class Command
|
|||
public const FAILURE = 1;
|
||||
public const INVALID = 2;
|
||||
|
||||
/**
|
||||
* @var string|null The default command name
|
||||
*
|
||||
* @deprecated since Symfony 6.1, use the AsCommand attribute instead
|
||||
*/
|
||||
protected static $defaultName;
|
||||
|
||||
/**
|
||||
* @var string|null The default command description
|
||||
*
|
||||
* @deprecated since Symfony 6.1, use the AsCommand attribute instead
|
||||
*/
|
||||
protected static $defaultDescription;
|
||||
|
||||
private ?Application $application = null;
|
||||
private ?string $name = null;
|
||||
private ?string $processTitle = null;
|
||||
|
@ -70,40 +56,20 @@ class Command
|
|||
|
||||
public static function getDefaultName(): ?string
|
||||
{
|
||||
$class = static::class;
|
||||
|
||||
if ($attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
|
||||
if ($attribute = (new \ReflectionClass(static::class))->getAttributes(AsCommand::class)) {
|
||||
return $attribute[0]->newInstance()->name;
|
||||
}
|
||||
|
||||
$r = new \ReflectionProperty($class, 'defaultName');
|
||||
|
||||
if ($class !== $r->class || null === static::$defaultName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
trigger_deprecation('symfony/console', '6.1', 'Relying on the static property "$defaultName" for setting a command name is deprecated. Add the "%s" attribute to the "%s" class instead.', AsCommand::class, static::class);
|
||||
|
||||
return static::$defaultName;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function getDefaultDescription(): ?string
|
||||
{
|
||||
$class = static::class;
|
||||
|
||||
if ($attribute = (new \ReflectionClass($class))->getAttributes(AsCommand::class)) {
|
||||
if ($attribute = (new \ReflectionClass(static::class))->getAttributes(AsCommand::class)) {
|
||||
return $attribute[0]->newInstance()->description;
|
||||
}
|
||||
|
||||
$r = new \ReflectionProperty($class, 'defaultDescription');
|
||||
|
||||
if ($class !== $r->class || null === static::$defaultDescription) {
|
||||
return null;
|
||||
}
|
||||
|
||||
trigger_deprecation('symfony/console', '6.1', 'Relying on the static property "$defaultDescription" for setting a command description is deprecated. Add the "%s" attribute to the "%s" class instead.', AsCommand::class, static::class);
|
||||
|
||||
return static::$defaultDescription;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,7 +77,7 @@ class Command
|
|||
*
|
||||
* @throws LogicException When the command name is empty
|
||||
*/
|
||||
public function __construct(string $name = null)
|
||||
public function __construct(?string $name = null)
|
||||
{
|
||||
$this->definition = new InputDefinition();
|
||||
|
||||
|
@ -141,22 +107,14 @@ class Command
|
|||
* Ignores validation errors.
|
||||
*
|
||||
* This is mainly useful for the help command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function ignoreValidationErrors()
|
||||
public function ignoreValidationErrors(): void
|
||||
{
|
||||
$this->ignoreValidationErrors = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setApplication(Application $application = null)
|
||||
public function setApplication(?Application $application): void
|
||||
{
|
||||
if (1 > \func_num_args()) {
|
||||
trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
|
||||
}
|
||||
$this->application = $application;
|
||||
if ($application) {
|
||||
$this->setHelperSet($application->getHelperSet());
|
||||
|
@ -167,10 +125,7 @@ class Command
|
|||
$this->fullDefinition = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setHelperSet(HelperSet $helperSet)
|
||||
public function setHelperSet(HelperSet $helperSet): void
|
||||
{
|
||||
$this->helperSet = $helperSet;
|
||||
}
|
||||
|
@ -196,10 +151,8 @@ class Command
|
|||
*
|
||||
* Override this to check for x or y and return false if the command cannot
|
||||
* run properly under the current conditions.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled()
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -227,7 +180,7 @@ class Command
|
|||
*
|
||||
* @see setCode()
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
throw new LogicException('You must override the execute() method in the concrete command class.');
|
||||
}
|
||||
|
@ -324,17 +277,13 @@ class Command
|
|||
$statusCode = ($this->code)($input, $output);
|
||||
} else {
|
||||
$statusCode = $this->execute($input, $output);
|
||||
|
||||
if (!\is_int($statusCode)) {
|
||||
throw new \TypeError(sprintf('Return value of "%s::execute()" must be of the type int, "%s" returned.', static::class, get_debug_type($statusCode)));
|
||||
}
|
||||
}
|
||||
|
||||
return is_numeric($statusCode) ? (int) $statusCode : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds suggestions to $suggestions for the current completion input (e.g. option or argument).
|
||||
* Supplies suggestions when resolving possible completion options for input (e.g. option or argument).
|
||||
*/
|
||||
public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
|
||||
{
|
||||
|
@ -452,20 +401,16 @@ class Command
|
|||
/**
|
||||
* Adds an argument.
|
||||
*
|
||||
* @param $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
|
||||
* @param $default The default value (for InputArgument::OPTIONAL mode only)
|
||||
* @param $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
|
||||
* @param $default The default value (for InputArgument::OPTIONAL mode only)
|
||||
* @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException When argument mode is not valid
|
||||
*/
|
||||
public function addArgument(string $name, int $mode = null, string $description = '', mixed $default = null /* array|\Closure $suggestedValues = null */): static
|
||||
public function addArgument(string $name, ?int $mode = null, string $description = '', mixed $default = null, array|\Closure $suggestedValues = []): static
|
||||
{
|
||||
$suggestedValues = 5 <= \func_num_args() ? func_get_arg(4) : [];
|
||||
if (!\is_array($suggestedValues) && !$suggestedValues instanceof \Closure) {
|
||||
throw new \TypeError(sprintf('Argument 5 passed to "%s()" must be array or \Closure, "%s" given.', __METHOD__, get_debug_type($suggestedValues)));
|
||||
}
|
||||
$this->definition->addArgument(new InputArgument($name, $mode, $description, $default, $suggestedValues));
|
||||
$this->fullDefinition?->addArgument(new InputArgument($name, $mode, $description, $default, $suggestedValues));
|
||||
|
||||
|
@ -475,21 +420,17 @@ class Command
|
|||
/**
|
||||
* Adds an option.
|
||||
*
|
||||
* @param $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
|
||||
* @param $mode The option mode: One of the InputOption::VALUE_* constants
|
||||
* @param $default The default value (must be null for InputOption::VALUE_NONE)
|
||||
* @param $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
|
||||
* @param $mode The option mode: One of the InputOption::VALUE_* constants
|
||||
* @param $default The default value (must be null for InputOption::VALUE_NONE)
|
||||
* @param array|\Closure(CompletionInput,CompletionSuggestions):list<string|Suggestion> $suggestedValues The values used for input completion
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws InvalidArgumentException If option mode is invalid or incompatible
|
||||
*/
|
||||
public function addOption(string $name, string|array $shortcut = null, int $mode = null, string $description = '', mixed $default = null /* array|\Closure $suggestedValues = [] */): static
|
||||
public function addOption(string $name, string|array|null $shortcut = null, ?int $mode = null, string $description = '', mixed $default = null, array|\Closure $suggestedValues = []): static
|
||||
{
|
||||
$suggestedValues = 6 <= \func_num_args() ? func_get_arg(5) : [];
|
||||
if (!\is_array($suggestedValues) && !$suggestedValues instanceof \Closure) {
|
||||
throw new \TypeError(sprintf('Argument 5 passed to "%s()" must be array or \Closure, "%s" given.', __METHOD__, get_debug_type($suggestedValues)));
|
||||
}
|
||||
$this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default, $suggestedValues));
|
||||
$this->fullDefinition?->addOption(new InputOption($name, $shortcut, $mode, $description, $default, $suggestedValues));
|
||||
|
||||
|
@ -695,12 +636,10 @@ class Command
|
|||
/**
|
||||
* Gets a helper instance by name.
|
||||
*
|
||||
* @return HelperInterface
|
||||
*
|
||||
* @throws LogicException if no HelperSet is defined
|
||||
* @throws InvalidArgumentException if the helper is not defined
|
||||
*/
|
||||
public function getHelper(string $name): mixed
|
||||
public function getHelper(string $name): HelperInterface
|
||||
{
|
||||
if (null === $this->helperSet) {
|
||||
throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue