1
0
Fork 0

Prepend runtime-autoloaders so that dependencies get loaded over Composer bundled packages

As Composer is generally compatible with newer versions of Symfony than the bundled ones, this should
not be a problem if dependencies are shared, and it ensures that the most relevant code gets loaded.
pull/9696/head
Jordi Boggiano 2021-02-12 11:14:40 +01:00
parent 27d0c5c3ef
commit d4073a40f9
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
3 changed files with 6 additions and 6 deletions

View File

@ -517,9 +517,9 @@ EOF;
* @param array $autoloads see parseAutoloads return value
* @return ClassLoader
*/
public function createLoader(array $autoloads)
public function createLoader(array $autoloads, $vendorDir = null)
{
$loader = new ClassLoader();
$loader = new ClassLoader($vendorDir);
if (isset($autoloads['psr-0'])) {
foreach ($autoloads['psr-0'] as $namespace => $path) {

View File

@ -435,8 +435,8 @@ class EventDispatcher
$packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
$packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
$map = $generator->parseAutoloads($packageMap, $package);
$this->loader = $generator->createLoader($map);
$this->loader->register();
$this->loader = $generator->createLoader($map, $this->composer->getConfig()->get('vendor-dir'));
$this->loader->register(true);
return $scripts[$event->getName()];
}

View File

@ -198,8 +198,8 @@ class PluginManager
}
$map = $generator->parseAutoloads($autoloads, $rootPackage);
$classLoader = $generator->createLoader($map);
$classLoader->register();
$classLoader = $generator->createLoader($map, $this->composer->getConfig()->get('vendor-dir'));
$classLoader->register(true);
foreach ($classes as $class) {
if (class_exists($class, false)) {