public function dispatch($event): void
    {
        Assertion::isObject($event, 'An event should be an object');

        $eventName = get_class($event);
        $eventSubscribers = array_merge(
            $this->subscribedToAllEvents,
            $this->subscribers[$eventName] ?? []
        );

        foreach ($eventSubscribers as $eventSubscriber) {
            $eventSubscriber($event);
        }
    }
public function dispatch($event): void
    {
        Assertion::isObject($event, 'An event should be an object');

        $eventName = get_class($event);
        $eventSubscribers = array_merge(
            $this->subscribedToAllEvents,
            $this->subscribers[$eventName] ?? []
        );

        foreach ($eventSubscribers as $eventSubscriber) {
            $eventSubscriber($event);
        }
    }
public function dispatch ( $ event ) : void { Assertion :: isObject ( $ event , 'An event should be an object' ) ; $ eventName = get_class ( $ event ) ; $ eventSubscribers = array_merge ( $ this -> subscribedToAllEvents , $ this -> subscribers [ $ eventName ] ?? [ ] ) ; foreach ( $ eventSubscribers as $ eventSubscriber ) { $ eventSubscriber ( $ event ) ; } }
Dispatch a single event.

@param object $event The event object
Dispatch a single event .