Skip to content

Commit bf24319

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: 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 49a89af + 6ac78b6 commit bf24319

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
@@ -1135,6 +1135,8 @@ private function addLockSection(ArrayNodeDefinition $rootNode)
11351135
->fixXmlConfig('resource')
11361136
->children()
11371137
->arrayNode('resources')
1138+
->normalizeKeys(false)
1139+
->useAttributeAsKey('name')
11381140
->requiresAtLeastOneElement()
11391141
->defaultValue(['default' => [class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphore' : 'flock']])
11401142
->beforeNormalization()
@@ -1157,6 +1159,7 @@ private function addLockSection(ArrayNodeDefinition $rootNode)
11571159
})
11581160
->end()
11591161
->prototype('array')
1162+
->performNoDeepMerging()
11601163
->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
11611164
->prototype('scalar')->end()
11621165
->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)