1: <?php declare(strict_types=1);
2:
3: namespace Salient\Contract\Core\Event;
4:
5: use Psr\EventDispatcher\EventDispatcherInterface as PsrEventDispatcherInterface;
6: use Salient\Contract\Core\HasName;
7: use Salient\Contract\Core\Instantiable;
8:
9: /**
10: * @api
11: */
12: interface EventDispatcherInterface extends
13: PsrEventDispatcherInterface,
14: EventListenerProviderInterface,
15: Instantiable
16: {
17: /**
18: * Dispatch a given event to listeners registered for it
19: *
20: * If the event implements {@see HasName}, the return value of
21: * {@see HasName::getName()} is added to the list of events for which
22: * registered listeners are called.
23: *
24: * @template TEvent of object
25: *
26: * @param TEvent $event
27: * @return TEvent
28: */
29: public function dispatch(object $event): object;
30: }
31: