mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°5809 Update Symfony artifacts from 6.4.0 to 6.4.2
symfony/console symfony/dotenv symfony/framework-bundle symfony/http-foundation symfony/http-kernel symfony/var-dumper symfony/web-profiler-bundle
This commit is contained in:
@@ -36,10 +36,12 @@ final class Target
|
||||
return lcfirst(str_replace(' ', '', ucwords(preg_replace('/[^a-zA-Z0-9\x7f-\xff]++/', ' ', $this->name))));
|
||||
}
|
||||
|
||||
public static function parseName(\ReflectionParameter $parameter, self &$attribute = null): string
|
||||
public static function parseName(\ReflectionParameter $parameter, self &$attribute = null, string &$parsedName = null): string
|
||||
{
|
||||
$attribute = null;
|
||||
if (!$target = $parameter->getAttributes(self::class)[0] ?? null) {
|
||||
$parsedName = (new self($parameter->name))->getParsedName();
|
||||
|
||||
return $parameter->name;
|
||||
}
|
||||
|
||||
@@ -57,6 +59,6 @@ final class Target
|
||||
throw new InvalidArgumentException(sprintf('Invalid #[Target] name "%s" on parameter "$%s" of "%s()": the first character must be a letter.', $name, $parameter->name, $function));
|
||||
}
|
||||
|
||||
return $parsedName;
|
||||
return preg_match('/^[a-zA-Z0-9_\x7f-\xff]++$/', $name) ? $name : $parsedName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,20 +454,30 @@ class AutowirePass extends AbstractRecursivePass
|
||||
$name = $target = (array_filter($reference->getAttributes(), static fn ($a) => $a instanceof Target)[0] ?? null)?->name;
|
||||
|
||||
if (null !== $name ??= $reference->getName()) {
|
||||
if ($this->container->has($alias = $type.' $'.$name) && !$this->container->findDefinition($alias)->isAbstract()) {
|
||||
return new TypedReference($alias, $type, $reference->getInvalidBehavior());
|
||||
}
|
||||
|
||||
if (null !== ($alias = $this->getCombinedAlias($type, $name)) && !$this->container->findDefinition($alias)->isAbstract()) {
|
||||
return new TypedReference($alias, $type, $reference->getInvalidBehavior());
|
||||
}
|
||||
|
||||
$parsedName = (new Target($name))->getParsedName();
|
||||
|
||||
if ($this->container->has($alias = $type.' $'.$parsedName) && !$this->container->findDefinition($alias)->isAbstract()) {
|
||||
return new TypedReference($alias, $type, $reference->getInvalidBehavior());
|
||||
}
|
||||
|
||||
if (null !== ($alias = $this->getCombinedAlias($type, $parsedName) ?? null) && !$this->container->findDefinition($alias)->isAbstract()) {
|
||||
if (null !== ($alias = $this->getCombinedAlias($type, $parsedName)) && !$this->container->findDefinition($alias)->isAbstract()) {
|
||||
return new TypedReference($alias, $type, $reference->getInvalidBehavior());
|
||||
}
|
||||
|
||||
if ($this->container->has($name) && !$this->container->findDefinition($name)->isAbstract()) {
|
||||
if (($this->container->has($n = $name) && !$this->container->findDefinition($n)->isAbstract())
|
||||
|| ($this->container->has($n = $parsedName) && !$this->container->findDefinition($n)->isAbstract())
|
||||
) {
|
||||
foreach ($this->container->getAliases() as $id => $alias) {
|
||||
if ($name === (string) $alias && str_starts_with($id, $type.' $')) {
|
||||
return new TypedReference($name, $type, $reference->getInvalidBehavior());
|
||||
if ($n === (string) $alias && str_starts_with($id, $type.' $')) {
|
||||
return new TypedReference($n, $type, $reference->getInvalidBehavior());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -481,7 +491,7 @@ class AutowirePass extends AbstractRecursivePass
|
||||
return new TypedReference($type, $type, $reference->getInvalidBehavior());
|
||||
}
|
||||
|
||||
if (null !== ($alias = $this->getCombinedAlias($type) ?? null) && !$this->container->findDefinition($alias)->isAbstract()) {
|
||||
if (null !== ($alias = $this->getCombinedAlias($type)) && !$this->container->findDefinition($alias)->isAbstract()) {
|
||||
return new TypedReference($alias, $type, $reference->getInvalidBehavior());
|
||||
}
|
||||
|
||||
|
||||
@@ -190,16 +190,19 @@ class ResolveBindingsPass extends AbstractRecursivePass
|
||||
|
||||
$typeHint = ltrim(ProxyHelper::exportType($parameter) ?? '', '?');
|
||||
|
||||
$name = Target::parseName($parameter);
|
||||
$name = Target::parseName($parameter, parsedName: $parsedName);
|
||||
|
||||
if ($typeHint && \array_key_exists($k = preg_replace('/(^|[(|&])\\\\/', '\1', $typeHint).' $'.$name, $bindings)) {
|
||||
if ($typeHint && (
|
||||
\array_key_exists($k = preg_replace('/(^|[(|&])\\\\/', '\1', $typeHint).' $'.$name, $bindings)
|
||||
|| \array_key_exists($k = preg_replace('/(^|[(|&])\\\\/', '\1', $typeHint).' $'.$parsedName, $bindings)
|
||||
)) {
|
||||
$arguments[$key] = $this->getBindingValue($bindings[$k]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (\array_key_exists('$'.$name, $bindings)) {
|
||||
$arguments[$key] = $this->getBindingValue($bindings['$'.$name]);
|
||||
if (\array_key_exists($k = '$'.$name, $bindings) || \array_key_exists($k = '$'.$parsedName, $bindings)) {
|
||||
$arguments[$key] = $this->getBindingValue($bindings[$k]);
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -210,7 +213,7 @@ class ResolveBindingsPass extends AbstractRecursivePass
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($bindingNames[$name]) || isset($bindingNames[$parameter->name])) {
|
||||
if (isset($bindingNames[$name]) || isset($bindingNames[$parsedName]) || isset($bindingNames[$parameter->name])) {
|
||||
$bindingKey = array_search($binding, $bindings, true);
|
||||
$argumentType = substr($bindingKey, 0, strpos($bindingKey, ' '));
|
||||
$this->errorMessages[] = sprintf('Did you forget to add the type "%s" to argument "$%s" of method "%s::%s()"?', $argumentType, $parameter->name, $reflectionMethod->class, $reflectionMethod->name);
|
||||
|
||||
@@ -258,6 +258,7 @@ class PhpDumper extends Dumper
|
||||
<?php
|
||||
|
||||
use Symfony\Component\DependencyInjection\Argument\RewindableGenerator;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
||||
|
||||
/*{$this->docStar}
|
||||
|
||||
@@ -23,7 +23,6 @@ interface EnvVarProcessorInterface
|
||||
/**
|
||||
* Returns the value of the given variable as managed by the current instance.
|
||||
*
|
||||
* @param string $prefix The namespace of the variable
|
||||
* @param string $prefix The namespace of the variable; when the empty string is passed, null values should be kept as is
|
||||
* @param string $name The name of the variable within the namespace
|
||||
* @param \Closure(string): mixed $getEnv A closure that allows fetching more env vars
|
||||
|
||||
Reference in New Issue
Block a user