-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible #30691
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
Conversation
xdebug_enable(); | ||
} | ||
} | ||
throw new AutowiringFailedException($this->currentId, $failureMessage); |
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.
not directly related but was still needed to make tests pass locally
f7ad7c0
to
a83fde3
Compare
Green! (failure unrelated) |
…contracts and use it where possible
a83fde3
to
3c3db2f
Compare
@@ -29,6 +29,10 @@ | |||
"conflict": { | |||
"symfony/dependency-injection": "<3.4" | |||
}, | |||
"provide": { | |||
"psr/event-dispatcher-implementation": "1.0", |
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.
Can we do that (because this is only true when the psr/event-dispatcher
package is present)?
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.
It still does provide the implementation - when the package is present of course. When it isn't, nothing can provide it by definition. So yes we can.
Thank you @nicolas-grekas. |
…ace to symfony/contracts and use it where possible (nicolas-grekas) This PR was merged into the 4.3-dev branch. Discussion ---------- [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This PR adds a new `EventDispatcherInterface` in `Contracts`. This interface contains only one method: `dispatch($event, $eventName)`. That covers almost all use cases of the event dispatcher in components (some use add/removeListeners/Subscribers but they are a minority.) While doing so, it allows dispatching any objects as events - not only instances of `Event`. This allows decoupling e.g. `Messenger` from the `EventDispatcher` component. Next steps could be about planning to remove the base `Event` class from some concrete event classes and/or moving `EventSubscriberInterface` to `symfony/contracts`. It would allow decoupling e.g. `Workflow` from the component - but that's too far away for now, let's think about it in 5.1. Commits ------- 3c3db2f [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible
This PR adds a new
EventDispatcherInterface
inContracts
. This interface contains only one method:dispatch($event, $eventName)
. That covers almost all use cases of the event dispatcher in components (some use add/removeListeners/Subscribers but they are a minority.)While doing so, it allows dispatching any objects as events - not only instances of
Event
.This allows decoupling e.g.
Messenger
from theEventDispatcher
component.Next steps could be about planning to remove the base
Event
class from some concrete event classes and/or movingEventSubscriberInterface
tosymfony/contracts
. It would allow decoupling e.g.Workflow
from the component - but that's too far away for now, let's think about it in 5.1.