Browse Source

Accessing to option 'optimize-autoloder' inside 'post-autoload-dump' script event.

Artur Eshenbrener 10 years ago
parent
commit
ad1d0be420
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/Composer/Autoload/AutoloadGenerator.php

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

@@ -53,7 +53,9 @@ 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->devMode);
+        $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(
+            'optimize' => (bool) $scanPsr0Packages
+        ));
 
         $filesystem = new Filesystem();
         $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
@@ -235,7 +237,9 @@ EOF;
         fclose($targetLoader);
         unset($sourceLoader, $targetLoader);
 
-        $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode);
+        $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, [
+            'optimize' => (bool) $scanPsr0Packages,
+        ]);
     }
 
     public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)