-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[EventDispatcher] add method getListenerPriority() to interface #16301
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
[EventDispatcher] add method getListenerPriority() to interface #16301
Conversation
xabbuh
commented
Oct 20, 2015
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | yes |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #16198 |
License | MIT |
Doc PR | todo |
👍 |
👍 Status: Reviewed |
Thank you @xabbuh. |
…interface (xabbuh) This PR was merged into the 3.0-dev branch. Discussion ---------- [EventDispatcher] add method getListenerPriority() to interface | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | yes | Deprecations? | no | Tests pass? | yes | Fixed tickets | #16198 | License | MIT | Doc PR | todo Commits ------- f8019c8 add method getListenerPriority() to interface
Is there a possibility to backport this to Symfony 2.8? The |
@pfrenssen Adding a method to an interface is a BC break (all implementations of the interface must be changed). That's why we had to make this change in 3.0. |
Ok that sounds like a good reason. Pity is that BC is already broken, ContainerAwareEventDispatcher is calling this method in 2.8. |
@pfrenssen I do not see where this is happening. But can you please create a new issue if you think that there actually is a bug (always calling a method that is not given by the interface would be indeed a mistake). Best would be if you could come up with a failing test case or code example. |
@xabbuh @pfrenssen here, https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php#L102
This could be done by adding a separate interface, extending the basic one. The question is: Should TraceableEventDispatcher always require a dispatcher with getListenerPriority() ? Or is this called only sometimes? Or could it return a default value, if the method does not exist?
I leave this to others (e.g. @pfrenssen) For now I am simply having a short visit in this issue queue. |
@pfrenssen @donquixote Thank you for the details given. I checked the code again and proposed a fix in #18388 to provide a meaningful exception in case you call the |
I guess this is a good solution if we cannot add the interface for BC reasons. Thanks! |
This PR was merged into the 2.8 branch. Discussion ---------- [EventDispatcher] check for method to exist | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #16301 (comment) | License | MIT | Doc PR | This change must be reverted after being merged into the `3.0` branch (the `getListenerPriority()` method was added to the interface in Symfony 3.0). Commits ------- 78ae2ad [EventDispatcher] check for method to exist
This PR was merged into the 2.8 branch. Discussion ---------- [EventDispatcher] check for method to exist | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony/symfony#16301 (comment) | License | MIT | Doc PR | This change must be reverted after being merged into the `3.0` branch (the `getListenerPriority()` method was added to the interface in Symfony 3.0). Commits ------- 78ae2ad [EventDispatcher] check for method to exist
Implement `getListenerPriority()` that was introduced in Symfony 2.8. symfony/symfony#16301