Browse Source

Throw an exception if no listeners have been found for given event.

Max Gfeller 11 years ago
parent
commit
f1c1ba27b4
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/Composer/EventDispatcher/EventDispatcher.php

+ 4 - 0
src/Composer/EventDispatcher/EventDispatcher.php

@@ -118,6 +118,10 @@ class EventDispatcher
     {
         $listeners = $this->getListeners($event);
 
+        if(sizeof($listeners) === 0) {
+            throw new \InvalidArgumentException(sprintf('Script "%s" does not exist', $event->getName()));
+        }
+
         foreach ($listeners as $callable) {
             if (!is_string($callable) && is_callable($callable)) {
                 call_user_func($callable, $event);