Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[EventDispatcher] check for method to exist#18388

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:2.8fromxabbuh:pr-16198
May 3, 2016

Conversation

@xabbuh
Copy link
Member

QA
Branch?2.8
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#16301 (comment)
LicenseMIT
Doc PR

This change must be reverted after being merged into the3.0 branch (thegetListenerPriority() method was added to the interface in Symfony 3.0).

@xabbuh
Copy link
MemberAuthor

Actually, this could be seen as breaking the contract given by the parent class which strictly seen doesn't allow to throw an exception here. An alternative fix would be to keep records about the listener priorities in theTraceableEventDispatcher (which on the other hand would not work when the listener was registered on the wrapped dispatcher directly, thus bypassing the outer dispatcher).

publicfunctiongetListenerPriority($eventName,$listener)
{
if (!method_exists($this->dispatcher,'getListenerPriority')) {
thrownew \LogicException(sprintf('The wrapped event dispatcher\'s class ("%s") does not implement the getListenerPriority() method.',get_class($this->dispatcher)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

another solution would be to fallback to the behavior used by the traceable dispatcher in 2.7 and older: register the listener at priority 0. It is better than breaking the dispatching entirely IMO (especially given that all core implementations have this method implemented so most people will have the right priority anyway)

@fabpot
Copy link
Member

@xabbuh Any feedback regarding@stof comment?

@xabbuh
Copy link
MemberAuthor

Updated here to treat 0 as the default listener priority.

@fabpot
Copy link
Member

Thank you@xabbuh.

@fabpotfabpot merged commit78ae2ad intosymfony:2.8May 3, 2016
fabpot added a commit that referenced this pull requestMay 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
@xabbuhxabbuh deleted the pr-16198 branchMay 3, 2016 19:03
This was referencedMay 9, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@xabbuh@fabpot@stof@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp