| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
* This file is part of the Symfony package.
|
|
|
5 |
*
|
|
|
6 |
* (c) Fabien Potencier <fabien@symfony.com>
|
|
|
7 |
*
|
|
|
8 |
* For the full copyright and license information, please view the LICENSE
|
|
|
9 |
* file that was distributed with this source code.
|
|
|
10 |
*/
|
|
|
11 |
|
|
|
12 |
namespace Symfony\Contracts\EventDispatcher;
|
|
|
13 |
|
|
|
14 |
use Psr\EventDispatcher\EventDispatcherInterface as PsrEventDispatcherInterface;
|
|
|
15 |
|
|
|
16 |
/**
|
|
|
17 |
* Allows providing hooks on domain-specific lifecycles by dispatching events.
|
|
|
18 |
*/
|
|
|
19 |
interface EventDispatcherInterface extends PsrEventDispatcherInterface
|
|
|
20 |
{
|
|
|
21 |
/**
|
|
|
22 |
* Dispatches an event to all registered listeners.
|
|
|
23 |
*
|
|
|
24 |
* @template T of object
|
|
|
25 |
*
|
|
|
26 |
* @param T $event The event to pass to the event handlers/listeners
|
|
|
27 |
* @param string|null $eventName The name of the event to dispatch. If not supplied,
|
|
|
28 |
* the class of $event should be used instead.
|
|
|
29 |
*
|
|
|
30 |
* @return T The passed $event MUST be returned
|
|
|
31 |
*/
|
|
|
32 |
public function dispatch(object $event, string $eventName = null): object;
|
|
|
33 |
}
|