Updates to vendors etc

This commit is contained in:
Chris Hunt
2025-07-11 15:57:48 +01:00
parent d972cbcd0a
commit 8fb6438254
8043 changed files with 248005 additions and 189479 deletions

View File

@@ -46,10 +46,8 @@ class InputDefinition
/**
* Sets the definition of the input.
*
* @return void
*/
public function setDefinition(array $definition)
public function setDefinition(array $definition): void
{
$arguments = [];
$options = [];
@@ -69,10 +67,8 @@ class InputDefinition
* Sets the InputArgument objects.
*
* @param InputArgument[] $arguments An array of InputArgument objects
*
* @return void
*/
public function setArguments(array $arguments = [])
public function setArguments(array $arguments = []): void
{
$this->arguments = [];
$this->requiredCount = 0;
@@ -85,10 +81,8 @@ class InputDefinition
* Adds an array of InputArgument objects.
*
* @param InputArgument[] $arguments An array of InputArgument objects
*
* @return void
*/
public function addArguments(?array $arguments = [])
public function addArguments(?array $arguments = []): void
{
if (null !== $arguments) {
foreach ($arguments as $argument) {
@@ -98,22 +92,20 @@ class InputDefinition
}
/**
* @return void
*
* @throws LogicException When incorrect argument is given
*/
public function addArgument(InputArgument $argument)
public function addArgument(InputArgument $argument): void
{
if (isset($this->arguments[$argument->getName()])) {
throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
throw new LogicException(\sprintf('An argument with name "%s" already exists.', $argument->getName()));
}
if (null !== $this->lastArrayArgument) {
throw new LogicException(sprintf('Cannot add a required argument "%s" after an array argument "%s".', $argument->getName(), $this->lastArrayArgument->getName()));
throw new LogicException(\sprintf('Cannot add a required argument "%s" after an array argument "%s".', $argument->getName(), $this->lastArrayArgument->getName()));
}
if ($argument->isRequired() && null !== $this->lastOptionalArgument) {
throw new LogicException(sprintf('Cannot add a required argument "%s" after an optional one "%s".', $argument->getName(), $this->lastOptionalArgument->getName()));
throw new LogicException(\sprintf('Cannot add a required argument "%s" after an optional one "%s".', $argument->getName(), $this->lastOptionalArgument->getName()));
}
if ($argument->isArray()) {
@@ -137,7 +129,7 @@ class InputDefinition
public function getArgument(string|int $name): InputArgument
{
if (!$this->hasArgument($name)) {
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
throw new InvalidArgumentException(\sprintf('The "%s" argument does not exist.', $name));
}
$arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
@@ -198,10 +190,8 @@ class InputDefinition
* Sets the InputOption objects.
*
* @param InputOption[] $options An array of InputOption objects
*
* @return void
*/
public function setOptions(array $options = [])
public function setOptions(array $options = []): void
{
$this->options = [];
$this->shortcuts = [];
@@ -213,10 +203,8 @@ class InputDefinition
* Adds an array of InputOption objects.
*
* @param InputOption[] $options An array of InputOption objects
*
* @return void
*/
public function addOptions(array $options = [])
public function addOptions(array $options = []): void
{
foreach ($options as $option) {
$this->addOption($option);
@@ -224,23 +212,21 @@ class InputDefinition
}
/**
* @return void
*
* @throws LogicException When option given already exist
*/
public function addOption(InputOption $option)
public function addOption(InputOption $option): void
{
if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
throw new LogicException(\sprintf('An option named "%s" already exists.', $option->getName()));
}
if (isset($this->negations[$option->getName()])) {
throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
throw new LogicException(\sprintf('An option named "%s" already exists.', $option->getName()));
}
if ($option->getShortcut()) {
foreach (explode('|', $option->getShortcut()) as $shortcut) {
if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
throw new LogicException(\sprintf('An option with shortcut "%s" already exists.', $shortcut));
}
}
}
@@ -255,7 +241,7 @@ class InputDefinition
if ($option->isNegatable()) {
$negatedName = 'no-'.$option->getName();
if (isset($this->options[$negatedName])) {
throw new LogicException(sprintf('An option named "%s" already exists.', $negatedName));
throw new LogicException(\sprintf('An option named "%s" already exists.', $negatedName));
}
$this->negations[$negatedName] = $option->getName();
}
@@ -269,7 +255,7 @@ class InputDefinition
public function getOption(string $name): InputOption
{
if (!$this->hasOption($name)) {
throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
throw new InvalidArgumentException(\sprintf('The "--%s" option does not exist.', $name));
}
return $this->options[$name];
@@ -343,7 +329,7 @@ class InputDefinition
public function shortcutToName(string $shortcut): string
{
if (!isset($this->shortcuts[$shortcut])) {
throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
throw new InvalidArgumentException(\sprintf('The "-%s" option does not exist.', $shortcut));
}
return $this->shortcuts[$shortcut];
@@ -359,7 +345,7 @@ class InputDefinition
public function negationToName(string $negation): string
{
if (!isset($this->negations[$negation])) {
throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $negation));
throw new InvalidArgumentException(\sprintf('The "--%s" option does not exist.', $negation));
}
return $this->negations[$negation];
@@ -378,7 +364,7 @@ class InputDefinition
foreach ($this->getOptions() as $option) {
$value = '';
if ($option->acceptValue()) {
$value = sprintf(
$value = \sprintf(
' %s%s%s',
$option->isValueOptional() ? '[' : '',
strtoupper($option->getName()),
@@ -386,9 +372,9 @@ class InputDefinition
);
}
$shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
$negation = $option->isNegatable() ? sprintf('|--no-%s', $option->getName()) : '';
$elements[] = sprintf('[%s--%s%s%s]', $shortcut, $option->getName(), $value, $negation);
$shortcut = $option->getShortcut() ? \sprintf('-%s|', $option->getShortcut()) : '';
$negation = $option->isNegatable() ? \sprintf('|--no-%s', $option->getName()) : '';
$elements[] = \sprintf('[%s--%s%s%s]', $shortcut, $option->getName(), $value, $negation);
}
}