From e0a6419992e760fad2dd3d605d8b03b0d0184207 Mon Sep 17 00:00:00 2001 From: David Walker Date: Wed, 28 Oct 2015 14:29:36 -0600 Subject: [PATCH] When classmap authoratative is enabled, there should be no reason to load 3 files, and process them when autoloader will return false --- src/Composer/Autoload/AutoloadGenerator.php | 34 +++++++++++---------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index c170d41f6..2baba5b1b 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -544,33 +544,35 @@ class ComposerAutoloaderInit$suffix HEADER; - if ($useIncludePath) { - $file .= <<<'INCLUDE_PATH' - $includePaths = require __DIR__ . '/include_paths.php'; - array_push($includePaths, get_include_path()); - set_include_path(join(PATH_SEPARATOR, $includePaths)); + if (!$this->classMapAuthoritative) { + if ($useIncludePath) { + $file .= <<<'INCLUDE_PATH' + $includePaths = require __DIR__ . '/include_paths.php'; + array_push($includePaths, get_include_path()); + set_include_path(join(PATH_SEPARATOR, $includePaths)); INCLUDE_PATH; - } + } - $file .= <<<'PSR0' - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } + $file .= <<<'PSR0' + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } PSR0; - $file .= <<<'PSR4' - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } + $file .= <<<'PSR4' + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } PSR4; + } if ($useClassMap) { $file .= <<<'CLASSMAP'