diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index 2a377bc51..99263c0bf 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -27,13 +27,16 @@ class AutoloadGenerator { public function dump(RepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir) { - $autoloadFile = file_get_contents(__DIR__.'/ClassLoader.php'); - $autoloadFile .= <<<'EOF' + $autoloadFile = <<<'EOF' +register(); return $loader; -} +}; -return init(); +return $__composer_autoload_init(); EOF; $filesystem = new Filesystem(); @@ -117,6 +120,8 @@ EOF; file_put_contents($targetDir.'/autoload.php', $autoloadFile); file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile); + file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile); + copy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php'); } /**