1
0
Fork 0

Merge remote-tracking branch 'nicolas-grekas/php7-static'

pull/5183/head
Jordi Boggiano 2016-04-11 19:18:22 +01:00
commit d20d856aa8
18 changed files with 401 additions and 88 deletions

View File

@ -27,7 +27,7 @@ matrix:
before_script: before_script:
- rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini - rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
- flags="" - flags="--prefer-dist"
- composer install $flags - composer install $flags
- bin/composer install $flags - bin/composer install $flags
- git config --global user.name travis-ci - git config --global user.name travis-ci

View File

@ -28,7 +28,7 @@ install:
- IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat - IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat
- appveyor DownloadFile https://getcomposer.org/composer.phar - appveyor DownloadFile https://getcomposer.org/composer.phar
- cd c:\projects\composer - cd c:\projects\composer
- composer install --prefer-source --no-progress - composer install --prefer-dist --no-progress
test_script: test_script:
- cd c:\projects\composer - cd c:\projects\composer

View File

@ -285,6 +285,7 @@ EOF;
} }
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix)); 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_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__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
$this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE'); $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
@ -578,6 +579,15 @@ HEADER;
INCLUDE_PATH; 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) { if (!$this->classMapAuthoritative) {
$file .= <<<'PSR04' $file .= <<<'PSR04'
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
@ -601,10 +611,11 @@ PSR04;
$loader->addClassMap($classMap); $loader->addClassMap($classMap);
} }
CLASSMAP; CLASSMAP;
} }
$file .= " }\n\n";
if ($this->classMapAuthoritative) { if ($this->classMapAuthoritative) {
$file .= <<<'CLASSMAPAUTHORITATIVE' $file .= <<<'CLASSMAPAUTHORITATIVE'
$loader->setClassMapAuthoritative(true); $loader->setClassMapAuthoritative(true);
@ -635,7 +646,11 @@ REGISTER_LOADER;
if ($useIncludeFiles) { if ($useIncludeFiles) {
$file .= <<<INCLUDE_FILES $file .= <<<INCLUDE_FILES
if (PHP_VERSION_ID >= 50600) {
\$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
} else {
\$includeFiles = require __DIR__ . '/autoload_files.php'; \$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach (\$includeFiles as \$fileIdentifier => \$file) { foreach (\$includeFiles as \$fileIdentifier => \$file) {
composerRequire$suffix(\$fileIdentifier, \$file); composerRequire$suffix(\$fileIdentifier, \$file);
} }
@ -674,6 +689,84 @@ FOOTER;
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) protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
{ {
$autoloads = array(); $autoloads = array();

View File

@ -136,6 +136,7 @@ class Compiler
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/composer/autoload_classmap.php')); $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_files.php'));
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/composer/autoload_real.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')) { if (file_exists(__DIR__.'/../../vendor/composer/include_paths.php')) {
$this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/composer/include_paths.php')); $this->addFile($phar, new \SplFileInfo(__DIR__.'/../../vendor/composer/include_paths.php'));
} }

View File

@ -358,10 +358,11 @@ class Filesystem
* @param string $from * @param string $from
* @param string $to * @param string $to
* @param bool $directories if true, the source/target are considered to be directories * @param bool $directories if true, the source/target are considered to be directories
* @param bool $staticCode
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @return string * @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)) { if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $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); return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
} }
$sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories; $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
if ($staticCode) {
$commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
} else {
$commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth); $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
}
$relTarget = substr($to, strlen($commonPath)); $relTarget = substr($to, strlen($commonPath));
return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : ''); return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');

View File

@ -351,6 +351,7 @@ class AutoloadGeneratorTest extends TestCase
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'TargetDir'); $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_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_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->assertFileEquals(__DIR__.'/Fixtures/autoload_files_target_dir.php', $this->vendorDir.'/composer/autoload_files.php');
$this->assertAutoloadFiles('classmap6', $this->vendorDir.'/composer', 'classmap'); $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->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_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_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'); $this->assertFileEquals(__DIR__.'/Fixtures/autoload_files_functions.php', $this->vendorDir.'/composer/autoload_files.php');
include $this->vendorDir . '/autoload.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->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_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_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/autoload_files_functions.php', $this->vendorDir.'/composer/autoload_files.php');
$this->assertFileEquals(__DIR__.'/Fixtures/include_paths_functions.php', $this->vendorDir.'/composer/include_paths.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->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_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_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/autoload_files.php');
$this->assertFileNotExists($this->vendorDir.'/composer/include_paths.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->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_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_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'; require $this->vendorDir . '/autoload.php';
@ -966,6 +971,7 @@ EOF;
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', false, 'IncludePath'); $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_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() public function testVendorDirExcludedFromWorkingDir()

View File

@ -23,6 +23,11 @@ class ComposerAutoloaderInitFilesAutoloadOrder
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoloadOrder', 'loadClassLoader'));
if (PHP_VERSION_ID >= 50600) {
require_once __DIR__ . '/autoload_static.php';
\call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoloadOrder::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
$loader->set($namespace, $path); $loader->set($namespace, $path);
@ -37,10 +42,15 @@ class ComposerAutoloaderInitFilesAutoloadOrder
if ($classMap) { if ($classMap) {
$loader->addClassMap($classMap); $loader->addClassMap($classMap);
} }
}
$loader->register(true); $loader->register(true);
if (PHP_VERSION_ID >= 50600) {
$includeFiles = Composer\Autoload\ComposerStaticInitFilesAutoloadOrder::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireFilesAutoloadOrder($fileIdentifier, $file); composerRequireFilesAutoloadOrder($fileIdentifier, $file);
} }

