1
0
Fork 0

Allow PHP 5.2 autoloaders to consume namespace, classmap and include path files, fixes #1730

pull/1736/merge
Jordi Boggiano 2013-03-27 18:45:27 +01:00
parent 842155d69e
commit 3cc5698e7b
13 changed files with 17 additions and 16 deletions

View File

@ -48,6 +48,7 @@ class AutoloadGenerator
$relVendorPath = $filesystem->findShortestPath(getcwd(), $vendorPath, true);
$vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
$vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
$vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
$appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, getcwd(), true);
@ -58,7 +59,7 @@ class AutoloadGenerator
// autoload_namespaces.php generated by Composer
\$vendorDir = $vendorPathCode;
\$vendorDir = $vendorPathCode52;
\$baseDir = $appBaseDirCode;
return array(
@ -88,7 +89,7 @@ EOF;
// autoload_classmap.php generated by Composer
\$vendorDir = $vendorPathCode;
\$vendorDir = $vendorPathCode52;
\$baseDir = $appBaseDirCode;
return array(
@ -180,7 +181,7 @@ EOF;
file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
if ($includePathFile = $this->getIncludePathsFile($packageMap, $filesystem, $relVendorPath, $vendorPath, $vendorPathCode, $appBaseDirCode)) {
if ($includePathFile = $this->getIncludePathsFile($packageMap, $filesystem, $relVendorPath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
file_put_contents($targetDir.'/include_paths.php', $includePathFile);
}
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));

View File

@ -475,7 +475,7 @@ class AutoloadGeneratorTest extends TestCase
// autoload_namespaces.php generated by Composer
\$vendorDir = dirname(__DIR__);
\$vendorDir = dirname(dirname(__FILE__));
\$baseDir = dirname(\$vendorDir);
return array(
@ -491,7 +491,7 @@ EOF;
// autoload_classmap.php generated by Composer
\$vendorDir = dirname(__DIR__);
\$vendorDir = dirname(dirname(__FILE__));
\$baseDir = dirname(\$vendorDir);
return array(

View File

@ -2,7 +2,7 @@
// autoload_classmap.php generated by Composer
$vendorDir = dirname(__DIR__);
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(

View File

@ -2,7 +2,7 @@
// autoload_classmap.php generated by Composer
$vendorDir = dirname(__DIR__);
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname(dirname($vendorDir));
return array(

View File

@ -2,7 +2,7 @@
// autoload_classmap.php generated by Composer
$vendorDir = dirname(__DIR__);
$vendorDir = dirname(dirname(__FILE__));
$baseDir = $vendorDir;
return array(

View File

@ -2,7 +2,7 @@
// autoload_classmap.php generated by Composer
$vendorDir = dirname(__DIR__);
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(

View File

@ -2,7 +2,7 @@
// autoload_classmap.php generated by Composer
$vendorDir = dirname(__DIR__);
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(

View File

@ -2,7 +2,7 @@
// autoload_classmap.php generated by Composer
$vendorDir = dirname(__DIR__);
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(

View File

@ -2,7 +2,7 @@
// autoload_namespaces.php generated by Composer
$vendorDir = dirname(__DIR__);
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(

View File

@ -2,7 +2,7 @@
// autoload_namespaces.php generated by Composer
$vendorDir = dirname(__DIR__);
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname(dirname($vendorDir));
return array(

View File

@ -2,7 +2,7 @@
// autoload_namespaces.php generated by Composer
$vendorDir = dirname(__DIR__);
$vendorDir = dirname(dirname(__FILE__));
$baseDir = $vendorDir;
return array(

View File

@ -2,7 +2,7 @@
// autoload_namespaces.php generated by Composer
$vendorDir = dirname(__DIR__);
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(

View File

@ -2,7 +2,7 @@
// include_paths.php generated by Composer
$vendorDir = dirname(__DIR__);
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(