From 5fb005631a7de07db83ae8af894b7a600fe6004e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sat, 1 Mar 2014 21:22:01 +0100 Subject: [PATCH] Tweaking dispatchScript method to be in line with the rest, and add devMode to *_AUTOLOAD_DUMP events --- src/Composer/Autoload/AutoloadGenerator.php | 4 ++-- src/Composer/EventDispatcher/EventDispatcher.php | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index a0bf8c29f..3783bd22c 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/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) diff --git a/src/Composer/EventDispatcher/EventDispatcher.php b/src/Composer/EventDispatcher/EventDispatcher.php index f1e94e6d5..fb607831d 100644 --- a/src/Composer/EventDispatcher/EventDispatcher.php +++ b/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)); } /**