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

@@ -17,43 +17,19 @@ use Symfony\Component\DependencyInjection\Reference;
final class AliasDeprecatedPublicServicesPass extends AbstractRecursivePass
{
private $tagName;
protected bool $skipScalars = true;
private $aliases = [];
private array $aliases = [];
public function __construct(string $tagName = 'container.private')
public function process(ContainerBuilder $container): void
{
if (0 < \func_num_args()) {
trigger_deprecation('symfony/dependency-injection', '5.3', 'Configuring "%s" is deprecated.', __CLASS__);
}
$this->tagName = $tagName;
}
/**
* {@inheritdoc}
*/
protected function processValue($value, bool $isRoot = false)
{
if ($value instanceof Reference && isset($this->aliases[$id = (string) $value])) {
return new Reference($this->aliases[$id], $value->getInvalidBehavior());
}
return parent::processValue($value, $isRoot);
}
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
foreach ($container->findTaggedServiceIds($this->tagName) as $id => $tags) {
foreach ($container->findTaggedServiceIds('container.private') as $id => $tags) {
if (null === $package = $tags[0]['package'] ?? null) {
throw new InvalidArgumentException(sprintf('The "package" attribute is mandatory for the "%s" tag on the "%s" service.', $this->tagName, $id));
throw new InvalidArgumentException(sprintf('The "package" attribute is mandatory for the "container.private" tag on the "%s" service.', $id));
}
if (null === $version = $tags[0]['version'] ?? null) {
throw new InvalidArgumentException(sprintf('The "version" attribute is mandatory for the "%s" tag on the "%s" service.', $this->tagName, $id));
throw new InvalidArgumentException(sprintf('The "version" attribute is mandatory for the "container.private" tag on the "%s" service.', $id));
}
$definition = $container->getDefinition($id);
@@ -62,7 +38,7 @@ final class AliasDeprecatedPublicServicesPass extends AbstractRecursivePass
}
$container
->setAlias($id, $aliasId = '.'.$this->tagName.'.'.$id)
->setAlias($id, $aliasId = '.container.private.'.$id)
->setPublic(true)
->setDeprecated($package, $version, 'Accessing the "%alias_id%" service directly from the container is deprecated, use dependency injection instead.');
@@ -73,4 +49,13 @@ final class AliasDeprecatedPublicServicesPass extends AbstractRecursivePass
parent::process($container);
}
protected function processValue(mixed $value, bool $isRoot = false): mixed
{
if ($value instanceof Reference && isset($this->aliases[$id = (string) $value])) {
return new Reference($this->aliases[$id], $value->getInvalidBehavior());
}
return parent::processValue($value, $isRoot);
}
}