-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection][EventDispatcher] Avoid instantiating not called listeners when tracing #45184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DependencyInjection][EventDispatcher] Avoid instantiating not called listeners when tracing #45184
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we might need to update the YamlFileDumper an the XmlFileDumper also (and the loaders+configurator)
src/Symfony/Component/DependencyInjection/Attribute/Closure.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Attribute/Closure.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php
Outdated
Show resolved
Hide resolved
I also updated XML and Yaml loader. |
src/Symfony/Component/DependencyInjection/Argument/ServiceClosureArgument.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking nice :)
Please add a test case in EventDispatcher also.
src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php
Outdated
Show resolved
Hide resolved
I added some tests but Psalm still warns about Updating Psalm annotation makes the CI throw a |
32b9fbd
to
bdb8d6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I pushed some changes, see 2nd commit)
OK great ! Thanks. |
… listeners when tracing
aca93ff
to
d4e60e9
Compare
Thank you @Jean-Beru. |
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).