Skip to content

Commit

Permalink
Clean up types with conditional return types
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek authored and emahorvat52 committed Jan 18, 2023
1 parent f009a23 commit d15f470
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/Composer/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ public static function createOutput(): ConsoleOutput
* @throws \InvalidArgumentException
* @throws \UnexpectedValueException
* @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)
{
Expand Down Expand Up @@ -446,10 +447,7 @@ public static function createGlobal(IOInterface $io, bool $disablePlugins = fals
{
$factory = new static();

$composer = $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, $disableScripts, true);
assert(null === $composer || $composer instanceof Composer);

return $composer;
return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, $disableScripts, true);
}

/**
Expand All @@ -470,6 +468,7 @@ protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, st

/**
* @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
{
Expand Down Expand Up @@ -611,10 +610,7 @@ public static function create(IOInterface $io, $config = null, bool $disablePlug
{
$factory = new static();

$composer = $factory->createComposer($io, $config, $disablePlugins, null, true, $disableScripts);
assert($composer instanceof Composer);

return $composer;
return $factory->createComposer($io, $config, $disablePlugins, null, true, $disableScripts);
}

/**
Expand Down

0 comments on commit d15f470

Please sign in to comment.