Speedup autoloading on PHP 5.6 & 7.0+ using static arrays
parent
40c14709f7
commit
fd2f51cea8
|
@ -27,7 +27,7 @@ matrix:
|
|||
|
||||
before_script:
|
||||
- rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
|
||||
- flags=""
|
||||
- flags="--prefer-dist"
|
||||
- composer install $flags
|
||||
- bin/composer install $flags
|
||||
- git config --global user.name travis-ci
|
||||
|
|
|
@ -28,7 +28,7 @@ install:
|
|||
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
|
||||
- appveyor DownloadFile https://getcomposer.org/composer.phar
|
||||
- cd c:\projects\composer
|
||||
- composer install --prefer-source --no-progress
|
||||
- composer install --prefer-dist --no-progress
|
||||
|
||||
test_script:
|
||||
- cd c:\projects\composer
|
||||
|
|
|
@ -285,6 +285,7 @@ EOF;
|
|||
}
|
||||
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
|
||||
file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader));
|
||||
file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath));
|
||||
|
||||
$this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
|
||||
$this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
|
||||
|
@ -578,17 +579,26 @@ HEADER;
|
|||
INCLUDE_PATH;
|
||||
}
|
||||
|
||||
$file .= <<<STATIC_INIT
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
|
||||
} else {
|
||||
|
||||
STATIC_INIT;
|
||||
|
||||
if (!$this->classMapAuthoritative) {
|
||||
$file .= <<<'PSR04'
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
|
||||
PSR04;
|
||||
|
@ -596,15 +606,16 @@ PSR04;
|
|||
|
||||
if ($useClassMap) {
|
||||
$file .= <<<'CLASSMAP'
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
|
||||
CLASSMAP;
|
||||
}
|
||||
|
||||
$file .= " }\n\n";
|
||||
|
||||
if ($this->classMapAuthoritative) {
|
||||
$file .= <<<'CLASSMAPAUTHORITATIVE'
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
|
@ -635,7 +646,11 @@ REGISTER_LOADER;
|
|||
|
||||
if ($useIncludeFiles) {
|
||||
$file .= <<<INCLUDE_FILES
|
||||
\$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
\$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
|
||||
} else {
|
||||
\$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach (\$includeFiles as \$fileIdentifier => \$file) {
|
||||
composerRequire$suffix(\$fileIdentifier, \$file);
|
||||
}
|
||||
|
@ -674,6 +689,84 @@ FOOTER;
|
|||
FOOTER;
|
||||
}
|
||||
|
||||
protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath)
|
||||
{
|
||||
$file = <<<HEADER
|
||||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit$suffix
|
||||
{
|
||||
|
||||
HEADER;
|
||||
|
||||
$loader = new ClassLoader();
|
||||
|
||||
$map = require $targetDir . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$map = require $targetDir . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require $targetDir . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
|
||||
$filesystem = new Filesystem();
|
||||
|
||||
$vendorPathCode = ' ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '";
|
||||
$appBaseDirCode = ' ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '";
|
||||
|
||||
$absoluteVendorPathCode = ' ' . substr(var_export($vendorDir, true), 0, -1);
|
||||
$absoluteAppBaseDirCode = ' ' . substr(var_export($baseDir, true), 0, -1);
|
||||
|
||||
$initializer = '';
|
||||
$prefix = "\0Composer\Autoload\ClassLoader\0";
|
||||
$prefixLen = strlen($prefix);
|
||||
if (file_exists($targetDir . '/autoload_files.php')) {
|
||||
$maps = array('files' => require $targetDir . '/autoload_files.php');
|
||||
} else {
|
||||
$maps = array();
|
||||
}
|
||||
|
||||
foreach ((array) $loader as $prop => $value) {
|
||||
if ($value && 0 === strpos($prop, $prefix)) {
|
||||
$maps[substr($prop, $prefixLen)] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($maps as $prop => $value) {
|
||||
$value = var_export($value, true);
|
||||
$value = str_replace($absoluteVendorPathCode, $vendorPathCode, $value);
|
||||
$value = str_replace($absoluteAppBaseDirCode, $appBaseDirCode, $value);
|
||||
$value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
|
||||
|
||||
$file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
|
||||
if ('files' !== $prop) {
|
||||
$initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $file . <<<INITIALIZER
|
||||
public static function getInitializer(ClassLoader \$loader)
|
||||
{
|
||||
return \Closure::bind(function () use (\$loader) {
|
||||
$initializer
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
||||
|
||||
INITIALIZER;
|
||||
}
|
||||
|
||||
protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
|
||||
{
|
||||
$autoloads = array();
|
||||
|
|
|
@ -133,6 +133,7 @@ class Compiler
|
|||
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/composer/autoload_classmap.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/composer/autoload_files.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/composer/autoload_real.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/composer/autoload_static.php'));
|
||||
if (file_exists(__DIR__.'/../../vendor/composer/include_paths.php')) {
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/composer/include_paths.php'));
|
||||
}
|
||||
|
|
|
@ -358,10 +358,11 @@ class Filesystem
|
|||
* @param string $from
|
||||
* @param string $to
|
||||
* @param bool $directories if true, the source/target are considered to be directories
|
||||
* @param bool $staticCode
|
||||
* @throws \InvalidArgumentException
|
||||
* @return string
|
||||
*/
|
||||
public function findShortestPathCode($from, $to, $directories = false)
|
||||
public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
|
||||
{
|
||||
if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
|
||||
throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
|
||||
|
@ -388,7 +389,11 @@ class Filesystem
|
|||
return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
|
||||
}
|
||||
$sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
|
||||
$commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
|
||||
if ($staticCode) {
|
||||
$commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
|
||||
} else {
|
||||
$commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
|
||||
}
|
||||
$relTarget = substr($to, strlen($commonPath));
|
||||
|
||||
return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
|
||||
|
|
|
@ -351,6 +351,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'TargetDir');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_target_dir.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_real_target_dir.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_static_target_dir.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_files_target_dir.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
$this->assertAutoloadFiles('classmap6', $this->vendorDir.'/composer', 'classmap');
|
||||
}
|
||||
|
@ -580,6 +581,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'FilesAutoload');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_real_functions.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_static_functions.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_files_functions.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
|
||||
include $this->vendorDir . '/autoload.php';
|
||||
|
@ -639,6 +641,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
$this->generator->dump($this->config, $this->repository, $autoloadPackage, $this->im, 'composer', false, 'FilesAutoload');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_real_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_static_functions_with_include_paths.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_files_functions.php', $this->vendorDir.'/composer/autoload_files.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/include_paths_functions.php', $this->vendorDir.'/composer/include_paths.php');
|
||||
|
||||
|
@ -651,6 +654,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
$this->generator->dump($this->config, $this->repository, $notAutoloadPackage, $this->im, 'composer', false, 'FilesAutoload');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_functions.php', $this->vendorDir.'/autoload.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_real_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_static_functions_with_removed_include_paths_and_autolad_files.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
$this->assertFileNotExists($this->vendorDir.'/composer/autoload_files.php');
|
||||
$this->assertFileNotExists($this->vendorDir.'/composer/include_paths.php');
|
||||
}
|
||||
|
@ -703,6 +707,7 @@ class AutoloadGeneratorTest extends TestCase
|
|||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'FilesAutoloadOrder');
|
||||
$this->assertFileEquals(__DIR__ . '/Fixtures/autoload_functions_by_dependency.php', $this->vendorDir . '/autoload.php');
|
||||
$this->assertFileEquals(__DIR__ . '/Fixtures/autoload_real_files_by_dependency.php', $this->vendorDir . '/composer/autoload_real.php');
|
||||
$this->assertFileEquals(__DIR__ . '/Fixtures/autoload_static_files_by_dependency.php', $this->vendorDir . '/composer/autoload_static.php');
|
||||
|
||||
require $this->vendorDir . '/autoload.php';
|
||||
|
||||
|
@ -966,6 +971,7 @@ EOF;
|
|||
|
||||
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'IncludePath');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_real_include_path.php', $this->vendorDir.'/composer/autoload_real.php');
|
||||
$this->assertFileEquals(__DIR__.'/Fixtures/autoload_static_include_path.php', $this->vendorDir.'/composer/autoload_static.php');
|
||||
}
|
||||
|
||||
public function testVendorDirExcludedFromWorkingDir()
|
||||
|
|
|
@ -23,24 +23,34 @@ class ComposerAutoloaderInitFilesAutoloadOrder
|
|||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader'));
|
||||
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
\call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoloadOrder::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitFilesAutoloadOrder::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequireFilesAutoloadOrder($fileIdentifier, $file);
|
||||
}
|
||||
|
|
|
@ -23,24 +23,34 @@ class ComposerAutoloaderInitFilesAutoload
|
|||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
|
||||
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
\call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitFilesAutoload::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequireFilesAutoload($fileIdentifier, $file);
|
||||
}
|
||||
|
|
|
@ -27,24 +27,34 @@ class ComposerAutoloaderInitFilesAutoload
|
|||
array_push($includePaths, get_include_path());
|
||||
set_include_path(join(PATH_SEPARATOR, $includePaths));
|
||||
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
\call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitFilesAutoload::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequireFilesAutoload($fileIdentifier, $file);
|
||||
}
|
||||
|
|
|
@ -23,19 +23,25 @@ class ComposerAutoloaderInitFilesAutoload
|
|||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
|
||||
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
\call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->register(true);
|
||||
|
|
|
@ -23,19 +23,25 @@ class ComposerAutoloaderInitIncludePath
|
|||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader'));
|
||||
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
\call_user_func(\Composer\Autoload\ComposerStaticInitIncludePath::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->setUseIncludePath(true);
|
||||
|
|
|
@ -23,26 +23,36 @@ class ComposerAutoloaderInitTargetDir
|
|||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader'));
|
||||
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
\call_user_func(\Composer\Autoload\ComposerStaticInitTargetDir::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitTargetDir', 'autoload'), true, true);
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
if (PHP_VERSION_ID >= 50600) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInitTargetDir::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequireTargetDir($fileIdentifier, $file);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitFilesAutoloadOrder
|
||||
{
|
||||
public static $files = array (
|
||||
'bfdd693009729d60c830ff8d79129635' => __DIR__ . '/..' . '/c/lorem/testC.php',
|
||||
'61e6098c8cafe404d6cf19e59fc2b788' => __DIR__ . '/..' . '/d/d/testD.php',
|
||||
'8bceec6fdc149a1a6acbf7ad3cfed51c' => __DIR__ . '/..' . '/z/foo/testA.php',
|
||||
'c5466e580c6c2403f225c43b6a21a96f' => __DIR__ . '/..' . '/b/bar/testB.php',
|
||||
'69dfc37c40a853a7cbac6c9d2367c5f4' => __DIR__ . '/..' . '/e/e/testE.php',
|
||||
'334307692417e52db5a08c3271700a7e' => __DIR__ . '/../..' . '/root2.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitFilesAutoload
|
||||
{
|
||||
public static $files = array (
|
||||
'6d9003eea93a81f3586b5d9c5bd91272' => __DIR__ . '/..' . '/a/a/test.php',
|
||||
'e56cac94f86c787e1efd645809df361d' => __DIR__ . '/..' . '/b/b/test2.php',
|
||||
'df8470dfa2ebd6b31da05b60fb4ec29a' => __DIR__ . '/..' . '/c/c/foo/bar/test3.php',
|
||||
'68f1e24e6cd39de885cb5a47678e6518' => __DIR__ . '/..' . '/c/c/foo/bar/test4.php',
|
||||
'61b776fd0ee84fb7d7d958ae46118ded' => __DIR__ . '/../..' . '/root.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitFilesAutoload
|
||||
{
|
||||
public static $files = array (
|
||||
'6d9003eea93a81f3586b5d9c5bd91272' => __DIR__ . '/..' . '/a/a/test.php',
|
||||
'e56cac94f86c787e1efd645809df361d' => __DIR__ . '/..' . '/b/b/test2.php',
|
||||
'df8470dfa2ebd6b31da05b60fb4ec29a' => __DIR__ . '/..' . '/c/c/foo/bar/test3.php',
|
||||
'68f1e24e6cd39de885cb5a47678e6518' => __DIR__ . '/..' . '/c/c/foo/bar/test4.php',
|
||||
'61b776fd0ee84fb7d7d958ae46118ded' => __DIR__ . '/../..' . '/root.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitFilesAutoload
|
||||
{
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitIncludePath
|
||||
{
|
||||
public static $prefixesPsr0 = array (
|
||||
'M' =>
|
||||
array (
|
||||
'Main\\Foo' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/',
|
||||
),
|
||||
'Main\\Bar' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixesPsr0 = ComposerStaticInitIncludePath::$prefixesPsr0;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitTargetDir
|
||||
{
|
||||
public static $files = array (
|
||||
'b419c11b924de79ffa740afc29a3dc16' => __DIR__ . '/../..' . '/foo.php',
|
||||
'f558c96fbd0535aaa98981fa59ff7594' => __DIR__ . '/../..' . '/bar.php',
|
||||
);
|
||||
|
||||
public static $prefixesPsr0 = array (
|
||||
'M' =>
|
||||
array (
|
||||
'Main\\Foo' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/',
|
||||
),
|
||||
'Main\\Bar' =>
|
||||
array (
|
||||
0 => __DIR__ . '/../..' . '/',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'ClassMapBar' => __DIR__ . '/../..' . '/lib/rootbar.php',
|
||||
'ClassMapFoo' => __DIR__ . '/../..' . '/src/rootfoo.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixesPsr0 = ComposerStaticInitTargetDir::$prefixesPsr0;
|
||||
$loader->classMap = ComposerStaticInitTargetDir::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue