-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[EventDispatcher] Improve method resolving when it is omitted in tag #50783
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
base: 7.3
Are you sure you want to change the base?
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.
LGTM, Here are minor comments. Please rebase while addressing them.
src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php
Outdated
Show resolved
Hide resolved
f2bcee9
to
d2ebe37
Compare
d2ebe37
to
dcefe70
Compare
foreach ($publicMethods as $publicMethod) { | ||
if ( | ||
!$publicMethod->isStatic() | ||
&& 1 === $publicMethod->getNumberOfRequiredParameters() |
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.
This check is bad given that the EventDispatcher component actually provides 3 parameters to listeners:
- the event object
- the event name
- the EventDispatcher instance
@nikophil any chance you handle the remaining comments? |
(this PR is a split of #50775)
this PR proposes to improve the listener's method resolution by:
someMethod()
as the listener's method).__invoke
method exist we'll use this one without checking its parameters (this is also useful for BC)ping @GromNaN
(CI failures seems unrelated to this PR 🤔 )