diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2019-09-12 09:25:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-12 09:25:26 +0200 |
commit | ac48a9ba61ec9cb7632bf67328b654f2a628a981 (patch) | |
tree | 2dd4f1f7f44fbaf3f2a63ee59bbbf465ef0cb8ac /lib/private/EventDispatcher | |
parent | 1b8d6df6cdfd2f130b3702d9e183d83183370dd1 (diff) | |
parent | b9e14d5972d403a669a23e11b4b1359995d65ccc (diff) | |
download | nextcloud-server-ac48a9ba61ec9cb7632bf67328b654f2a628a981.tar.gz nextcloud-server-ac48a9ba61ec9cb7632bf67328b654f2a628a981.zip |
Merge pull request #17106 from nextcloud/feature/dispatch-typed-event
Add Symfony inspired typed event dispatcher method
Diffstat (limited to 'lib/private/EventDispatcher')
-rw-r--r-- | lib/private/EventDispatcher/EventDispatcher.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/private/EventDispatcher/EventDispatcher.php b/lib/private/EventDispatcher/EventDispatcher.php index bbf6ae2b368..8830bae79d8 100644 --- a/lib/private/EventDispatcher/EventDispatcher.php +++ b/lib/private/EventDispatcher/EventDispatcher.php @@ -31,6 +31,7 @@ use OCP\IContainer; use OCP\ILogger; use OCP\IServerContainer; use Symfony\Component\EventDispatcher\EventDispatcher as SymfonyDispatcher; +use function get_class; class EventDispatcher implements IEventDispatcher { @@ -74,6 +75,10 @@ class EventDispatcher implements IEventDispatcher { $this->dispatcher->dispatch($event, $eventName); } + public function dispatchTyped(Event $event): void { + $this->dispatch(get_class($event), $event); + } + /** * @return SymfonyDispatcher */ |