You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #45184 [DependencyInjection][EventDispatcher] Avoid instantiating not called listeners when tracing (Jean-Beru)
This PR was squashed before being merged into the 6.1 branch.
Discussion
----------
[DependencyInjection][EventDispatcher] Avoid instantiating not called listeners when tracing
| Q | A
| ------------- | ---
| Branch? | 6.1
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | Fix #43658
| License | MIT
| Doc PR |
This PR removes useless listeners instantiation when `TraceableEventDispatcher::getNotCalledListeners()` is called.
Even if this PR is in WIP, I created it to allow comments from `@nicolas`-grekas (and anyone interested in of course).
Commits
-------
d4e60e9d96 [DependencyInjection][EventDispatcher] Avoid instantiating not called listeners when tracing
return ($this->privates['baz_service'] ?? ($this->privates['baz_service'] = new \stdClass()));
77
77
}, 'nil' => function () {
78
78
returnNULL;
@@ -116,7 +116,7 @@ protected function getTranslator_Loader3Service()
116
116
*/
117
117
protectedfunctiongetTranslator1Service()
118
118
{
119
-
return$this->services['translator_1'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_1' => function () {
119
+
return$this->services['translator_1'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_1' => #[\Closure(name: 'translator.loader_1', class: 'stdClass')] function () {
120
120
return ($this->services['translator.loader_1'] ?? ($this->services['translator.loader_1'] = new \stdClass()));
121
121
}]));
122
122
}
@@ -128,7 +128,7 @@ protected function getTranslator1Service()
128
128
*/
129
129
protectedfunctiongetTranslator2Service()
130
130
{
131
-
$this->services['translator_2'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_2' => function () {
131
+
$this->services['translator_2'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_2' => #[\Closure(name: 'translator.loader_2', class: 'stdClass')] function () {
132
132
return ($this->services['translator.loader_2'] ?? ($this->services['translator.loader_2'] = new \stdClass()));
133
133
}]));
134
134
@@ -144,7 +144,7 @@ protected function getTranslator2Service()
144
144
*/
145
145
protectedfunctiongetTranslator3Service()
146
146
{
147
-
$this->services['translator_3'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_3' => function () {
147
+
$this->services['translator_3'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator(new \Symfony\Component\DependencyInjection\ServiceLocator(['translator.loader_3' => #[\Closure(name: 'translator.loader_3', class: 'stdClass')] function () {
148
148
return ($this->services['translator.loader_3'] ?? ($this->services['translator.loader_3'] = new \stdClass()));
0 commit comments