1
0
Fork 0

Warn when referencing unknown scripts

pull/5183/head
Jordi Boggiano 2016-04-11 18:49:22 +01:00
parent efa13d7c5f
commit c45cc912ab
1 changed files with 3 additions and 0 deletions

View File

@ -172,6 +172,9 @@ class EventDispatcher
$scriptName = substr($callable, 1); $scriptName = substr($callable, 1);
$args = $event->getArguments(); $args = $event->getArguments();
$flags = $event->getFlags(); $flags = $event->getFlags();
if (!$this->getListeners(new Event($scriptName))) {
$this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable));
}
$return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags)); $return = $this->dispatch($scriptName, new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags));
} elseif ($this->isPhpScript($callable)) { } elseif ($this->isPhpScript($callable)) {
$className = substr($callable, 0, strpos($callable, '::')); $className = substr($callable, 0, strpos($callable, '::'));