N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)

* Update Symfony lib to version ~6.4.0
* Update code missing return type
* Add an iTop general configuration entry to store application secret (Symfony mandatory parameter)
* Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
bdalsass
2023-12-05 13:56:56 +01:00
committed by GitHub
parent 863ab4560c
commit 27ce51ab07
1392 changed files with 44869 additions and 27799 deletions

View File

@@ -16,7 +16,9 @@ use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\ExpressionLanguage\Expression;
/**
* Run this pass before passes that need to know more about the relation of
@@ -30,15 +32,17 @@ use Symfony\Component\DependencyInjection\Reference;
*/
class AnalyzeServiceReferencesPass extends AbstractRecursivePass
{
private $graph;
private $currentDefinition;
private $onlyConstructorArguments;
private $hasProxyDumper;
private $lazy;
private $byConstructor;
private $byFactory;
private $definitions;
private $aliases;
protected bool $skipScalars = true;
private ServiceReferenceGraph $graph;
private ?Definition $currentDefinition = null;
private bool $onlyConstructorArguments;
private bool $hasProxyDumper;
private bool $lazy;
private bool $byConstructor;
private bool $byFactory;
private array $definitions;
private array $aliases;
/**
* @param bool $onlyConstructorArguments Sets this Service Reference pass to ignore method calls
@@ -52,6 +56,8 @@ class AnalyzeServiceReferencesPass extends AbstractRecursivePass
/**
* Processes a ContainerBuilder object to populate the service reference graph.
*
* @return void
*/
public function process(ContainerBuilder $container)
{
@@ -76,7 +82,7 @@ class AnalyzeServiceReferencesPass extends AbstractRecursivePass
}
}
protected function processValue($value, bool $isRoot = false)
protected function processValue(mixed $value, bool $isRoot = false): mixed
{
$lazy = $this->lazy;
$inExpression = $this->inExpression();
@@ -98,7 +104,7 @@ class AnalyzeServiceReferencesPass extends AbstractRecursivePass
$targetId,
$targetDefinition,
$value,
$this->lazy || ($this->hasProxyDumper && $targetDefinition && $targetDefinition->isLazy()),
$this->lazy || ($this->hasProxyDumper && $targetDefinition?->isLazy()),
ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior(),
$this->byConstructor
);
@@ -110,7 +116,7 @@ class AnalyzeServiceReferencesPass extends AbstractRecursivePass
$targetId,
$targetDefinition,
$value,
$this->lazy || ($targetDefinition && $targetDefinition->isLazy()),
$this->lazy || $targetDefinition?->isLazy(),
true
);
}
@@ -135,8 +141,16 @@ class AnalyzeServiceReferencesPass extends AbstractRecursivePass
$byFactory = $this->byFactory;
$this->byFactory = true;
$this->processValue($value->getFactory());
if (\is_string($factory = $value->getFactory()) && str_starts_with($factory, '@=')) {
if (!class_exists(Expression::class)) {
throw new LogicException('Expressions cannot be used in service factories without the ExpressionLanguage component. Try running "composer require symfony/expression-language".');
}
$factory = new Expression(substr($factory, 2));
}
$this->processValue($factory);
$this->byFactory = $byFactory;
$this->processValue($value->getArguments());
$properties = $value->getProperties();