N°6002 - Update Symfony libs to 5.4.19

This commit is contained in:
Molkobain
2023-02-22 18:19:56 +01:00
parent 5ee603f2ba
commit d997e36de0
43 changed files with 337 additions and 228 deletions

View File

@@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
@@ -38,6 +39,16 @@ class TestServiceContainerRealRefPass implements CompilerPassInterface
}
}
foreach ($container->getAliases() as $id => $target) {
while ($container->hasAlias($target = (string) $target)) {
$target = $container->getAlias($target);
}
if ($definitions[$target]->hasTag('container.private')) {
$privateServices[$id] = new ServiceClosureArgument(new Reference($target));
}
}
$privateContainer->replaceArgument(0, $privateServices);
}
}

View File

@@ -1121,7 +1121,7 @@ class Configuration implements ConfigurationInterface
->booleanNode('public')->defaultFalse()->end()
->scalarNode('default_lifetime')
->info('Default lifetime of the pool')
->example('"600" for 5 minutes expressed in seconds, "PT5M" for five minutes expressed as ISO 8601 time interval, or "5 minutes" as a date expression')
->example('"300" for 5 minutes expressed in seconds, "PT5M" for five minutes expressed as ISO 8601 time interval, or "5 minutes" as a date expression')
->end()
->scalarNode('provider')
->info('Overwrite the setting from the default provider for this adapter.')
@@ -1194,48 +1194,48 @@ class Configuration implements ConfigurationInterface
$logLevels = (new \ReflectionClass(LogLevel::class))->getConstants();
$rootNode
->fixXmlConfig('exception')
->children()
->arrayNode('exceptions')
->info('Exception handling configuration')
->useAttributeAsKey('class')
->beforeNormalization()
// Handle legacy XML configuration
->ifArray()
->then(function (array $v): array {
if (!\array_key_exists('exception', $v)) {
return $v;
}
// Fix XML normalization
$data = isset($v['exception'][0]) ? $v['exception'] : [$v['exception']];
$exceptions = [];
foreach ($data as $exception) {
$config = [];
if (\array_key_exists('log-level', $exception)) {
$config['log_level'] = $exception['log-level'];
}
if (\array_key_exists('status-code', $exception)) {
$config['status_code'] = $exception['status-code'];
}
$exceptions[$exception['name']] = $config;
$v = $v['exception'];
unset($v['exception']);
foreach ($v as &$exception) {
$exception['class'] = $exception['name'];
unset($exception['name']);
}
return $exceptions;
return $v;
})
->end()
->prototype('array')
->fixXmlConfig('exception')
->children()
->scalarNode('log_level')
->info('The level of log message. Null to let Symfony decide.')
->validate()
->ifTrue(function ($v) use ($logLevels) { return !\in_array($v, $logLevels); })
->ifTrue(function ($v) use ($logLevels) { return null !== $v && !\in_array($v, $logLevels, true); })
->thenInvalid(sprintf('The log level is not valid. Pick one among "%s".', implode('", "', $logLevels)))
->end()
->defaultNull()
->end()
->scalarNode('status_code')
->info('The status code of the response. Null to let Symfony decide.')
->info('The status code of the response. Null or 0 to let Symfony decide.')
->beforeNormalization()
->ifTrue(function ($v) { return 0 === $v; })
->then(function ($v) { return null; })
->end()
->validate()
->ifTrue(function ($v) { return $v < 100 || $v > 599; })
->ifTrue(function ($v) { return null !== $v && ($v < 100 || $v > 599); })
->thenInvalid('The status code is not valid. Pick a value between 100 and 599.')
->end()
->defaultNull()
@@ -1271,12 +1271,15 @@ class Configuration implements ConfigurationInterface
})
->end()
->addDefaultsIfNotSet()
->validate()
->ifTrue(static function (array $config) { return $config['enabled'] && !$config['resources']; })
->thenInvalid('At least one resource must be defined.')
->end()
->fixXmlConfig('resource')
->children()
->arrayNode('resources')
->normalizeKeys(false)
->useAttributeAsKey('name')
->requiresAtLeastOneElement()
->defaultValue(['default' => [class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphore' : 'flock']])
->beforeNormalization()
->ifString()->then(function ($v) { return ['default' => $v]; })

View File

@@ -162,8 +162,10 @@ use Symfony\Component\Notifier\Bridge\Twilio\TwilioTransportFactory;
use Symfony\Component\Notifier\Bridge\Vonage\VonageTransportFactory;
use Symfony\Component\Notifier\Bridge\Yunpian\YunpianTransportFactory;
use Symfony\Component\Notifier\Bridge\Zulip\ZulipTransportFactory;
use Symfony\Component\Notifier\ChatterInterface;
use Symfony\Component\Notifier\Notifier;
use Symfony\Component\Notifier\Recipient\Recipient;
use Symfony\Component\Notifier\TexterInterface;
use Symfony\Component\Notifier\Transport\TransportFactoryInterface as NotifierTransportFactoryInterface;
use Symfony\Component\PropertyAccess\PropertyAccessor;
use Symfony\Component\PropertyInfo\Extractor\PhpStanExtractor;
@@ -1629,9 +1631,16 @@ class FrameworkExtension extends Extension
$loader->load('annotations.php');
// registerUniqueLoader exists since doctrine/annotations v1.6
if (!method_exists(AnnotationRegistry::class, 'registerUniqueLoader')) {
$container->getDefinition('annotations.dummy_registry')
->setMethodCalls([['registerLoader', ['class_exists']]]);
// registerLoader exists only in doctrine/annotations v1
if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
$container->getDefinition('annotations.dummy_registry')
->setMethodCalls([['registerLoader', ['class_exists']]]);
} else {
// remove the dummy registry when doctrine/annotations v2 is used
$container->removeDefinition('annotations.dummy_registry');
}
}
if ('none' === $config['cache']) {
@@ -2489,11 +2498,13 @@ class FrameworkExtension extends Extension
$container->getDefinition('chatter.transports')->setArgument(0, $config['chatter_transports']);
} else {
$container->removeDefinition('chatter');
$container->removeAlias(ChatterInterface::class);
}
if ($config['texter_transports']) {
$container->getDefinition('texter.transports')->setArgument(0, $config['texter_transports']);
} else {
$container->removeDefinition('texter');
$container->removeAlias(TexterInterface::class);
}
if ($this->mailerConfigEnabled) {
@@ -2583,7 +2594,7 @@ class FrameworkExtension extends Extension
}
}
if (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', MercureTransportFactory::class, $parentPackages, true) && ContainerBuilder::willBeAvailable('symfony/mercure-bundle', MercureBundle::class, $parentPackages, true)) {
if (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', MercureTransportFactory::class, $parentPackages, true) && ContainerBuilder::willBeAvailable('symfony/mercure-bundle', MercureBundle::class, $parentPackages, true) && \in_array(MercureBundle::class, $container->getParameter('kernel.bundles'), true)) {
$container->getDefinition($classToServices[MercureTransportFactory::class])
->replaceArgument('$registry', new Reference(HubRegistry::class));
} elseif (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', MercureTransportFactory::class, $parentPackages, true)) {