reinstall dependencies on php 7.4

This commit is contained in:
Attila Jozsef Kerekes
2022-11-14 21:15:40 +01:00
parent 8972a11c0a
commit 98401f20a2
681 changed files with 65697 additions and 9274 deletions

View File

@@ -1,11 +1,6 @@
CHANGELOG
=========
6.0
---
* Remove `OptionsResolverIntrospector::getDeprecationMessage()`
5.3
---

View File

@@ -41,9 +41,11 @@ class OptionsResolverIntrospector
}
/**
* @return mixed
*
* @throws NoConfigurationException on no configured value
*/
public function getDefault(string $option): mixed
public function getDefault(string $option)
{
return ($this->get)('defaults', $option, sprintf('No default value was set for the "%s" option.', $option));
}
@@ -94,6 +96,20 @@ 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
*/

View File

@@ -32,7 +32,7 @@ final class OptionConfigurator
*
* @throws AccessException If called from a lazy option or normalizer
*/
public function allowedTypes(string ...$types): static
public function allowedTypes(string ...$types): self
{
$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(mixed ...$values): static
public function allowedValues(...$values): self
{
$this->resolver->setAllowedValues($this->name, $values);
@@ -58,11 +58,13 @@ 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(mixed $value): static
public function default($value): self
{
$this->resolver->setDefault($this->name, $value);
@@ -86,7 +88,7 @@ final class OptionConfigurator
*
* @return $this
*/
public function deprecated(string $package, string $version, string|\Closure $message = 'The option "%name%" is deprecated.'): static
public function deprecated(string $package, string $version, $message = 'The option "%name%" is deprecated.'): self
{
$this->resolver->setDeprecated($this->name, $package, $version, $message);
@@ -100,7 +102,7 @@ final class OptionConfigurator
*
* @throws AccessException If called from a lazy option or normalizer
*/
public function normalize(\Closure $normalizer): static
public function normalize(\Closure $normalizer): self
{
$this->resolver->setNormalizer($this->name, $normalizer);
@@ -114,7 +116,7 @@ final class OptionConfigurator
*
* @throws AccessException If called from a lazy option or normalizer
*/
public function required(): static
public function required(): self
{
$this->resolver->setRequired($this->name);
@@ -128,7 +130,7 @@ final class OptionConfigurator
*
* @throws AccessException If called from a lazy option or normalizer
*/
public function info(string $info): static
public function info(string $info): self
{
$this->resolver->setInfo($this->name, $info);

View File

@@ -187,11 +187,14 @@ 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, mixed $value): static
public function setDefault(string $option, $value)
{
// Setting is not possible once resolving starts, because then lazy
// options could manipulate the state of the object, leading to
@@ -262,7 +265,7 @@ class OptionsResolver implements Options
*
* @throws AccessException If called from a lazy option or normalizer
*/
public function setDefaults(array $defaults): static
public function setDefaults(array $defaults)
{
foreach ($defaults as $option => $value) {
$this->setDefault($option, $value);
@@ -276,8 +279,10 @@ 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): bool
public function hasDefault(string $option)
{
return \array_key_exists($option, $this->defaults);
}
@@ -291,7 +296,7 @@ class OptionsResolver implements Options
*
* @throws AccessException If called from a lazy option or normalizer
*/
public function setRequired(string|array $optionNames): static
public function setRequired($optionNames)
{
if ($this->locked) {
throw new AccessException('Options cannot be made required from a lazy option or normalizer.');
@@ -309,8 +314,10 @@ 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): bool
public function isRequired(string $option)
{
return isset($this->required[$option]);
}
@@ -322,7 +329,7 @@ class OptionsResolver implements Options
*
* @see isRequired()
*/
public function getRequiredOptions(): array
public function getRequiredOptions()
{
return array_keys($this->required);
}
@@ -333,8 +340,10 @@ 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): bool
public function isMissing(string $option)
{
return isset($this->required[$option]) && !\array_key_exists($option, $this->defaults);
}
@@ -344,7 +353,7 @@ class OptionsResolver implements Options
*
* @return string[]
*/
public function getMissingOptions(): array
public function getMissingOptions()
{
return array_keys(array_diff_key($this->required, $this->defaults));
}
@@ -362,7 +371,7 @@ class OptionsResolver implements Options
*
* @throws AccessException If called from a lazy option or normalizer
*/
public function setDefined(string|array $optionNames): static
public function setDefined($optionNames)
{
if ($this->locked) {
throw new AccessException('Options cannot be defined from a lazy option or normalizer.');
@@ -380,8 +389,10 @@ 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): bool
public function isDefined(string $option)
{
return isset($this->defined[$option]);
}
@@ -393,7 +404,7 @@ class OptionsResolver implements Options
*
* @see isDefined()
*/
public function getDefinedOptions(): array
public function getDefinedOptions()
{
return array_keys($this->defined);
}
@@ -426,7 +437,7 @@ class OptionsResolver implements Options
*
* @return $this
*/
public function setDeprecated(string $option, string $package, string $version, string|\Closure $message = 'The option "%name%" is deprecated.'): static
public function setDeprecated(string $option/* , string $package, string $version, $message = 'The option "%name%" is deprecated.' */): self
{
if ($this->locked) {
throw new AccessException('Options cannot be deprecated from a lazy option or normalizer.');
@@ -436,6 +447,19 @@ 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)));
}
@@ -526,7 +550,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): static
public function addNormalizer(string $option, \Closure $normalizer, bool $forcePrepend = false): self
{
if ($this->locked) {
throw new AccessException('Normalizers cannot be set from a lazy option or normalizer.');
@@ -562,14 +586,15 @@ 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 mixed $allowedValues One or more acceptable values/closures
* @param string $option The option name
* @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, mixed $allowedValues)
public function setAllowedValues(string $option, $allowedValues)
{
if ($this->locked) {
throw new AccessException('Allowed values cannot be set from a lazy option or normalizer.');
@@ -602,14 +627,15 @@ 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 mixed $allowedValues One or more acceptable values/closures
* @param string $option The option name
* @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, mixed $allowedValues)
public function addAllowedValues(string $option, $allowedValues)
{
if ($this->locked) {
throw new AccessException('Allowed values cannot be added from a lazy option or normalizer.');
@@ -649,7 +675,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, string|array $allowedTypes)
public function setAllowedTypes(string $option, $allowedTypes)
{
if ($this->locked) {
throw new AccessException('Allowed types cannot be set from a lazy option or normalizer.');
@@ -683,7 +709,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, string|array $allowedTypes)
public function addAllowedTypes(string $option, $allowedTypes)
{
if ($this->locked) {
throw new AccessException('Allowed types cannot be added from a lazy option or normalizer.');
@@ -725,7 +751,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): static
public function setInfo(string $option, string $info): self
{
if ($this->locked) {
throw new AccessException('The Info message cannot be set from a lazy option or normalizer.');
@@ -759,7 +785,7 @@ class OptionsResolver implements Options
*
* @throws AccessException If called from a lazy option, a normalizer or a root definition
*/
public function setPrototype(bool $prototype): static
public function setPrototype(bool $prototype): self
{
if ($this->locked) {
throw new AccessException('The prototype property cannot be set from a lazy option or normalizer.');
@@ -790,7 +816,7 @@ class OptionsResolver implements Options
*
* @throws AccessException If called from a lazy option or normalizer
*/
public function remove(string|array $optionNames): static
public function remove($optionNames)
{
if ($this->locked) {
throw new AccessException('Options cannot be removed from a lazy option or normalizer.');
@@ -811,7 +837,7 @@ class OptionsResolver implements Options
*
* @throws AccessException If called from a lazy option or normalizer
*/
public function clear(): static
public function clear()
{
if ($this->locked) {
throw new AccessException('Options cannot be cleared from a lazy option or normalizer.');
@@ -843,6 +869,8 @@ 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
@@ -852,7 +880,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 = []): array
public function resolve(array $options = [])
{
if ($this->locked) {
throw new AccessException('Options cannot be resolved from a lazy option or normalizer.');
@@ -904,6 +932,8 @@ 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
@@ -912,7 +942,8 @@ class OptionsResolver implements Options
* @throws OptionDefinitionException If there is a cyclic dependency between
* lazy options and/or normalizers
*/
public function offsetGet(mixed $option, bool $triggerDeprecation = true): mixed
#[\ReturnTypeWillChange]
public function offsetGet($option, bool $triggerDeprecation = true)
{
if (!$this->locked) {
throw new AccessException('Array access is only supported within closures of lazy options and normalizers.');
@@ -1132,9 +1163,9 @@ class OptionsResolver implements Options
return $value;
}
private function verifyTypes(string $type, mixed $value, array &$invalidTypes, int $level = 0): bool
private function verifyTypes(string $type, $value, array &$invalidTypes, int $level = 0): bool
{
if (\is_array($value) && str_ends_with($type, '[]')) {
if (\is_array($value) && '[]' === substr($type, -2)) {
$type = substr($type, 0, -2);
$valid = true;
@@ -1161,11 +1192,16 @@ 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()
*/
public function offsetExists(mixed $option): bool
#[\ReturnTypeWillChange]
public function offsetExists($option)
{
if (!$this->locked) {
throw new AccessException('Array access is only supported within closures of lazy options and normalizers.');
@@ -1177,9 +1213,12 @@ class OptionsResolver implements Options
/**
* Not supported.
*
* @return void
*
* @throws AccessException
*/
public function offsetSet(mixed $option, mixed $value): void
#[\ReturnTypeWillChange]
public function offsetSet($option, $value)
{
throw new AccessException('Setting options via array access is not supported. Use setDefault() instead.');
}
@@ -1187,9 +1226,12 @@ class OptionsResolver implements Options
/**
* Not supported.
*
* @return void
*
* @throws AccessException
*/
public function offsetUnset(mixed $option): void
#[\ReturnTypeWillChange]
public function offsetUnset($option)
{
throw new AccessException('Removing options via array access is not supported. Use remove() instead.');
}
@@ -1199,11 +1241,14 @@ 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()
*/
public function count(): int
#[\ReturnTypeWillChange]
public function count()
{
if (!$this->locked) {
throw new AccessException('Counting is only supported within closures of lazy options and normalizers.');
@@ -1218,8 +1263,10 @@ 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(mixed $value): string
private function formatValue($value): string
{
if (\is_object($value)) {
return \get_class($value);

View File

@@ -16,8 +16,10 @@
}
],
"require": {
"php": ">=8.1",
"symfony/deprecation-contracts": "^2.1|^3"
"php": ">=7.2.5",
"symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-php73": "~1.0",
"symfony/polyfill-php80": "^1.16"
},
"autoload": {
"psr-4": { "Symfony\\Component\\OptionsResolver\\": "" },