From f627c3c6039647977ce5c9d15882d5fa6401d804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ronny=20Lo=CC=81pez?= Date: Thu, 10 Jan 2013 18:12:46 +0100 Subject: [PATCH] Make Event devMode argument optional (false by default). --- src/Composer/Autoload/AutoloadGenerator.php | 2 +- src/Composer/Script/Event.php | 2 +- src/Composer/Script/EventDispatcher.php | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index a7030738f..826ddeff6 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -186,7 +186,7 @@ EOF; file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, true, (bool) $includePathFile, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix)); copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php'); - $this->eventDispatcher->dispatch(ScriptEvents::POST_AUTOLOAD_DUMP, false); + $this->eventDispatcher->dispatch(ScriptEvents::POST_AUTOLOAD_DUMP); } public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages) diff --git a/src/Composer/Script/Event.php b/src/Composer/Script/Event.php index d9be6a944..cafea2948 100644 --- a/src/Composer/Script/Event.php +++ b/src/Composer/Script/Event.php @@ -50,7 +50,7 @@ class Event * @param IOInterface $io The IOInterface object * @param boolean $devMode Whether or not we are in dev mode */ - public function __construct($name, Composer $composer, IOInterface $io, $devMode) + public function __construct($name, Composer $composer, IOInterface $io, $devMode = false) { $this->name = $name; $this->composer = $composer; diff --git a/src/Composer/Script/EventDispatcher.php b/src/Composer/Script/EventDispatcher.php index 43ac58581..c24ea21ae 100644 --- a/src/Composer/Script/EventDispatcher.php +++ b/src/Composer/Script/EventDispatcher.php @@ -55,11 +55,15 @@ class EventDispatcher * Dispatch a script event. * * @param string $eventName The constant in ScriptEvents - * @param boolean $devMode Whether or not we are in dev mode + * @param Event $event */ - public function dispatch($eventName, $devMode) + public function dispatch($eventName, Event $event = null) { - $this->doDispatch(new Event($eventName, $this->composer, $this->io, $devMode)); + if (null == $event) { + $event = new Event($eventName, $this->composer, $this->io); + } + + $this->doDispatch($event); } /**