Skip to content

Commit f52d2c9

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: remove unneeded sprintf() call Fix CS Fix config merging in lock keep trailing newlines when dumping multi-line strings disable error bubbling by default when inherit_data is configured
2 parents 6804b09 + 88b6571 commit f52d2c9

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

DependencyInjection/Configuration.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,8 @@ private function addLockSection(ArrayNodeDefinition $rootNode)
994994
->fixXmlConfig('resource')
995995
->children()
996996
->arrayNode('resources')
997+
->normalizeKeys(false)
998+
->useAttributeAsKey('name')
997999
->requiresAtLeastOneElement()
9981000
->defaultValue(['default' => [class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphore' : 'flock']])
9991001
->beforeNormalization()
@@ -1016,6 +1018,7 @@ private function addLockSection(ArrayNodeDefinition $rootNode)
10161018
})
10171019
->end()
10181020
->prototype('array')
1021+
->performNoDeepMerging()
10191022
->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
10201023
->prototype('scalar')->end()
10211024
->end()

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,34 @@ public function provideValidLockConfigurationTests()
235235
yield [['enabled' => false, 'resource' => [['name' => 'foo', 'value' => 'flock'], ['name' => 'foo', 'value' => 'semaphore'], ['name' => 'bar', 'value' => 'semaphore']]], ['enabled' => false, 'resources' => ['foo' => ['flock', 'semaphore'], 'bar' => ['semaphore']]]];
236236
}
237237

238+
public function testLockMergeConfigs()
239+
{
240+
$processor = new Processor();
241+
$configuration = new Configuration(true);
242+
$config = $processor->processConfiguration($configuration, [
243+
[
244+
'lock' => [
245+
'payload' => 'flock',
246+
],
247+
],
248+
[
249+
'lock' => [
250+
'payload' => 'semaphore',
251+
],
252+
],
253+
]);
254+
255+
$this->assertEquals(
256+
[
257+
'enabled' => true,
258+
'resources' => [
259+
'payload' => ['semaphore'],
260+
],
261+
],
262+
$config['lock']
263+
);
264+
}
265+
238266
public function testItShowANiceMessageIfTwoMessengerBusesAreConfiguredButNoDefaultBus()
239267
{
240268
$expectedMessage = 'You must specify the "default_bus" if you define more than one bus.';

0 commit comments

Comments
 (0)