From 7e199f034b91a06cd59d8be5b36a254698cbe878 Mon Sep 17 00:00:00 2001 From: Art4 Date: Mon, 27 Jan 2025 15:39:22 +0000 Subject: [PATCH] Create DI::eventDispatcher() where constructor injection is not possible atm --- src/DI.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/DI.php b/src/DI.php index 94bb4c308a..43a60dae0b 100644 --- a/src/DI.php +++ b/src/DI.php @@ -789,4 +789,13 @@ abstract class DI { return self::$dice->create(Content\Post\Repository\PostMedia::class); } + + /** + * @internal The EventDispatcher should never called outside of the core, like in addons or themes + * @deprecated 2025.02 Use constructor injection instead + */ + public static function eventDispatcher(): \Psr\EventDispatcher\EventDispatcherInterface + { + return self::$dice->create(\Psr\EventDispatcher\EventDispatcherInterface::class); + } }