1
0
Fork 0

Merge branch '1.10'

pull/8923/head
Jordi Boggiano 2020-05-22 10:30:51 +02:00
commit acf2b15982
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 0 additions and 35 deletions

View File

@ -160,7 +160,6 @@ class EventDispatcher
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', $event->getName(), (is_object($callable[0]) ? get_class($callable[0]) : $callable[0]).'->'.$callable[1] ), true, IOInterface::VERBOSE);
} }
$event = $this->checkListenerExpectedEvent($callable, $event);
$return = false === call_user_func($callable, $event) ? 1 : 0; $return = false === call_user_func($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', $event->getName(), $callable), true, IOInterface::VERBOSE);
@ -304,8 +303,6 @@ class EventDispatcher
*/ */
protected function executeEventPhpScript($className, $methodName, Event $event) protected function executeEventPhpScript($className, $methodName, Event $event)
{ {
$event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
if ($this->io->isVerbose()) { if ($this->io->isVerbose()) {
$this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName)); $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
} else { } else {
@ -315,38 +312,6 @@ class EventDispatcher
return $className::$methodName($event); return $className::$methodName($event);
} }
/**
* @param mixed $target
* @param Event $event
* @return Event
*/
protected function checkListenerExpectedEvent($target, Event $event)
{
if (in_array($event->getName(), array(
'init',
'command',
'pre-file-download',
), true)) {
return $event;
}
try {
$reflected = new \ReflectionParameter($target, 0);
} catch (\Exception $e) {
return $event;
}
$typehint = $reflected->getClass();
if (!$typehint instanceof \ReflectionClass) {
return $event;
}
$expected = $typehint->getName();
return $event;
}
private function serializeCallback($cb) private function serializeCallback($cb)
{ {
if (is_array($cb) && count($cb) === 2) { if (is_array($cb) && count($cb) === 2) {