1
0
Fork 0

Allow addListener to work with strings, fixes #10672

pull/10678/head
Jordi Boggiano 2022-03-30 16:16:01 +02:00
parent dca5e45989
commit b46dba29ce
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 4 additions and 4 deletions

View File

@ -394,13 +394,13 @@ class EventDispatcher
/** /**
* Add a listener for a particular event * Add a listener for a particular event
* *
* @param string $eventName The event name - typically a constant * @param string $eventName The event name - typically a constant
* @param callable $listener A callable expecting an event argument * @param callable|string $listener A callable expecting an event argument, or a command string to be executed (same as a composer.json "scripts" entry)
* @param int $priority A higher value represents a higher priority * @param int $priority A higher value represents a higher priority
* *
* @return void * @return void
*/ */
public function addListener(string $eventName, callable $listener, int $priority = 0): void public function addListener(string $eventName, $listener, int $priority = 0): void
{ {
$this->listeners[$eventName][$priority][] = $listener; $this->listeners[$eventName][$priority][] = $listener;
} }