vendor/symfony/event-dispatcher-contracts/EventDispatcherInterface.php line 32

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