From 42b025776a5869d7f98603ecc1057c312d766f4a Mon Sep 17 00:00:00 2001 From: Jonathan Eskew Date: Tue, 30 Jun 2015 09:22:51 -0700 Subject: [PATCH] Move file identifier calculation to compile time --- src/Composer/Autoload/AutoloadGenerator.php | 27 ++++++++++++------- .../Test/Autoload/AutoloadGeneratorTest.php | 6 ++--- .../Test/Autoload/Fixtures/autoload_files.php | 4 +-- .../Autoload/Fixtures/autoload_files2.php | 2 +- .../Fixtures/autoload_files_functions.php | 10 +++---- .../Fixtures/autoload_files_target_dir.php | 4 +-- .../autoload_real_files_by_dependency.php | 11 ++++---- .../Fixtures/autoload_real_functions.php | 11 ++++---- .../Fixtures/autoload_real_include_path.php | 7 +++-- .../Fixtures/autoload_real_target_dir.php | 11 ++++---- 10 files changed, 49 insertions(+), 44 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index eb176bc5c..1a4fd267f 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -410,8 +410,9 @@ EOF; protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode) { $filesCode = ''; - foreach ($files as $functionFile) { - $filesCode .= ' '.$this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile).",\n"; + foreach ($files as $fileIdentifier => $functionFile) { + $filesCode .= ' ' . $fileIdentifier . ' => ' + . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n"; } if (!$filesCode) { @@ -584,8 +585,8 @@ REGISTER_LOADER; if ($useIncludeFiles) { $file .= << \$file) { + composerRequire$suffix(\$fileIdentifier, \$file); } @@ -603,17 +604,16 @@ METHOD_FOOTER; return $file . <<