diff --git a/src/Symfony/Contracts/CHANGELOG.md b/src/Symfony/Contracts/CHANGELOG.md
index b37bc2a705314..b5f1d76aecda5 100644
--- a/src/Symfony/Contracts/CHANGELOG.md
+++ b/src/Symfony/Contracts/CHANGELOG.md
@@ -5,6 +5,7 @@ CHANGELOG
-----
* added `HttpClient` namespace with contracts for implementing flexible HTTP clients
+ * added `EventDispatcher\EventDispatcherInterface`
1.0.0
-----
diff --git a/src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface.php b/src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface.php
new file mode 100644
index 0000000000000..9b1a69add2336
--- /dev/null
+++ b/src/Symfony/Contracts/EventDispatcher/EventDispatcherInterface.php
@@ -0,0 +1,58 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Contracts\EventDispatcher;
+
+use Psr\EventDispatcher\EventDispatcherInterface as PsrEventDispatcherInterface;
+
+if (interface_exists(PsrEventDispatcherInterface::class)) {
+ /**
+ * Allows providing hooks on domain-specific lifecycles by dispatching events.
+ */
+ interface EventDispatcherInterface extends PsrEventDispatcherInterface
+ {
+ /**
+ * Dispatches an event to all registered listeners.
+ *
+ * For BC with Symfony 4, the $eventName argument is not declared explicitly on the
+ * signature of the method. Implementations that are not bound by this BC contraint
+ * MUST declare it explicitly, as allowed by PHP.
+ *
+ * @param object $event The event to pass to the event handlers/listeners
+ * @param string|null $eventName The name of the event to dispatch. If not supplied,
+ * the class of $event should be used instead.
+ *
+ * @return object The passed $event MUST be returned
+ */
+ public function dispatch($event/*, string $eventName = null*/);
+ }
+} else {
+ /**
+ * Allows providing hooks on domain-specific lifecycles by dispatching events.
+ */
+ interface EventDispatcherInterface
+ {
+ /**
+ * Dispatches an event to all registered listeners.
+ *
+ * For BC with Symfony 4, the $eventName argument is not declared explicitly on the
+ * signature of the method. Implementations that are not bound by this BC contraint
+ * MUST declare it explicitly, as allowed by PHP.
+ *
+ * @param object $event The event to pass to the event handlers/listeners
+ * @param string|null $eventName The name of the event to dispatch. If not supplied,
+ * the class of $event should be used instead.
+ *
+ * @return object The passed $event MUST be returned
+ */
+ public function dispatch($event/*, string $eventName = null*/);
+ }
+}
diff --git a/src/Symfony/Contracts/composer.json b/src/Symfony/Contracts/composer.json
index f881258dc1a4a..b83e7c0535cfc 100644
--- a/src/Symfony/Contracts/composer.json
+++ b/src/Symfony/Contracts/composer.json
@@ -27,6 +27,7 @@
"psr/cache": "When using the Cache contracts",
"psr/container": "When using the Service contracts",
"symfony/cache-contracts-implementation": "",
+ "symfony/event-dispatcher-implementation": "",
"symfony/http-client-contracts-implementation": "",
"symfony/service-contracts-implementation": "",
"symfony/translation-contracts-implementation": ""
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy