Skip to content

Commit b46dba2

Browse files
committed
Allow addListener to work with strings, fixes #10672
1 parent dca5e45 commit b46dba2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Composer/EventDispatcher/EventDispatcher.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,13 +394,13 @@ protected function executeEventPhpScript(string $className, string $methodName,
394394
/**
395395
* Add a listener for a particular event
396396
*
397-
* @param string $eventName The event name - typically a constant
398-
* @param callable $listener A callable expecting an event argument
399-
* @param int $priority A higher value represents a higher priority
397+
* @param string $eventName The event name - typically a constant
398+
* @param callable|string $listener A callable expecting an event argument, or a command string to be executed (same as a composer.json "scripts" entry)
399+
* @param int $priority A higher value represents a higher priority
400400
*
401401
* @return void
402402
*/
403-
public function addListener(string $eventName, callable $listener, int $priority = 0): void
403+
public function addListener(string $eventName, $listener, int $priority = 0): void
404404
{
405405
$this->listeners[$eventName][$priority][] = $listener;
406406
}

0 commit comments

Comments
 (0)