View File

@ -23,6 +23,11 @@ class ComposerAutoloaderInitFilesAutoload
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
if (PHP_VERSION_ID >= 50600) {
require_once __DIR__ . '/autoload_static.php';
\call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
$loader->set($namespace, $path); $loader->set($namespace, $path);
@ -37,10 +42,15 @@ class ComposerAutoloaderInitFilesAutoload
if ($classMap) { if ($classMap) {
$loader->addClassMap($classMap); $loader->addClassMap($classMap);
} }
}
$loader->register(true); $loader->register(true);
if (PHP_VERSION_ID >= 50600) {
$includeFiles = Composer\Autoload\ComposerStaticInitFilesAutoload::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireFilesAutoload($fileIdentifier, $file); composerRequireFilesAutoload($fileIdentifier, $file);
} }

View File

@ -27,6 +27,11 @@ class ComposerAutoloaderInitFilesAutoload
array_push($includePaths, get_include_path()); array_push($includePaths, get_include_path());
set_include_path(join(PATH_SEPARATOR, $includePaths)); set_include_path(join(PATH_SEPARATOR, $includePaths));
if (PHP_VERSION_ID >= 50600) {
require_once __DIR__ . '/autoload_static.php';
\call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
$loader->set($namespace, $path); $loader->set($namespace, $path);
@ -41,10 +46,15 @@ class ComposerAutoloaderInitFilesAutoload
if ($classMap) { if ($classMap) {
$loader->addClassMap($classMap); $loader->addClassMap($classMap);
} }
}
$loader->register(true); $loader->register(true);
if (PHP_VERSION_ID >= 50600) {
$includeFiles = Composer\Autoload\ComposerStaticInitFilesAutoload::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireFilesAutoload($fileIdentifier, $file); composerRequireFilesAutoload($fileIdentifier, $file);
} }

View File

@ -23,6 +23,11 @@ class ComposerAutoloaderInitFilesAutoload
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitFilesAutoload', 'loadClassLoader'));
if (PHP_VERSION_ID >= 50600) {
require_once __DIR__ . '/autoload_static.php';
\call_user_func(\Composer\Autoload\ComposerStaticInitFilesAutoload::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
$loader->set($namespace, $path); $loader->set($namespace, $path);
@ -37,6 +42,7 @@ class ComposerAutoloaderInitFilesAutoload
if ($classMap) { if ($classMap) {
$loader->addClassMap($classMap); $loader->addClassMap($classMap);
} }
}
$loader->register(true); $loader->register(true);

View File

@ -23,6 +23,11 @@ class ComposerAutoloaderInitIncludePath
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitIncludePath', 'loadClassLoader'));
if (PHP_VERSION_ID >= 50600) {
require_once __DIR__ . '/autoload_static.php';
\call_user_func(\Composer\Autoload\ComposerStaticInitIncludePath::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
$loader->set($namespace, $path); $loader->set($namespace, $path);
@ -37,6 +42,7 @@ class ComposerAutoloaderInitIncludePath
if ($classMap) { if ($classMap) {
$loader->addClassMap($classMap); $loader->addClassMap($classMap);
} }
}
$loader->setUseIncludePath(true); $loader->setUseIncludePath(true);
spl_autoload_register(array('ComposerAutoloaderInitIncludePath', 'autoload'), true, true); spl_autoload_register(array('ComposerAutoloaderInitIncludePath', 'autoload'), true, true);

View File

@ -23,6 +23,11 @@ class ComposerAutoloaderInitTargetDir
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitTargetDir', 'loadClassLoader'));
if (PHP_VERSION_ID >= 50600) {
require_once __DIR__ . '/autoload_static.php';
\call_user_func(\Composer\Autoload\ComposerStaticInitTargetDir::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
$loader->set($namespace, $path); $loader->set($namespace, $path);
@ -37,12 +42,17 @@ class ComposerAutoloaderInitTargetDir
if ($classMap) { if ($classMap) {
$loader->addClassMap($classMap); $loader->addClassMap($classMap);
} }
}
spl_autoload_register(array('ComposerAutoloaderInitTargetDir', 'autoload'), true, true); spl_autoload_register(array('ComposerAutoloaderInitTargetDir', 'autoload'), true, true);
$loader->register(true); $loader->register(true);
if (PHP_VERSION_ID >= 50600) {
$includeFiles = Composer\Autoload\ComposerStaticInitTargetDir::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequireTargetDir($fileIdentifier, $file); composerRequireTargetDir($fileIdentifier, $file);
} }

View 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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}