chore: update dependencies

This commit is contained in:
Jay Trees 2024-08-24 16:17:49 +02:00
parent 30123b24d3
commit 8142cc3977
1219 changed files with 25379 additions and 15428 deletions

View file

@ -20,7 +20,6 @@ use Symfony\Component\Console\Exception\InvalidArgumentException;
*/
class ChoiceQuestion extends Question
{
private array $choices;
private bool $multiselect = false;
private string $prompt = ' > ';
private string $errorMessage = 'Value "%s" is invalid';
@ -30,15 +29,17 @@ class ChoiceQuestion extends Question
* @param array $choices The list of available choices
* @param mixed $default The default answer to return
*/
public function __construct(string $question, array $choices, mixed $default = null)
{
public function __construct(
string $question,
private array $choices,
mixed $default = null,
) {
if (!$choices) {
throw new \LogicException('Choice question must have at least 1 choice available.');
}
parent::__construct($question, $default);
$this->choices = $choices;
$this->setValidator($this->getDefaultValidator());
$this->setAutocompleterValues($choices);
}

View file

@ -18,18 +18,18 @@ namespace Symfony\Component\Console\Question;
*/
class ConfirmationQuestion extends Question
{
private string $trueAnswerRegex;
/**
* @param string $question The question to ask to the user
* @param bool $default The default answer to return, true or false
* @param string $trueAnswerRegex A regex to match the "yes" answer
*/
public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y/i')
{
public function __construct(
string $question,
bool $default = true,
private string $trueAnswerRegex = '/^y/i',
) {
parent::__construct($question, $default);
$this->trueAnswerRegex = $trueAnswerRegex;
$this->setNormalizer($this->getDefaultNormalizer());
}

View file

@ -21,13 +21,11 @@ use Symfony\Component\Console\Exception\LogicException;
*/
class Question
{
private string $question;
private ?int $attempts = null;
private bool $hidden = false;
private bool $hiddenFallback = true;
private ?\Closure $autocompleterCallback = null;
private ?\Closure $validator = null;
private string|int|bool|null|float $default;
private ?\Closure $normalizer = null;
private bool $trimmable = true;
private bool $multiline = false;
@ -36,10 +34,10 @@ 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)
{
$this->question = $question;
$this->default = $default;
public function __construct(
private string $question,
private string|bool|int|float|null $default = null,
) {
}
/**
@ -175,11 +173,8 @@ class Question
*
* @return $this
*/
public function setAutocompleterCallback(callable $callback = null): static
public function setAutocompleterCallback(?callable $callback): static
{
if (1 > \func_num_args()) {
trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
}
if ($this->hidden && null !== $callback) {
throw new LogicException('A hidden question cannot use the autocompleter.');
}
@ -194,11 +189,8 @@ class Question
*
* @return $this
*/
public function setValidator(callable $validator = null): static
public function setValidator(?callable $validator): static
{
if (1 > \func_num_args()) {
trigger_deprecation('symfony/console', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
}
$this->validator = null === $validator ? null : $validator(...);
return $this;
@ -266,10 +258,7 @@ class Question
return $this->normalizer;
}
/**
* @return bool
*/
protected function isAssoc(array $array)
protected function isAssoc(array $array): bool
{
return (bool) \count(array_filter(array_keys($array), 'is_string'));
}