mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 17:48:43 +02:00
N°6002 - Update Symfony libs to 5.4.19
This commit is contained in:
@@ -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]; })
|
||||
|
||||
Reference in New Issue
Block a user