diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-10-15 16:23:26 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2020-10-15 22:34:18 +0000 |
commit | dff399973fd7d9dc183fa5c1928d5cc1a5144b40 (patch) | |
tree | 360df4f1f2719a0fd90c1f78ce1f955ee3b94706 /lib/public | |
parent | 904396c5d2fbe9eac43a97e9af0d37d6c77707d7 (diff) | |
download | nextcloud-server-dff399973fd7d9dc183fa5c1928d5cc1a5144b40.tar.gz nextcloud-server-dff399973fd7d9dc183fa5c1928d5cc1a5144b40.zip |
Add psalm types for the event dispatcher
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/AppFramework/Bootstrap/IRegistrationContext.php | 5 | ||||
-rw-r--r-- | lib/public/EventDispatcher/IEventDispatcher.php | 10 | ||||
-rw-r--r-- | lib/public/EventDispatcher/IEventListener.php | 3 |
3 files changed, 16 insertions, 2 deletions
diff --git a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php index c75b983120c..7d4692f3fcc 100644 --- a/lib/public/AppFramework/Bootstrap/IRegistrationContext.php +++ b/lib/public/AppFramework/Bootstrap/IRegistrationContext.php @@ -113,10 +113,11 @@ interface IRegistrationContext { * * This is equivalent to calling IEventDispatcher::addServiceListener * + * @template T of \OCP\EventDispatcher\Event * @param string $event preferably the fully-qualified class name of the Event sub class to listen for - * @psalm-param string|class-string<\OCP\EventDispatcher\Event> $event preferably the fully-qualified class name of the Event sub class to listen for + * @psalm-param string|class-string<T> $event preferably the fully-qualified class name of the Event sub class to listen for * @param string $listener fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container - * @psalm-param class-string<\OCP\EventDispatcher\IEventListener> $listener fully qualified class name that can be built by the DI container + * @psalm-param class-string<\OCP\EventDispatcher\IEventListener<T>> $listener fully qualified class name that can be built by the DI container * @param int $priority * * @see IEventDispatcher::addServiceListener() diff --git a/lib/public/EventDispatcher/IEventDispatcher.php b/lib/public/EventDispatcher/IEventDispatcher.php index 997834ad7b5..471447e4b9f 100644 --- a/lib/public/EventDispatcher/IEventDispatcher.php +++ b/lib/public/EventDispatcher/IEventDispatcher.php @@ -35,7 +35,9 @@ namespace OCP\EventDispatcher; interface IEventDispatcher { /** + * @template T of \OCP\EventDispatcher\Event * @param string $eventName preferably the fully-qualified class name of the Event sub class + * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class * @param callable $listener the object that is invoked when a matching event is dispatched * @param int $priority * @@ -44,7 +46,9 @@ interface IEventDispatcher { public function addListener(string $eventName, callable $listener, int $priority = 0): void; /** + * @template T of \OCP\EventDispatcher\Event * @param string $eventName preferably the fully-qualified class name of the Event sub class + * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class * @param callable $listener the object that is invoked when a matching event is dispatched * * @since 19.0.0 @@ -52,8 +56,11 @@ interface IEventDispatcher { public function removeListener(string $eventName, callable $listener): void; /** + * @template T of \OCP\EventDispatcher\Event * @param string $eventName preferably the fully-qualified class name of the Event sub class to listen for + * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class to listen for * @param string $className fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container + * @psalm-param class-string<\OCP\EventDispatcher\IEventListener<T>> $className fully qualified class name that can be built by the DI container * @param int $priority * * @since 17.0.0 @@ -61,8 +68,11 @@ interface IEventDispatcher { public function addServiceListener(string $eventName, string $className, int $priority = 0): void; /** + * @template T of \OCP\EventDispatcher\Event * @param string $eventName + * @psalm-param string|class-string<T> $eventName * @param Event $event + * @psalm-param T $event * * @since 17.0.0 */ diff --git a/lib/public/EventDispatcher/IEventListener.php b/lib/public/EventDispatcher/IEventListener.php index 25906fa798e..fcf44133aff 100644 --- a/lib/public/EventDispatcher/IEventListener.php +++ b/lib/public/EventDispatcher/IEventListener.php @@ -28,11 +28,14 @@ namespace OCP\EventDispatcher; /** * @since 17.0.0 + * + * @template T of Event */ interface IEventListener { /** * @param Event $event + * @psalm-param T $event * * @since 17.0.0 */ |