Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bcdc68b

Browse filesBrowse files
[FrameworkBundle] Add support for signal plain name in the messenger.stop_worker_on_signals configuration
1 parent cad21a9 commit bcdc68b
Copy full SHA for bcdc68b

File tree

3 files changed

+15
-1
lines changed
Filter options

3 files changed

+15
-1
lines changed

‎src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ CHANGELOG
99
* Add JsonEncoder services and configuration
1010
* Add new `framework.property_info.with_constructor_extractor` option to allow enabling or disabling the constructor extractor integration
1111
* Deprecate the `--show-arguments` option of the `container:debug` command, as arguments are now always shown
12+
* Add support for signal plain name in the `messenger.stop_worker_on_signals` configuration
1213

1314
7.2
1415
---

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+13-1Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,7 @@ private function addMessengerSection(ArrayNodeDefinition $rootNode, callable $en
15731573
->{$enableIfStandalone('symfony/messenger', MessageBusInterface::class)}()
15741574
->fixXmlConfig('transport')
15751575
->fixXmlConfig('bus', 'buses')
1576+
->fixXmlConfig('stop_worker_on_signal')
15761577
->validate()
15771578
->ifTrue(fn ($v) => isset($v['buses']) && \count($v['buses']) > 1 && null === $v['default_bus'])
15781579
->thenInvalid('You must specify the "default_bus" if you define more than one bus.')
@@ -1705,7 +1706,18 @@ function ($a) {
17051706
->arrayNode('stop_worker_on_signals')
17061707
->defaultValue([])
17071708
->info('A list of signals that should stop the worker; defaults to SIGTERM and SIGINT.')
1708-
->integerPrototype()->end()
1709+
->beforeNormalization()
1710+
->always(function ($v) {
1711+
return array_map(static function ($element) {
1712+
if (\is_string($element) && str_starts_with($element, 'SIG') && \array_key_exists($element, get_defined_constants(true)['pcntl'])) {
1713+
return \constant($element);
1714+
}
1715+
1716+
return $element;
1717+
}, $v);
1718+
})
1719+
->end()
1720+
->scalarPrototype()->end()
17091721
->end()
17101722
->scalarNode('default_bus')->defaultNull()->end()
17111723
->arrayNode('buses')

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@
602602
<xsd:element name="routing" type="messenger_routing" minOccurs="0" maxOccurs="unbounded" />
603603
<xsd:element name="transport" type="messenger_transport" minOccurs="0" maxOccurs="unbounded" />
604604
<xsd:element name="bus" type="messenger_bus" minOccurs="0" maxOccurs="unbounded" />
605+
<xsd:element name="stop-worker-on-signal" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
605606
</xsd:sequence>
606607
<xsd:attribute name="default-bus" type="xsd:string" />
607608
<xsd:attribute name="enabled" type="xsd:boolean" />

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.