Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EventDispatcher.php

function EventDispatcher::dispatch

Same name in this branch
  1. 11.1.x vendor/symfony/event-dispatcher/EventDispatcher.php \Symfony\Component\EventDispatcher\EventDispatcher::dispatch()

Dispatch an event

Parameters

string|null $eventName The event name, required if no $event is provided:

Event $event An event instance, required if no $eventName is provided:

Return value

int return code of the executed script if any, for php scripts a false return value is changed to 1, anything else to 0

1 call to EventDispatcher::dispatch()
EventDispatcher::doDispatch in vendor/composer/composer/src/Composer/EventDispatcher/EventDispatcher.php
Triggers the listeners of an event.

File

vendor/composer/composer/src/Composer/EventDispatcher/EventDispatcher.php, line 106

Class

EventDispatcher
The Event Dispatcher.

Namespace

Composer\EventDispatcher

Code

public function dispatch(?string $eventName, ?Event $event = null) : int {
    if (null === $event) {
        if (null === $eventName) {
            throw new \InvalidArgumentException('If no $event is passed in to ' . __METHOD__ . ' you have to pass in an $eventName, got null.');
        }
        $event = new Event($eventName);
    }
    return $this->doDispatch($event);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal