Browse Source

Tweaking dispatchScript method to be in line with the rest, and add devMode to *_AUTOLOAD_DUMP events

Jordi Boggiano 11 years ago
parent
commit
5fb005631a

+ 2 - 2
src/Composer/Autoload/AutoloadGenerator.php

@@ -46,7 +46,7 @@ class AutoloadGenerator
 
     public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
     {
-        $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP);
+        $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode);
 
         $filesystem = new Filesystem();
         $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
@@ -228,7 +228,7 @@ EOF;
         fclose($targetLoader);
         unset($sourceLoader, $targetLoader);
 
-        $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP);
+        $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode);
     }
 
     public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)

+ 2 - 6
src/Composer/EventDispatcher/EventDispatcher.php

@@ -75,13 +75,9 @@ class EventDispatcher
      * @param string       $eventName The constant in ScriptEvents
      * @param Script\Event $event
      */
-    public function dispatchScript($eventName, Script\Event $event = null)
+    public function dispatchScript($eventName, $devMode = false)
     {
-        if (null == $event) {
-            $event = new Script\Event($eventName, $this->composer, $this->io);
-        }
-
-        $this->doDispatch($event);
+        $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode));
     }
 
     /**