Commit 9500017a authored by catch's avatar catch

Issue #2578485 by Mile23, mayeco, TamCalderwood, alduya, Gravypower, Andy_D,...

Issue #2578485 by Mile23, mayeco, TamCalderwood, alduya, Gravypower, Andy_D, alexpott, slde_rorschach: Composer::preAutoloadDump fails with no specified classmap
parent e84da2fa
......@@ -83,9 +83,15 @@ public static function preAutoloadDump(Event $event) {
// This is, essentially, a null constraint. We only care whether the package
// is present in the vendor directory yet, but findPackage() requires it.
$constraint = new Constraint('>', '');
// It's possible that there is no classmap specified in a custom project
// composer.json file. We need one so we can optimize lookup for some of our
// dependencies.
$autoload = $package->getAutoload();
if (!isset($autoload['classmap'])) {
$autoload['classmap'] = [];
}
// Check for our packages, and then optimize them if they're present.
if ($repository->findPackage('symfony/http-foundation', $constraint)) {
$autoload = $package->getAutoload();
$autoload['classmap'] = array_merge($autoload['classmap'], [
$vendor_dir . '/symfony/http-foundation/Request.php',
$vendor_dir . '/symfony/http-foundation/ParameterBag.php',
......@@ -93,17 +99,15 @@ public static function preAutoloadDump(Event $event) {
$vendor_dir . '/symfony/http-foundation/ServerBag.php',
$vendor_dir . '/symfony/http-foundation/HeaderBag.php',
]);
$package->setAutoload($autoload);
}
if ($repository->findPackage('symfony/http-kernel', $constraint)) {
$autoload = $package->getAutoload();
$autoload['classmap'] = array_merge($autoload['classmap'], [
$vendor_dir . '/symfony/http-kernel/HttpKernel.php',
$vendor_dir . '/symfony/http-kernel/HttpKernelInterface.php',
$vendor_dir . '/symfony/http-kernel/TerminableInterface.php',
]);
$package->setAutoload($autoload);
}
$package->setAutoload($autoload);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment