Skip to content

Commit 6ac78b6

Browse files
committed
Merge branch '5.1' into 5.2
* 5.1: 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 061b236 + f52d2c9 commit 6ac78b6

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
@@ -1118,6 +1118,8 @@ private function addLockSection(ArrayNodeDefinition $rootNode)
11181118
->fixXmlConfig('resource')
11191119
->children()
11201120
->arrayNode('resources')
1121+
->normalizeKeys(false)
1122+
->useAttributeAsKey('name')
11211123
->requiresAtLeastOneElement()
11221124
->defaultValue(['default' => [class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphore' : 'flock']])
11231125
->beforeNormalization()
@@ -1140,6 +1142,7 @@ private function addLockSection(ArrayNodeDefinition $rootNode)
11401142
})
11411143
->end()
11421144
->prototype('array')
1145+
->performNoDeepMerging()
11431146
->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
11441147
->prototype('scalar')->end()
11451148
->end()

Tests/DependencyInjection/ConfigurationTest.php

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

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

0 commit comments

Comments
 (0)