1
0
Fork 0

Require file autoloads after the autoloader is registered

pull/837/head
Jordi Boggiano 2012-06-25 11:39:51 +02:00
parent fd776853a4
commit adaa788955
2 changed files with 9 additions and 9 deletions

View File

@ -124,7 +124,7 @@ EOF;
$filesCode = ""; $filesCode = "";
$autoloads['files'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['files'])); $autoloads['files'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['files']));
foreach ($autoloads['files'] as $functionFile) { foreach ($autoloads['files'] as $functionFile) {
$filesCode .= 'require __DIR__ . '. var_export('/'.$filesystem->findShortestPath($vendorPath, $functionFile), true).";\n"; $filesCode .= ' require __DIR__ . '. var_export('/'.$filesystem->findShortestPath($vendorPath, $functionFile), true).";\n";
} }
file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile); file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
@ -286,7 +286,7 @@ EOF;
if (!class_exists('Composer\\\\Autoload\\\\ClassLoader', false)) { if (!class_exists('Composer\\\\Autoload\\\\ClassLoader', false)) {
require $vendorPathToTargetDirCode . '/ClassLoader.php'; require $vendorPathToTargetDirCode . '/ClassLoader.php';
} }
$filesCode
return call_user_func(function() { return call_user_func(function() {
\$loader = new \\Composer\\Autoload\\ClassLoader(); \$loader = new \\Composer\\Autoload\\ClassLoader();
\$composerDir = $vendorPathToTargetDirCode; \$composerDir = $vendorPathToTargetDirCode;
@ -328,10 +328,10 @@ CLASSMAP;
$file .= $targetDirLoader; $file .= $targetDirLoader;
return $file . <<<'FOOTER' return $file . <<<FOOTER
$loader->register(); \$loader->register();
$filesCode
return $loader; return \$loader;
}); });
FOOTER; FOOTER;

View File

@ -5,9 +5,6 @@ if (!class_exists('Composer\\Autoload\\ClassLoader', false)) {
require __DIR__ . '/composer' . '/ClassLoader.php'; require __DIR__ . '/composer' . '/ClassLoader.php';
} }
require __DIR__ . '/a/a/test.php';
require __DIR__ . '/b/b/test2.php';
return call_user_func(function() { return call_user_func(function() {
$loader = new \Composer\Autoload\ClassLoader(); $loader = new \Composer\Autoload\ClassLoader();
$composerDir = __DIR__ . '/composer'; $composerDir = __DIR__ . '/composer';
@ -24,5 +21,8 @@ return call_user_func(function() {
$loader->register(); $loader->register();
require __DIR__ . '/a/a/test.php';
require __DIR__ . '/b/b/test2.php';
return $loader; return $loader;
}); });