Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Oct 23, 2015

Conversation

xabbuh
Copy link
Member

@xabbuh 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

@dupuchba
Copy link
Contributor

👍

@Tobion
Copy link
Contributor

Tobion commented Oct 23, 2015

👍

Status: Reviewed

@Tobion
Copy link
Contributor

Tobion commented Oct 23, 2015

Thank you @xabbuh.

@Tobion Tobion merged commit f8019c8 into symfony:master Oct 23, 2015
Tobion added a commit that referenced this pull request Oct 23, 2015
…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
@xabbuh xabbuh deleted the event-dispatcher-interface-priority branch October 23, 2015 13:32
@fabpot fabpot mentioned this pull request Nov 16, 2015
@pfrenssen
Copy link

Is there a possibility to backport this to Symfony 2.8? The getListenerPriority() method is called in ContainerAwareEventDispatcher::getListenerPriority() but since it is not defined on the interface the developers are not made aware that this method is now required.

@xabbuh
Copy link
Member Author

xabbuh commented Mar 7, 2016

@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.

@pfrenssen
Copy link

Ok that sounds like a good reason. Pity is that BC is already broken, ContainerAwareEventDispatcher is calling this method in 2.8.

@xabbuh
Copy link
Member Author

xabbuh commented Mar 7, 2016

@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.

@donquixote
Copy link
Contributor

@xabbuh @pfrenssen here, https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php#L102

backport this to Symfony 2.8

This could be done by adding a separate interface, extending the basic one.
Then either change the constructor signature for TraceableEventDispatcher, or do some instanceof.
Or maybe just method_exists(), without any extra interface?

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?

create a new issue

I leave this to others (e.g. @pfrenssen) For now I am simply having a short visit in this issue queue.

@xabbuh
Copy link
Member Author

xabbuh commented Mar 31, 2016

@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 getListenerPriority() method in case the method does not exist in the wrapped dispatcher.

@pfrenssen
Copy link

I guess this is a good solution if we cannot add the interface for BC reasons. Thanks!

fabpot added a commit that referenced this pull request May 3, 2016
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
symfony-splitter pushed a commit to symfony/event-dispatcher that referenced this pull request May 3, 2016
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
athlan added a commit to athlan/pimple-aware-event-dispatcher that referenced this pull request Feb 24, 2018
Implement `getListenerPriority()` that was introduced in Symfony 2.8.

symfony/symfony#16301
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants