From e00e7af7856ca2d6e7550ab92f2f147244b3dc0e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 30 Mar 2022 16:16:01 +0200 Subject: [PATCH] Allow addListener to work with strings, fixes #10672 --- src/Composer/EventDispatcher/EventDispatcher.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Composer/EventDispatcher/EventDispatcher.php b/src/Composer/EventDispatcher/EventDispatcher.php index b12f3ce456e1..eddaf8d583ce 100644 --- a/src/Composer/EventDispatcher/EventDispatcher.php +++ b/src/Composer/EventDispatcher/EventDispatcher.php @@ -401,13 +401,13 @@ protected function executeEventPhpScript(string $className, string $methodName, /** * Add a listener for a particular event * - * @param string $eventName The event name - typically a constant - * @param callable $listener A callable expecting an event argument - * @param int $priority A higher value represents a higher priority + * @param string $eventName The event name - typically a constant + * @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 * * @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; }