This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component
Fabien Potencier c949f9a282 feature #30691 [Contracts][EventDispatcher] add EventDispatcherInterface 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
-------

3c3db2f14a [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible
2019-03-27 07:28:10 +01:00
..
Asset Merge branch '4.2' into short-array-master 2019-01-16 22:53:39 +01:00
BrowserKit Add tests for HttpBrowser 2019-03-22 12:38:01 +01:00
Cache [Cache] added DSN support for rediss in AbstractAdapter and RedisTrait 2019-03-20 12:35:07 +01:00
Config Merge branch '4.2' 2019-02-23 16:22:31 +01:00
Console [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible 2019-03-25 18:18:00 +01:00
CssSelector Merge branch '4.2' into short-array-master 2019-01-16 22:53:39 +01:00
Debug Merge branch '4.2' 2019-03-10 18:10:06 +01:00
DependencyInjection [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible 2019-03-25 18:18:00 +01:00
DomCrawler Merge branch '4.2' 2019-02-23 16:22:31 +01:00
Dotenv Merge branch '4.2' 2019-01-24 22:40:22 +01:00
EventDispatcher [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible 2019-03-25 18:18:00 +01:00
ExpressionLanguage Merge branch '4.2' into short-array-master 2019-01-16 22:53:39 +01:00
Filesystem fixed CS 2019-03-04 10:20:13 +01:00
Finder [Finder] Ignore paths from .gitignore #26714 2019-03-22 08:19:24 +01:00
Form feature #30691 [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible (nicolas-grekas) 2019-03-27 07:28:10 +01:00
HttpClient [HttpClient] Fix missing use statement 2019-03-26 01:54:03 +01:00
HttpFoundation Merge branch '4.2' 2019-03-22 09:16:47 +01:00
HttpKernel [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible 2019-03-25 18:18:00 +01:00
Inflector Merge branch '4.2' into short-array-master 2019-01-16 22:53:39 +01:00
Intl Merge branch '4.2' 2019-03-22 09:16:47 +01:00
Ldap fixed CS 2019-01-16 22:53:45 +01:00
Lock Merge branch '4.2' into short-array-master 2019-01-16 22:53:39 +01:00
Messenger feature #30691 [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible (nicolas-grekas) 2019-03-27 07:28:10 +01:00
Mime [Mime] Removed unnecessary strtolower 2019-03-25 12:20:53 +01:00
OptionsResolver Merge branch '4.2' 2019-02-23 16:22:31 +01:00
Process Merge branch '4.2' 2019-03-11 21:50:47 +01:00
PropertyAccess Merge branch '4.2' 2019-03-04 10:16:46 +01:00
PropertyInfo Merge branch '4.2' 2019-03-10 11:14:34 +01:00
Routing [Routing] Exposed "utf8" option, defaults "locale" and "format" in configuration 2019-03-20 15:57:56 +01:00
Security [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible 2019-03-25 18:18:00 +01:00
Serializer throw TypeErrors to prepare for type hints in 5.0 2019-03-19 22:12:04 +01:00
Stopwatch Merge branch '4.2' into short-array-master 2019-01-16 22:53:39 +01:00
Templating Merge branch '4.2' 2019-02-23 16:22:31 +01:00
Translation [Translation] Add XLIFF 1 source to metadata to differentiate from attr 2019-03-07 09:54:57 +01:00
Validator [Validator] BIC remove unused sprintf and parameter 2019-03-26 11:04:14 +01:00
VarDumper [Console] Add dumper 2019-03-24 11:32:26 +01:00
VarExporter Merge branch '4.2' into short-array-master 2019-01-16 22:53:39 +01:00
WebLink [EventDispatcher] swap arguments of dispatch() to allow registering events by FQCN 2019-03-14 08:32:46 +01:00
Workflow [Contracts][EventDispatcher] add EventDispatcherInterface to symfony/contracts and use it where possible 2019-03-25 18:18:00 +01:00
Yaml Merge branch '4.2' 2019-02-23 16:22:31 +01:00