Skip to content

Commit 7e438da

Browse files
committed
minor #43203 [FrameworkBundle] Make the messenger.reset_on_message config option default to true (upyx)
This PR was merged into the 6.0 branch. Discussion ---------- [FrameworkBundle] Make the messenger.reset_on_message config option default to true | Q | A | ------------- | --- | Branch? | 6.0 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | no | License | MIT | Doc PR | no It changes the "framework.messenger.reset_on_message" configuration option to true and changes deprecation warnings. ~It's waiting fixes from #43202~ Commits ------- e3eecd1507 [FrameworkBundle] Make the messenger.reset_on_message config option default to true
2 parents bc14095 + b07c0f5 commit 7e438da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+22
-79
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions

DependencyInjection/Configuration.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,8 +1422,12 @@ function ($a) {
14221422
->info('Transport name to send failed messages to (after all retries have failed).')
14231423
->end()
14241424
->booleanNode('reset_on_message')
1425-
->defaultNull()
1425+
->defaultTrue()
14261426
->info('Reset container services after each message.')
1427+
->validate()
1428+
->ifTrue(static fn ($v) => true !== $v)
1429+
->thenInvalid('The "framework.messenger.reset_on_message" configuration option can be set to "true" only. To prevent services resetting after each message you can set the "--no-reset" option in "messenger:consume" command.')
1430+
->end()
14271431
->end()
14281432
->scalarNode('default_bus')->defaultNull()->end()
14291433
->arrayNode('buses')

DependencyInjection/FrameworkExtension.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,17 +2067,8 @@ private function registerMessengerConfiguration(array $config, ContainerBuilder
20672067
$container->removeDefinition('console.command.messenger_failed_messages_remove');
20682068
}
20692069

2070-
if (false === $config['reset_on_message']) {
2071-
throw new LogicException('The "framework.messenger.reset_on_message" configuration option can be set to "true" only. To prevent services resetting after each message you can set the "--no-reset" option in "messenger:consume" command.');
2072-
}
2073-
20742070
if (!$container->hasDefinition('console.command.messenger_consume_messages')) {
20752071
$container->removeDefinition('messenger.listener.reset_services');
2076-
} elseif (null === $config['reset_on_message']) {
2077-
trigger_deprecation('symfony/framework-bundle', '5.4', 'Not setting the "framework.messenger.reset_on_message" configuration option is deprecated, it will default to "true" in version 6.0.');
2078-
2079-
$container->getDefinition('console.command.messenger_consume_messages')->replaceArgument(5, null);
2080-
$container->removeDefinition('messenger.listener.reset_services');
20812072
}
20822073
}
20832074

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphor
536536
],
537537
'default_bus' => null,
538538
'buses' => ['messenger.bus.default' => ['default_middleware' => true, 'middleware' => []]],
539-
'reset_on_message' => null,
539+
'reset_on_message' => true,
540540
],
541541
'disallow_search_engine_index' => true,
542542
'http_client' => [

Tests/DependencyInjection/Fixtures/php/messenger.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
$container->loadFromExtension('framework', [
77
'messenger' => [
8-
'reset_on_message' => true,
98
'routing' => [
109
FooMessage::class => ['sender.bar', 'sender.biz'],
1110
BarMessage::class => 'sender.foo',

Tests/DependencyInjection/Fixtures/php/messenger_middleware_factory_erroneous_format.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
$container->loadFromExtension('framework', [
44
'messenger' => [
5-
'reset_on_message' => true,
65
'buses' => [
76
'command_bus' => [
87
'middleware' => [

Tests/DependencyInjection/Fixtures/php/messenger_multiple_buses.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
$container->loadFromExtension('framework', [
44
'messenger' => [
5-
'reset_on_message' => true,
65
'default_bus' => 'messenger.bus.commands',
76
'buses' => [
87
'messenger.bus.commands' => null,

Tests/DependencyInjection/Fixtures/php/messenger_multiple_failure_transports.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
$container->loadFromExtension('framework', [
44
'messenger' => [
5-
'reset_on_message' => true,
65
'transports' => [
76
'transport_1' => [
87
'dsn' => 'null://',

Tests/DependencyInjection/Fixtures/php/messenger_multiple_failure_transports_global.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
$container->loadFromExtension('framework', [
44
'messenger' => [
55
'failure_transport' => 'failure_transport_global',
6-
'reset_on_message' => true,
76
'transports' => [
87
'transport_1' => [
98
'dsn' => 'null://',

Tests/DependencyInjection/Fixtures/php/messenger_routing.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
$container->loadFromExtension('framework', [
44
'serializer' => true,
55
'messenger' => [
6-
'reset_on_message' => true,
76
'serializer' => [
87
'default_serializer' => 'messenger.transport.symfony_serializer',
98
],

0 commit comments

Comments
 (0)