8000 Deprecate configuring tags on RegisterListenersPass · symfony/symfony@2c4effe · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 2c4effe

Browse files
committed
Deprecate configuring tags on RegisterListenersPass
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent b1e2527 commit 2c4effe

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class RegisterListenersPass implements CompilerPassInterface
3131
protected $eventAliasesParameter;
3232

3333
private $hotPathEvents = [];
34-
private $hotPathTagName;
34+
private $hotPathTagName = 'container.hot_path';
3535
private $noPreloadEvents = [];
36-
private $noPreloadTagName;
36+
private $noPreloadTagName = 'container.no_preload';
3737

3838
public function __construct(string $dispatcherService = 'event_dispatcher', string $listenerTag = 'kernel.event_listener', string $subscriberTag = 'kernel.event_subscriber', string $eventAliasesParameter = 'event_dispatcher.event_aliases')
3939
{
@@ -50,21 +50,29 @@ public function __construct(string $dispatcherService = 'event_dispatcher', stri
5050
/**
5151
* @return $this
5252
*/
53-
public function setHotPathEvents(array $hotPathEvents, string $tagName = 'container.hot_path')
53+
public function setHotPathEvents(array $hotPathEvents)
5454
{
5555
$this->hotPathEvents = array_flip($hotPathEvents);
56-
$this->hotPathTagName = $tagName;
56+
57+
if (1 < \func_num_args()) {
58+
trigger_deprecation('symfony/event-dispatcher', '5.4', 'Configuring "$tagName" in "%s" is deprecated.', __METHOD__);
59+
$this->hotPathTagName = func_get_arg(1);
60+
}
5761

5862
return $this;
5963
}
6064

6165
/**
6266
* @return $this
6367
*/
64-
public function setNoPreloadEvents(array $noPreloadEvents, string $tagName = 'container.no_preload'): self
68+
public function setNoPreloadEvents(array $noPreloadEvents): self
6569
{
6670
$this->noPreloadEvents = array_flip($noPreloadEvents);
67-
$this->noPreloadTagName = $tagName;
71+
72+
if (1 < \func_num_args()) {
73+
trigger_deprecation('symfony/event-dispatcher', '5.4', 'Configuring "$tagName" in "%s" is deprecated.', __METHOD__);
74+
$this->noPreloadTagName = func_get_arg(1);
75+
}
6876

6977
return $this;
7078
}

0 commit comments

Comments
 (0)
0