composer update

This commit is contained in:
2026-07-29 16:32:25 +02:00
parent 1ede9cc3af
commit 8ad8d279e6
1156 changed files with 22791 additions and 22591 deletions
+8 -8
View File
@@ -26,11 +26,11 @@ class ChoiceQuestion extends Question
private string $errorMessage = 'Value "%s" is invalid';
/**
* @param string $question The question to ask to the user
* @param array $choices The list of available choices
* @param mixed $default The default answer to return
* @param string $question The question to ask to the user
* @param array<string|bool|int|float|\Stringable> $choices The list of available choices
* @param string|bool|int|float|null $default The default answer to return
*/
public function __construct(string $question, array $choices, mixed $default = null)
public function __construct(string $question, array $choices, string|bool|int|float|null $default = null)
{
if (!$choices) {
throw new \LogicException('Choice question must have at least 1 choice available.');
@@ -44,7 +44,7 @@ class ChoiceQuestion extends Question
}
/**
* Returns available choices.
* @return array<string|bool|int|float|\Stringable>
*/
public function getChoices(): array
{
@@ -120,7 +120,7 @@ class ChoiceQuestion extends Question
if ($multiselect) {
// Check for a separated comma values
if (!preg_match('/^[^,]+(?:,[^,]+)*$/', (string) $selected, $matches)) {
throw new InvalidArgumentException(sprintf($errorMessage, $selected));
throw new InvalidArgumentException(\sprintf($errorMessage, $selected));
}
$selectedChoices = explode(',', (string) $selected);
@@ -144,7 +144,7 @@ class ChoiceQuestion extends Question
}
if (\count($results) > 1) {
throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of "%s".', implode('" or "', $results)));
throw new InvalidArgumentException(\sprintf('The provided answer is ambiguous. Value should be one of "%s".', implode('" or "', $results)));
}
$result = array_search($value, $choices);
@@ -160,7 +160,7 @@ class ChoiceQuestion extends Question
}
if (false === $result) {
throw new InvalidArgumentException(sprintf($errorMessage, $value));
throw new InvalidArgumentException(\sprintf($errorMessage, $value));
}
// For associative choices, consistently return the key as string:
+1 -1
View File
@@ -41,7 +41,7 @@ class ConfirmationQuestion extends Question
$default = $this->getDefault();
$regex = $this->trueAnswerRegex;
return function ($answer) use ($default, $regex) {
return static function ($answer) use ($default, $regex) {
if (\is_bool($answer)) {
return $answer;
}
+11 -9
View File
@@ -27,7 +27,7 @@ class Question
private bool $hiddenFallback = true;
private ?\Closure $autocompleterCallback = null;
private ?\Closure $validator = null;
private string|int|bool|null|float $default;
private string|int|bool|float|null $default;
private ?\Closure $normalizer = null;
private bool $trimmable = true;
private bool $multiline = false;
@@ -36,7 +36,7 @@ class Question
* @param string $question The question to ask to the user
* @param string|bool|int|float|null $default The default answer to return if the user enters nothing
*/
public function __construct(string $question, string|bool|int|float $default = null)
public function __construct(string $question, string|bool|int|float|null $default = null)
{
$this->question = $question;
$this->default = $default;
@@ -146,12 +146,11 @@ class Question
if (\is_array($values)) {
$values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
$callback = static function () use ($values) {
return $values;
};
$callback = static fn () => $values;
} elseif ($values instanceof \Traversable) {
$valueCache = null;
$callback = static function () use ($values, &$valueCache) {
$callback = static function () use ($values) {
static $valueCache;
return $valueCache ??= iterator_to_array($values, false);
};
} else {
@@ -176,7 +175,7 @@ class Question
*
* @return $this
*/
public function setAutocompleterCallback(callable $callback = null): static
public function setAutocompleterCallback(?callable $callback = null): static
{
if (1 > \func_num_args()) {
trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
@@ -195,7 +194,7 @@ class Question
*
* @return $this
*/
public function setValidator(callable $validator = null): static
public function setValidator(?callable $validator = null): static
{
if (1 > \func_num_args()) {
trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
@@ -267,6 +266,9 @@ class Question
return $this->normalizer;
}
/**
* @return bool
*/
protected function isAssoc(array $array)
{
return (bool) \count(array_filter(array_keys($array), 'is_string'));