1
0
Fork 0

Clean up types with conditional return types

pull/10941/head
Jordi Boggiano 2022-07-12 20:56:23 +02:00
parent cecdc0cbd1
commit 03cebc2490
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 4 additions and 8 deletions

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)
{ {
@ -450,10 +451,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;
} }
/** /**
@ -474,6 +472,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
{ {
@ -615,10 +614,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;
} }
/** /**