@@ -34,60 +34,60 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | interface IEventDispatcher { |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @template T of \OCP\EventDispatcher\Event |
|
| 39 | - * @param string $eventName preferably the fully-qualified class name of the Event sub class |
|
| 40 | - * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class |
|
| 41 | - * @param callable $listener the object that is invoked when a matching event is dispatched |
|
| 42 | - * @param int $priority |
|
| 43 | - * |
|
| 44 | - * @since 17.0.0 |
|
| 45 | - */ |
|
| 46 | - public function addListener(string $eventName, callable $listener, int $priority = 0): void; |
|
| 37 | + /** |
|
| 38 | + * @template T of \OCP\EventDispatcher\Event |
|
| 39 | + * @param string $eventName preferably the fully-qualified class name of the Event sub class |
|
| 40 | + * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class |
|
| 41 | + * @param callable $listener the object that is invoked when a matching event is dispatched |
|
| 42 | + * @param int $priority |
|
| 43 | + * |
|
| 44 | + * @since 17.0.0 |
|
| 45 | + */ |
|
| 46 | + public function addListener(string $eventName, callable $listener, int $priority = 0): void; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * @template T of \OCP\EventDispatcher\Event |
|
| 50 | - * @param string $eventName preferably the fully-qualified class name of the Event sub class |
|
| 51 | - * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class |
|
| 52 | - * @param callable $listener the object that is invoked when a matching event is dispatched |
|
| 53 | - * |
|
| 54 | - * @since 19.0.0 |
|
| 55 | - */ |
|
| 56 | - public function removeListener(string $eventName, callable $listener): void; |
|
| 48 | + /** |
|
| 49 | + * @template T of \OCP\EventDispatcher\Event |
|
| 50 | + * @param string $eventName preferably the fully-qualified class name of the Event sub class |
|
| 51 | + * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class |
|
| 52 | + * @param callable $listener the object that is invoked when a matching event is dispatched |
|
| 53 | + * |
|
| 54 | + * @since 19.0.0 |
|
| 55 | + */ |
|
| 56 | + public function removeListener(string $eventName, callable $listener): void; |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * @template T of \OCP\EventDispatcher\Event |
|
| 60 | - * @param string $eventName preferably the fully-qualified class name of the Event sub class to listen for |
|
| 61 | - * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class to listen for |
|
| 62 | - * @param string $className fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container |
|
| 63 | - * @psalm-param class-string<\OCP\EventDispatcher\IEventListener<T>> $className fully qualified class name that can be built by the DI container |
|
| 64 | - * @param int $priority |
|
| 65 | - * |
|
| 66 | - * @since 17.0.0 |
|
| 67 | - */ |
|
| 68 | - public function addServiceListener(string $eventName, string $className, int $priority = 0): void; |
|
| 58 | + /** |
|
| 59 | + * @template T of \OCP\EventDispatcher\Event |
|
| 60 | + * @param string $eventName preferably the fully-qualified class name of the Event sub class to listen for |
|
| 61 | + * @psalm-param string|class-string<T> $eventName preferably the fully-qualified class name of the Event sub class to listen for |
|
| 62 | + * @param string $className fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container |
|
| 63 | + * @psalm-param class-string<\OCP\EventDispatcher\IEventListener<T>> $className fully qualified class name that can be built by the DI container |
|
| 64 | + * @param int $priority |
|
| 65 | + * |
|
| 66 | + * @since 17.0.0 |
|
| 67 | + */ |
|
| 68 | + public function addServiceListener(string $eventName, string $className, int $priority = 0): void; |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @template T of \OCP\EventDispatcher\Event |
|
| 72 | - * @param string $eventName |
|
| 73 | - * @psalm-param string|class-string<T> $eventName |
|
| 74 | - * @param Event $event |
|
| 75 | - * @psalm-param T $event |
|
| 76 | - * |
|
| 77 | - * @since 17.0.0 |
|
| 78 | - * @deprecated 21.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped |
|
| 79 | - */ |
|
| 80 | - public function dispatch(string $eventName, Event $event): void; |
|
| 70 | + /** |
|
| 71 | + * @template T of \OCP\EventDispatcher\Event |
|
| 72 | + * @param string $eventName |
|
| 73 | + * @psalm-param string|class-string<T> $eventName |
|
| 74 | + * @param Event $event |
|
| 75 | + * @psalm-param T $event |
|
| 76 | + * |
|
| 77 | + * @since 17.0.0 |
|
| 78 | + * @deprecated 21.0.0 use \OCP\EventDispatcher\IEventDispatcher::dispatchTyped |
|
| 79 | + */ |
|
| 80 | + public function dispatch(string $eventName, Event $event): void; |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Dispatch a typed event |
|
| 84 | - * |
|
| 85 | - * Only use this with subclasses of ``\OCP\EventDispatcher\Event``. |
|
| 86 | - * The object's class will determine the event name. |
|
| 87 | - * |
|
| 88 | - * @param Event $event |
|
| 89 | - * |
|
| 90 | - * @since 18.0.0 |
|
| 91 | - */ |
|
| 92 | - public function dispatchTyped(Event $event): void; |
|
| 82 | + /** |
|
| 83 | + * Dispatch a typed event |
|
| 84 | + * |
|
| 85 | + * Only use this with subclasses of ``\OCP\EventDispatcher\Event``. |
|
| 86 | + * The object's class will determine the event name. |
|
| 87 | + * |
|
| 88 | + * @param Event $event |
|
| 89 | + * |
|
| 90 | + * @since 18.0.0 |
|
| 91 | + */ |
|
| 92 | + public function dispatchTyped(Event $event): void; |
|
| 93 | 93 | } |