1
0
Fork 0

Merge branch '2.3'

pull/10941/head
Jordi Boggiano 2022-07-12 20:57:16 +02:00
commit c6a2142dc4
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 13 additions and 9 deletions

View File

@ -409,7 +409,15 @@ EOT
throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities))); throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
} }
$composer = Factory::create($io, $config->all(), $disablePlugins); $composerJson = array_merge(
// prevent version guessing from happening
array('version' => '1.0.0'),
$config->all(),
// ensure the vendor dir and its plugins does not get loaded if CWD/vendor has plugins in it
array('config' => array('vendor-dir' => Platform::getDevNull()))
);
$factory = new Factory;
$composer = $factory->createComposer($io, $composerJson, $disablePlugins, Platform::getDevNull(), true, $disableScripts);
$config = $composer->getConfig(); $config = $composer->getConfig();
$rm = $composer->getRepositoryManager(); $rm = $composer->getRepositoryManager();

View File

@ -283,6 +283,7 @@ class Factory
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
* @return Composer|PartialComposer Composer if $fullLoad is true, otherwise PartialComposer * @return Composer|PartialComposer Composer if $fullLoad is true, otherwise PartialComposer
* @phpstan-return ($fullLoad is true ? Composer : PartialComposer)
*/ */
public function createComposer(IOInterface $io, $localConfig = null, bool $disablePlugins = false, ?string $cwd = null, bool $fullLoad = true, bool $disableScripts = false) public function createComposer(IOInterface $io, $localConfig = null, bool $disablePlugins = false, ?string $cwd = null, bool $fullLoad = true, bool $disableScripts = false)
{ {
@ -452,10 +453,7 @@ class Factory
{ {
$factory = new static(); $factory = new static();
$composer = $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, $disableScripts, true); return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, $disableScripts, true);
assert(null === $composer || $composer instanceof Composer);
return $composer;
} }
/** /**
@ -476,6 +474,7 @@ class Factory
/** /**
* @return PartialComposer|Composer|null By default PartialComposer, but Composer if $fullLoad is set to true * @return PartialComposer|Composer|null By default PartialComposer, but Composer if $fullLoad is set to true
* @phpstan-return ($fullLoad is true ? Composer|null : PartialComposer|null)
*/ */
protected function createGlobalComposer(IOInterface $io, Config $config, bool $disablePlugins, bool $disableScripts, bool $fullLoad = false): ?PartialComposer protected function createGlobalComposer(IOInterface $io, Config $config, bool $disablePlugins, bool $disableScripts, bool $fullLoad = false): ?PartialComposer
{ {
@ -617,10 +616,7 @@ class Factory
{ {
$factory = new static(); $factory = new static();
$composer = $factory->createComposer($io, $config, $disablePlugins, null, true, $disableScripts); return $factory->createComposer($io, $config, $disablePlugins, null, true, $disableScripts);
assert($composer instanceof Composer);
return $composer;
} }
/** /**