mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-09 00:13:58 +09:00
Update dependencies
This commit is contained in:
5
vendor/symfony/options-resolver/CHANGELOG.md
vendored
5
vendor/symfony/options-resolver/CHANGELOG.md
vendored
@@ -1,6 +1,11 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
6.0
|
||||
---
|
||||
|
||||
* Remove `OptionsResolverIntrospector::getDeprecationMessage()`
|
||||
|
||||
5.3
|
||||
---
|
||||
|
||||
|
||||
@@ -41,11 +41,9 @@ class OptionsResolverIntrospector
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*
|
||||
* @throws NoConfigurationException on no configured value
|
||||
*/
|
||||
public function getDefault(string $option)
|
||||
public function getDefault(string $option): mixed
|
||||
{
|
||||
return ($this->get)('defaults', $option, sprintf('No default value was set for the "%s" option.', $option));
|
||||
}
|
||||
@@ -96,20 +94,6 @@ class OptionsResolverIntrospector
|
||||
return ($this->get)('normalizers', $option, sprintf('No normalizer was set for the "%s" option.', $option));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|\Closure
|
||||
*
|
||||
* @throws NoConfigurationException on no configured deprecation
|
||||
*
|
||||
* @deprecated since Symfony 5.1, use "getDeprecation()" instead.
|
||||
*/
|
||||
public function getDeprecationMessage(string $option)
|
||||
{
|
||||
trigger_deprecation('symfony/options-resolver', '5.1', 'The "%s()" method is deprecated, use "getDeprecation()" instead.', __METHOD__);
|
||||
|
||||
return $this->getDeprecation($option)['message'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws NoConfigurationException on no configured deprecation
|
||||
*/
|
||||
|
||||
@@ -32,7 +32,7 @@ final class OptionConfigurator
|
||||
*
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function allowedTypes(string ...$types): self
|
||||
public function allowedTypes(string ...$types): static
|
||||
{
|
||||
$this->resolver->setAllowedTypes($this->name, $types);
|
||||
|
||||
@@ -48,7 +48,7 @@ final class OptionConfigurator
|
||||
*
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function allowedValues(...$values): self
|
||||
public function allowedValues(mixed ...$values): static
|
||||
{
|
||||
$this->resolver->setAllowedValues($this->name, $values);
|
||||
|
||||
@@ -58,13 +58,11 @@ final class OptionConfigurator
|
||||
/**
|
||||
* Sets the default value for this option.
|
||||
*
|
||||
* @param mixed $value The default value of the option
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function default($value): self
|
||||
public function default(mixed $value): static
|
||||
{
|
||||
$this->resolver->setDefault($this->name, $value);
|
||||
|
||||
@@ -88,7 +86,7 @@ final class OptionConfigurator
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function deprecated(string $package, string $version, $message = 'The option "%name%" is deprecated.'): self
|
||||
public function deprecated(string $package, string $version, string|\Closure $message = 'The option "%name%" is deprecated.'): static
|
||||
{
|
||||
$this->resolver->setDeprecated($this->name, $package, $version, $message);
|
||||
|
||||
@@ -102,7 +100,7 @@ final class OptionConfigurator
|
||||
*
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function normalize(\Closure $normalizer): self
|
||||
public function normalize(\Closure $normalizer): static
|
||||
{
|
||||
$this->resolver->setNormalizer($this->name, $normalizer);
|
||||
|
||||
@@ -116,7 +114,7 @@ final class OptionConfigurator
|
||||
*
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function required(): self
|
||||
public function required(): static
|
||||
{
|
||||
$this->resolver->setRequired($this->name);
|
||||
|
||||
@@ -130,7 +128,7 @@ final class OptionConfigurator
|
||||
*
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function info(string $info): self
|
||||
public function info(string $info): static
|
||||
{
|
||||
$this->resolver->setInfo($this->name, $info);
|
||||
|
||||
|
||||
111
vendor/symfony/options-resolver/OptionsResolver.php
vendored
111
vendor/symfony/options-resolver/OptionsResolver.php
vendored
@@ -187,14 +187,11 @@ class OptionsResolver implements Options
|
||||
* // 'default' === $parent['connection']
|
||||
* }
|
||||
*
|
||||
* @param string $option The name of the option
|
||||
* @param mixed $value The default value of the option
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function setDefault(string $option, $value)
|
||||
public function setDefault(string $option, mixed $value): static
|
||||
{
|
||||
// Setting is not possible once resolving starts, because then lazy
|
||||
// options could manipulate the state of the object, leading to
|
||||
@@ -265,7 +262,7 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function setDefaults(array $defaults)
|
||||
public function setDefaults(array $defaults): static
|
||||
{
|
||||
foreach ($defaults as $option => $value) {
|
||||
$this->setDefault($option, $value);
|
||||
@@ -279,10 +276,8 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* Returns true if {@link setDefault()} was called for this option.
|
||||
* An option is also considered set if it was set to null.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDefault(string $option)
|
||||
public function hasDefault(string $option): bool
|
||||
{
|
||||
return \array_key_exists($option, $this->defaults);
|
||||
}
|
||||
@@ -296,7 +291,7 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function setRequired($optionNames)
|
||||
public function setRequired(string|array $optionNames): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
throw new AccessException('Options cannot be made required from a lazy option or normalizer.');
|
||||
@@ -314,10 +309,8 @@ class OptionsResolver implements Options
|
||||
* Returns whether an option is required.
|
||||
*
|
||||
* An option is required if it was passed to {@link setRequired()}.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isRequired(string $option)
|
||||
public function isRequired(string $option): bool
|
||||
{
|
||||
return isset($this->required[$option]);
|
||||
}
|
||||
@@ -329,7 +322,7 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* @see isRequired()
|
||||
*/
|
||||
public function getRequiredOptions()
|
||||
public function getRequiredOptions(): array
|
||||
{
|
||||
return array_keys($this->required);
|
||||
}
|
||||
@@ -340,10 +333,8 @@ class OptionsResolver implements Options
|
||||
* An option is missing if it was passed to {@link setRequired()}, but not
|
||||
* to {@link setDefault()}. This option must be passed explicitly to
|
||||
* {@link resolve()}, otherwise an exception will be thrown.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isMissing(string $option)
|
||||
public function isMissing(string $option): bool
|
||||
{
|
||||
return isset($this->required[$option]) && !\array_key_exists($option, $this->defaults);
|
||||
}
|
||||
@@ -353,7 +344,7 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getMissingOptions()
|
||||
public function getMissingOptions(): array
|
||||
{
|
||||
return array_keys(array_diff_key($this->required, $this->defaults));
|
||||
}
|
||||
@@ -371,7 +362,7 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function setDefined($optionNames)
|
||||
public function setDefined(string|array $optionNames): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
throw new AccessException('Options cannot be defined from a lazy option or normalizer.');
|
||||
@@ -389,10 +380,8 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* Returns true for any option passed to {@link setDefault()},
|
||||
* {@link setRequired()} or {@link setDefined()}.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDefined(string $option)
|
||||
public function isDefined(string $option): bool
|
||||
{
|
||||
return isset($this->defined[$option]);
|
||||
}
|
||||
@@ -404,7 +393,7 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* @see isDefined()
|
||||
*/
|
||||
public function getDefinedOptions()
|
||||
public function getDefinedOptions(): array
|
||||
{
|
||||
return array_keys($this->defined);
|
||||
}
|
||||
@@ -437,7 +426,7 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDeprecated(string $option/* , string $package, string $version, $message = 'The option "%name%" is deprecated.' */): self
|
||||
public function setDeprecated(string $option, string $package, string $version, string|\Closure $message = 'The option "%name%" is deprecated.'): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
throw new AccessException('Options cannot be deprecated from a lazy option or normalizer.');
|
||||
@@ -447,19 +436,6 @@ class OptionsResolver implements Options
|
||||
throw new UndefinedOptionsException(sprintf('The option "%s" does not exist, defined options are: "%s".', $this->formatOptions([$option]), implode('", "', array_keys($this->defined))));
|
||||
}
|
||||
|
||||
$args = \func_get_args();
|
||||
|
||||
if (\func_num_args() < 3) {
|
||||
trigger_deprecation('symfony/options-resolver', '5.1', 'The signature of method "%s()" requires 2 new arguments: "string $package, string $version", not defining them is deprecated.', __METHOD__);
|
||||
|
||||
$message = $args[1] ?? 'The option "%name%" is deprecated.';
|
||||
$package = $version = '';
|
||||
} else {
|
||||
$package = $args[1];
|
||||
$version = $args[2];
|
||||
$message = $args[3] ?? 'The option "%name%" is deprecated.';
|
||||
}
|
||||
|
||||
if (!\is_string($message) && !$message instanceof \Closure) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid type for deprecation message argument, expected string or \Closure, but got "%s".', get_debug_type($message)));
|
||||
}
|
||||
@@ -550,7 +526,7 @@ class OptionsResolver implements Options
|
||||
* @throws UndefinedOptionsException If the option is undefined
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function addNormalizer(string $option, \Closure $normalizer, bool $forcePrepend = false): self
|
||||
public function addNormalizer(string $option, \Closure $normalizer, bool $forcePrepend = false): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
throw new AccessException('Normalizers cannot be set from a lazy option or normalizer.');
|
||||
@@ -586,15 +562,14 @@ class OptionsResolver implements Options
|
||||
* The closure receives the value as argument and should return true to
|
||||
* accept the value and false to reject the value.
|
||||
*
|
||||
* @param string $option The option name
|
||||
* @param mixed $allowedValues One or more acceptable values/closures
|
||||
* @param mixed $allowedValues One or more acceptable values/closures
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws UndefinedOptionsException If the option is undefined
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function setAllowedValues(string $option, $allowedValues)
|
||||
public function setAllowedValues(string $option, mixed $allowedValues)
|
||||
{
|
||||
if ($this->locked) {
|
||||
throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.');
|
||||
@@ -627,15 +602,14 @@ class OptionsResolver implements Options
|
||||
* The closure receives the value as argument and should return true to
|
||||
* accept the value and false to reject the value.
|
||||
*
|
||||
* @param string $option The option name
|
||||
* @param mixed $allowedValues One or more acceptable values/closures
|
||||
* @param mixed $allowedValues One or more acceptable values/closures
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws UndefinedOptionsException If the option is undefined
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function addAllowedValues(string $option, $allowedValues)
|
||||
public function addAllowedValues(string $option, mixed $allowedValues)
|
||||
{
|
||||
if ($this->locked) {
|
||||
throw new AccessException('Allowed values cannot be added from a lazy option or normalizer.');
|
||||
@@ -675,7 +649,7 @@ class OptionsResolver implements Options
|
||||
* @throws UndefinedOptionsException If the option is undefined
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function setAllowedTypes(string $option, $allowedTypes)
|
||||
public function setAllowedTypes(string $option, string|array $allowedTypes)
|
||||
{
|
||||
if ($this->locked) {
|
||||
throw new AccessException('Allowed types cannot be set from a lazy option or normalizer.');
|
||||
@@ -709,7 +683,7 @@ class OptionsResolver implements Options
|
||||
* @throws UndefinedOptionsException If the option is undefined
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function addAllowedTypes(string $option, $allowedTypes)
|
||||
public function addAllowedTypes(string $option, string|array $allowedTypes)
|
||||
{
|
||||
if ($this->locked) {
|
||||
throw new AccessException('Allowed types cannot be added from a lazy option or normalizer.');
|
||||
@@ -751,7 +725,7 @@ class OptionsResolver implements Options
|
||||
* @throws UndefinedOptionsException If the option is undefined
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function setInfo(string $option, string $info): self
|
||||
public function setInfo(string $option, string $info): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
throw new AccessException('The Info message cannot be set from a lazy option or normalizer.');
|
||||
@@ -785,7 +759,7 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* @throws AccessException If called from a lazy option, a normalizer or a root definition
|
||||
*/
|
||||
public function setPrototype(bool $prototype): self
|
||||
public function setPrototype(bool $prototype): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
throw new AccessException('The prototype property cannot be set from a lazy option or normalizer.');
|
||||
@@ -816,7 +790,7 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function remove($optionNames)
|
||||
public function remove(string|array $optionNames): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
throw new AccessException('Options cannot be removed from a lazy option or normalizer.');
|
||||
@@ -837,7 +811,7 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function clear()
|
||||
public function clear(): static
|
||||
{
|
||||
if ($this->locked) {
|
||||
throw new AccessException('Options cannot be cleared from a lazy option or normalizer.');
|
||||
@@ -869,8 +843,6 @@ class OptionsResolver implements Options
|
||||
* - Options have invalid types;
|
||||
* - Options have invalid values.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws UndefinedOptionsException If an option name is undefined
|
||||
* @throws InvalidOptionsException If an option doesn't fulfill the
|
||||
* specified validation rules
|
||||
@@ -880,7 +852,7 @@ class OptionsResolver implements Options
|
||||
* @throws NoSuchOptionException If a lazy option reads an unavailable option
|
||||
* @throws AccessException If called from a lazy option or normalizer
|
||||
*/
|
||||
public function resolve(array $options = [])
|
||||
public function resolve(array $options = []): array
|
||||
{
|
||||
if ($this->locked) {
|
||||
throw new AccessException('Options cannot be resolved from a lazy option or normalizer.');
|
||||
@@ -932,8 +904,6 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* @param bool $triggerDeprecation Whether to trigger the deprecation or not (true by default)
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws AccessException If accessing this method outside of
|
||||
* {@link resolve()}
|
||||
* @throws NoSuchOptionException If the option is not set
|
||||
@@ -942,8 +912,7 @@ class OptionsResolver implements Options
|
||||
* @throws OptionDefinitionException If there is a cyclic dependency between
|
||||
* lazy options and/or normalizers
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($option, bool $triggerDeprecation = true)
|
||||
public function offsetGet(mixed $option, bool $triggerDeprecation = true): mixed
|
||||
{
|
||||
if (!$this->locked) {
|
||||
throw new AccessException('Array access is only supported within closures of lazy options and normalizers.');
|
||||
@@ -1163,9 +1132,9 @@ class OptionsResolver implements Options
|
||||
return $value;
|
||||
}
|
||||
|
||||
private function verifyTypes(string $type, $value, array &$invalidTypes, int $level = 0): bool
|
||||
private function verifyTypes(string $type, mixed $value, array &$invalidTypes, int $level = 0): bool
|
||||
{
|
||||
if (\is_array($value) && '[]' === substr($type, -2)) {
|
||||
if (\is_array($value) && str_ends_with($type, '[]')) {
|
||||
$type = substr($type, 0, -2);
|
||||
$valid = true;
|
||||
|
||||
@@ -1192,16 +1161,11 @@ class OptionsResolver implements Options
|
||||
/**
|
||||
* Returns whether a resolved option with the given name exists.
|
||||
*
|
||||
* @param string $option The option name
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws AccessException If accessing this method outside of {@link resolve()}
|
||||
*
|
||||
* @see \ArrayAccess::offsetExists()
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists($option)
|
||||
public function offsetExists(mixed $option): bool
|
||||
{
|
||||
if (!$this->locked) {
|
||||
throw new AccessException('Array access is only supported within closures of lazy options and normalizers.');
|
||||
@@ -1213,12 +1177,9 @@ class OptionsResolver implements Options
|
||||
/**
|
||||
* Not supported.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws AccessException
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($option, $value)
|
||||
public function offsetSet(mixed $option, mixed $value): void
|
||||
{
|
||||
throw new AccessException('Setting options via array access is not supported. Use setDefault() instead.');
|
||||
}
|
||||
@@ -1226,12 +1187,9 @@ class OptionsResolver implements Options
|
||||
/**
|
||||
* Not supported.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws AccessException
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($option)
|
||||
public function offsetUnset(mixed $option): void
|
||||
{
|
||||
throw new AccessException('Removing options via array access is not supported. Use remove() instead.');
|
||||
}
|
||||
@@ -1241,14 +1199,11 @@ class OptionsResolver implements Options
|
||||
*
|
||||
* This may be only a subset of the defined options.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws AccessException If accessing this method outside of {@link resolve()}
|
||||
*
|
||||
* @see \Countable::count()
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
public function count(): int
|
||||
{
|
||||
if (!$this->locked) {
|
||||
throw new AccessException('Counting is only supported within closures of lazy options and normalizers.');
|
||||
@@ -1263,10 +1218,8 @@ class OptionsResolver implements Options
|
||||
* This method returns the equivalent PHP tokens for most scalar types
|
||||
* (i.e. "false" for false, "1" for 1 etc.). Strings are always wrapped
|
||||
* in double quotes (").
|
||||
*
|
||||
* @param mixed $value The value to format as string
|
||||
*/
|
||||
private function formatValue($value): string
|
||||
private function formatValue(mixed $value): string
|
||||
{
|
||||
if (\is_object($value)) {
|
||||
return \get_class($value);
|
||||
|
||||
@@ -16,10 +16,8 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"symfony/deprecation-contracts": "^2.1|^3",
|
||||
"symfony/polyfill-php73": "~1.0",
|
||||
"symfony/polyfill-php80": "^1.16"
|
||||
"php": ">=8.1",
|
||||
"symfony/deprecation-contracts": "^2.1|^3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Component\\OptionsResolver\\": "" },
|
||||
|
||||
Reference in New Issue
Block a user