bug #32309 Fixing validation for messenger transports retry_strategy service key (weaverryan)

This PR was merged into the 4.3 branch.

Discussion
----------

Fixing validation for messenger transports retry_strategy service key

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32300
| License       | MIT
| Doc PR        | not needed

Manually tested locally. `validate()` is too because the defaults are already applied.

Commits
-------

c6e18374a2 Fixing validation for messenger transports retry_strategy service key
This commit is contained in:
Fabien Potencier 2019-07-03 14:37:49 +02:00
commit 74bd8b6bca

View File

@ -1196,9 +1196,14 @@ class Configuration implements ConfigurationInterface
->end()
->arrayNode('retry_strategy')
->addDefaultsIfNotSet()
->validate()
->ifTrue(function ($v) { return null !== $v['service'] && (isset($v['max_retries']) || isset($v['delay']) || isset($v['multiplier']) || isset($v['max_delay'])); })
->thenInvalid('"service" cannot be used along with the other retry_strategy options.')
->beforeNormalization()
->always(function ($v) {
if (isset($v['service']) && (isset($v['max_retries']) || isset($v['delay']) || isset($v['multiplier']) || isset($v['max_delay']))) {
throw new \InvalidArgumentException('The "service" cannot be used along with the other "retry_strategy" options.');
}
return $v;
})
->end()
->children()
->scalarNode('service')->defaultNull()->info('Service id to override the retry strategy entirely')->end()