autoload_files.php should return an array of files, instead of directly including them.
parent
8e9bdfb4da
commit
5369904dd3
|
@ -300,13 +300,12 @@ EOF;
|
|||
$filesCode = '';
|
||||
$files = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($files));
|
||||
foreach ($files as $functionFile) {
|
||||
$filesCode .= 'require '.$this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile).";\n";
|
||||
$filesCode .= ' '.$this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile).",\n";
|
||||
}
|
||||
|
||||
if (!$filesCode) {
|
||||
return FALSE;
|
||||
}
|
||||
$filesCode = rtrim($filesCode);
|
||||
|
||||
return <<<EOF
|
||||
<?php
|
||||
|
@ -316,7 +315,8 @@ EOF;
|
|||
\$vendorDir = $vendorPathCode;
|
||||
\$baseDir = $appBaseDirCode;
|
||||
|
||||
$filesCode
|
||||
return array(
|
||||
$filesCode);
|
||||
EOF;
|
||||
}
|
||||
|
||||
|
@ -457,7 +457,9 @@ REGISTER_LOADER;
|
|||
|
||||
if ($useIncludeFiles) {
|
||||
$file .= <<<INCLUDE_FILES
|
||||
require __DIR__ . '/autoload_files.php';
|
||||
foreach (require __DIR__ . '/autoload_files.php' as \$file) {
|
||||
require \$file;
|
||||
}
|
||||
|
||||
|
||||
INCLUDE_FILES;
|
||||
|
|
|
@ -755,8 +755,8 @@ EOF;
|
|||
|
||||
$this->assertEquals($expectedNamespace, file_get_contents($vendorDir.'/composer/autoload_namespaces.php'));
|
||||
$this->assertEquals($expectedClassmap, file_get_contents($vendorDir.'/composer/autoload_classmap.php'));
|
||||
$this->assertContains("require \$vendorDir . '/b/b/bootstrap.php';", file_get_contents($vendorDir.'/composer/autoload_files.php'));
|
||||
$this->assertContains("require \$baseDir . '/test.php';", file_get_contents($vendorDir.'/composer/autoload_files.php'));
|
||||
$this->assertContains("\n \$vendorDir . '/b/b/bootstrap.php',\n", file_get_contents($vendorDir.'/composer/autoload_files.php'));
|
||||
$this->assertContains("\n \$baseDir . '/test.php',\n", file_get_contents($vendorDir.'/composer/autoload_files.php'));
|
||||
}
|
||||
|
||||
public function testUpLevelRelativePaths()
|
||||
|
@ -815,7 +815,7 @@ EOF;
|
|||
|
||||
$this->assertEquals($expectedNamespace, file_get_contents($this->vendorDir.'/composer/autoload_namespaces.php'));
|
||||
$this->assertEquals($expectedClassmap, file_get_contents($this->vendorDir.'/composer/autoload_classmap.php'));
|
||||
$this->assertContains("require \$baseDir . '/../test.php';", file_get_contents($this->vendorDir.'/composer/autoload_files.php'));
|
||||
$this->assertContains("\n \$baseDir . '/../test.php',\n", file_get_contents($this->vendorDir.'/composer/autoload_files.php'));
|
||||
}
|
||||
|
||||
public function testEmptyPaths()
|
||||
|
|
|
@ -5,5 +5,7 @@
|
|||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
require $baseDir . '/foo.php';
|
||||
require $baseDir . '/bar.php';
|
||||
return array(
|
||||
$baseDir . '/foo.php',
|
||||
$baseDir . '/bar.php',
|
||||
);
|
|
@ -5,9 +5,11 @@
|
|||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
require $vendorDir . '/c/lorem/testC.php';
|
||||
require $vendorDir . '/z/foo/testA.php';
|
||||
require $vendorDir . '/d/d/testD.php';
|
||||
require $vendorDir . '/b/bar/testB.php';
|
||||
require $vendorDir . '/e/e/testE.php';
|
||||
require $baseDir . '/root.php';
|
||||
return array(
|
||||
$vendorDir . '/c/lorem/testC.php',
|
||||
$vendorDir . '/z/foo/testA.php',
|
||||
$vendorDir . '/d/d/testD.php',
|
||||
$vendorDir . '/b/bar/testB.php',
|
||||
$vendorDir . '/e/e/testE.php',
|
||||
$baseDir . '/root.php',
|
||||
);
|
|
@ -5,8 +5,10 @@
|
|||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
require $vendorDir . '/a/a/test.php';
|
||||
require $vendorDir . '/b/b/test2.php';
|
||||
require $vendorDir . '/c/c/foo/bar/test3.php';
|
||||
require $baseDir . '/root.php';
|
||||
require $vendorDir . '/c/c/foo/bar/test4.php';
|
||||
return array(
|
||||
$vendorDir . '/a/a/test.php',
|
||||
$vendorDir . '/b/b/test2.php',
|
||||
$vendorDir . '/c/c/foo/bar/test3.php',
|
||||
$baseDir . '/root.php',
|
||||
$vendorDir . '/c/c/foo/bar/test4.php',
|
||||
);
|
|
@ -5,5 +5,7 @@
|
|||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
require $baseDir . '/foo.php';
|
||||
require $baseDir . '/bar.php';
|
||||
return array(
|
||||
$baseDir . '/foo.php',
|
||||
$baseDir . '/bar.php',
|
||||
);
|
|
@ -38,7 +38,9 @@ class ComposerAutoloaderInitFilesAutoloadOrder
|
|||
|
||||
$loader->register(true);
|
||||
|
||||
require __DIR__ . '/autoload_files.php';
|
||||
foreach (require __DIR__ . '/autoload_files.php' as $file) {
|
||||
require $file;
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,9 @@ class ComposerAutoloaderInitFilesAutoload
|
|||
|
||||
$loader->register(true);
|
||||
|
||||
require __DIR__ . '/autoload_files.php';
|
||||
foreach (require __DIR__ . '/autoload_files.php' as $file) {
|
||||
require $file;
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,9 @@ class ComposerAutoloaderInitTargetDir
|
|||
|
||||
$loader->register(true);
|
||||
|
||||
require __DIR__ . '/autoload_files.php';
|
||||
foreach (require __DIR__ . '/autoload_files.php' as $file) {
|
||||
require $file;
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue