1
0
Fork 0

Add arguments to command call output (#11826)

pull/11688/head
PrinsFrank 2024-02-07 11:11:16 +01:00 committed by GitHub
parent 654da6f576
commit fd23381391
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -194,6 +194,7 @@ class EventDispatcher
$return = 0; $return = 0;
$this->ensureBinDirIsInPath(); $this->ensureBinDirIsInPath();
$formattedEventNameWithArgs = $event->getName() . ($event->getArguments() !== [] ? ' (' . implode(', ', $event->getArguments()) . ')' : '');
if (!is_string($callable)) { if (!is_string($callable)) {
if (!is_callable($callable)) { if (!is_callable($callable)) {
$className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0]; $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
@ -201,11 +202,11 @@ class EventDispatcher
throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public'); throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
} }
if (is_array($callable) && (is_string($callable[0]) || is_object($callable[0])) && is_string($callable[1])) { if (is_array($callable) && (is_string($callable[0]) || is_object($callable[0])) && is_string($callable[1])) {
$this->io->writeError(sprintf('> %s: %s', $event->getName(), (is_object($callable[0]) ? get_class($callable[0]) : $callable[0]).'->'.$callable[1]), true, IOInterface::VERBOSE); $this->io->writeError(sprintf('> %s: %s', $formattedEventNameWithArgs, (is_object($callable[0]) ? get_class($callable[0]) : $callable[0]).'->'.$callable[1]), true, IOInterface::VERBOSE);
} }
$return = false === $callable($event) ? 1 : 0; $return = false === $callable($event) ? 1 : 0;
} elseif ($this->isComposerScript($callable)) { } elseif ($this->isComposerScript($callable)) {
$this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE); $this->io->writeError(sprintf('> %s: %s', $formattedEventNameWithArgs, $callable), true, IOInterface::VERBOSE);
$script = explode(' ', substr($callable, 1)); $script = explode(' ', substr($callable, 1));
$scriptName = $script[0]; $scriptName = $script[0];