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