PHPStan level 6 in src/Composer/Command (#10214)
parent
f667c7b8de
commit
3ccb54832b
|
@ -21,6 +21,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
*/
|
*/
|
||||||
class AboutCommand extends BaseCommand
|
class AboutCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
|
|
@ -38,6 +38,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
*/
|
*/
|
||||||
class ArchiveCommand extends BaseCommand
|
class ArchiveCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -110,7 +113,15 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string|null $packageName
|
||||||
|
* @param string|null $version
|
||||||
|
* @param string $format
|
||||||
|
* @param string $dest
|
||||||
|
* @param string|null $fileName
|
||||||
|
* @param bool $ignoreFilters
|
||||||
|
*
|
||||||
* @return int
|
* @return int
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
|
protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
|
||||||
{
|
{
|
||||||
|
@ -146,6 +157,9 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @param string|null $version
|
||||||
|
*
|
||||||
* @return (BasePackage&CompletePackageInterface)|false
|
* @return (BasePackage&CompletePackageInterface)|false
|
||||||
*/
|
*/
|
||||||
protected function selectPackage(IOInterface $io, $packageName, $version = null)
|
protected function selectPackage(IOInterface $io, $packageName, $version = null)
|
||||||
|
|
|
@ -23,6 +23,7 @@ use Composer\Package\Version\VersionParser;
|
||||||
use Composer\Plugin\PluginEvents;
|
use Composer\Plugin\PluginEvents;
|
||||||
use Composer\Util\Platform;
|
use Composer\Util\Platform;
|
||||||
use Symfony\Component\Console\Helper\Table;
|
use Symfony\Component\Console\Helper\Table;
|
||||||
|
use Symfony\Component\Console\Helper\TableSeparator;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
@ -74,7 +75,7 @@ abstract class BaseCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Composer $composer
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setComposer(Composer $composer)
|
public function setComposer(Composer $composer)
|
||||||
{
|
{
|
||||||
|
@ -83,6 +84,8 @@ abstract class BaseCommand extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the cached composer instance
|
* Removes the cached composer instance
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function resetComposer()
|
public function resetComposer()
|
||||||
{
|
{
|
||||||
|
@ -121,7 +124,7 @@ abstract class BaseCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param IOInterface $io
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setIO(IOInterface $io)
|
public function setIO(IOInterface $io)
|
||||||
{
|
{
|
||||||
|
@ -130,6 +133,8 @@ abstract class BaseCommand extends Command
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
@ -154,8 +159,6 @@ abstract class BaseCommand extends Command
|
||||||
/**
|
/**
|
||||||
* Returns preferSource and preferDist values based on the configuration.
|
* Returns preferSource and preferDist values based on the configuration.
|
||||||
*
|
*
|
||||||
* @param Config $config
|
|
||||||
* @param InputInterface $input
|
|
||||||
* @param bool $keepVcsRequiresPreferSource
|
* @param bool $keepVcsRequiresPreferSource
|
||||||
*
|
*
|
||||||
* @return bool[] An array composed of the preferSource and preferDist values
|
* @return bool[] An array composed of the preferSource and preferDist values
|
||||||
|
@ -209,6 +212,11 @@ abstract class BaseCommand extends Command
|
||||||
return array($preferSource, $preferDist);
|
return array($preferSource, $preferDist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string> $requirements
|
||||||
|
*
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
protected function formatRequirements(array $requirements)
|
protected function formatRequirements(array $requirements)
|
||||||
{
|
{
|
||||||
$requires = array();
|
$requires = array();
|
||||||
|
@ -223,6 +231,11 @@ abstract class BaseCommand extends Command
|
||||||
return $requires;
|
return $requires;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string> $requirements
|
||||||
|
*
|
||||||
|
* @return list<array{name: string, version?: string}>
|
||||||
|
*/
|
||||||
protected function normalizeRequirements(array $requirements)
|
protected function normalizeRequirements(array $requirements)
|
||||||
{
|
{
|
||||||
$parser = new VersionParser();
|
$parser = new VersionParser();
|
||||||
|
@ -230,6 +243,11 @@ abstract class BaseCommand extends Command
|
||||||
return $parser->parseNameVersionPairs($requirements);
|
return $parser->parseNameVersionPairs($requirements);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<TableSeparator|array> $table
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function renderTable(array $table, OutputInterface $output)
|
protected function renderTable(array $table, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$renderer = new Table($output);
|
$renderer = new Table($output);
|
||||||
|
@ -246,6 +264,9 @@ abstract class BaseCommand extends Command
|
||||||
$renderer->setRows($table)->render();
|
$renderer->setRows($table)->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
protected function getTerminalWidth()
|
protected function getTerminalWidth()
|
||||||
{
|
{
|
||||||
if (class_exists('Symfony\Component\Console\Terminal')) {
|
if (class_exists('Symfony\Component\Console\Terminal')) {
|
||||||
|
|
|
@ -47,8 +47,6 @@ class BaseDependencyCommand extends BaseCommand
|
||||||
/**
|
/**
|
||||||
* Execute the command.
|
* Execute the command.
|
||||||
*
|
*
|
||||||
* @param InputInterface $input
|
|
||||||
* @param OutputInterface $output
|
|
||||||
* @param bool $inverted Whether to invert matching process (why-not vs why behaviour)
|
* @param bool $inverted Whether to invert matching process (why-not vs why behaviour)
|
||||||
* @return int Exit code of the operation.
|
* @return int Exit code of the operation.
|
||||||
*/
|
*/
|
||||||
|
@ -134,8 +132,9 @@ class BaseDependencyCommand extends BaseCommand
|
||||||
/**
|
/**
|
||||||
* Assembles and prints a bottom-up table of the dependencies.
|
* Assembles and prints a bottom-up table of the dependencies.
|
||||||
*
|
*
|
||||||
* @param OutputInterface $output
|
* @param array[] $results
|
||||||
* @param array $results
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printTable(OutputInterface $output, $results)
|
protected function printTable(OutputInterface $output, $results)
|
||||||
{
|
{
|
||||||
|
@ -171,7 +170,7 @@ class BaseDependencyCommand extends BaseCommand
|
||||||
/**
|
/**
|
||||||
* Init styles for tree
|
* Init styles for tree
|
||||||
*
|
*
|
||||||
* @param OutputInterface $output
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function initStyles(OutputInterface $output)
|
protected function initStyles(OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
@ -192,9 +191,11 @@ class BaseDependencyCommand extends BaseCommand
|
||||||
/**
|
/**
|
||||||
* Recursively prints a tree of the selected results.
|
* Recursively prints a tree of the selected results.
|
||||||
*
|
*
|
||||||
* @param array $results Results to be printed at this level.
|
* @param array[] $results Results to be printed at this level.
|
||||||
* @param string $prefix Prefix of the current tree level.
|
* @param string $prefix Prefix of the current tree level.
|
||||||
* @param int $level Current level of recursion.
|
* @param int $level Current level of recursion.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printTree($results, $prefix = '', $level = 1)
|
protected function printTree($results, $prefix = '', $level = 1)
|
||||||
{
|
{
|
||||||
|
@ -222,6 +223,11 @@ class BaseDependencyCommand extends BaseCommand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $line
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function writeTreeLine($line)
|
private function writeTreeLine($line)
|
||||||
{
|
{
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
|
|
|
@ -23,6 +23,9 @@ use Composer\Repository\InstalledRepository;
|
||||||
|
|
||||||
class CheckPlatformReqsCommand extends BaseCommand
|
class CheckPlatformReqsCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this->setName('check-platform-reqs')
|
$this->setName('check-platform-reqs')
|
||||||
|
@ -43,6 +46,9 @@ EOT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$composer = $this->getComposer();
|
$composer = $this->getComposer();
|
||||||
|
@ -166,6 +172,11 @@ EOT
|
||||||
return $exitCode;
|
return $exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array[] $results
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function printTable(OutputInterface $output, $results)
|
protected function printTable(OutputInterface $output, $results)
|
||||||
{
|
{
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
|
@ -22,6 +22,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
*/
|
*/
|
||||||
class ClearCacheCommand extends BaseCommand
|
class ClearCacheCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -39,6 +42,9 @@ EOT
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$config = Factory::createConfig();
|
$config = Factory::createConfig();
|
||||||
|
|
|
@ -58,6 +58,9 @@ class ConfigCommand extends BaseCommand
|
||||||
*/
|
*/
|
||||||
protected $authConfigSource;
|
protected $authConfigSource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -145,6 +148,10 @@ EOT
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
protected function initialize(InputInterface $input, OutputInterface $output)
|
protected function initialize(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
parent::initialize($input, $output);
|
parent::initialize($input, $output);
|
||||||
|
@ -198,6 +205,10 @@ EOT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
* @throws \Seld\JsonLint\ParsingException
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
// Open file in editor
|
// Open file in editor
|
||||||
|
@ -750,6 +761,14 @@ EOT
|
||||||
throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
|
throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $key
|
||||||
|
* @param array{callable, callable} $callbacks Validator and normalizer callbacks
|
||||||
|
* @param array<string> $values
|
||||||
|
* @param string $method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function handleSingleValue($key, array $callbacks, array $values, $method)
|
protected function handleSingleValue($key, array $callbacks, array $values, $method)
|
||||||
{
|
{
|
||||||
list($validator, $normalizer) = $callbacks;
|
list($validator, $normalizer) = $callbacks;
|
||||||
|
@ -774,9 +793,17 @@ EOT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return call_user_func(array($this->configSource, $method), $key, $normalizedValue);
|
call_user_func(array($this->configSource, $method), $key, $normalizedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $key
|
||||||
|
* @param array{callable, callable} $callbacks Validator and normalizer callbacks
|
||||||
|
* @param array<string> $values
|
||||||
|
* @param string $method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function handleMultiValue($key, array $callbacks, array $values, $method)
|
protected function handleMultiValue($key, array $callbacks, array $values, $method)
|
||||||
{
|
{
|
||||||
list($validator, $normalizer) = $callbacks;
|
list($validator, $normalizer) = $callbacks;
|
||||||
|
@ -787,16 +814,17 @@ EOT
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
|
call_user_func(array($this->configSource, $method), $key, $normalizer($values));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the contents of the file in a pretty formatted way
|
* Display the contents of the file in a pretty formatted way
|
||||||
*
|
*
|
||||||
* @param array $contents
|
* @param array<array|bool|string> $contents
|
||||||
* @param array $rawContents
|
* @param array<array|string> $rawContents
|
||||||
* @param OutputInterface $output
|
|
||||||
* @param string|null $k
|
* @param string|null $k
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
|
protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,6 +56,9 @@ class CreateProjectCommand extends BaseCommand
|
||||||
*/
|
*/
|
||||||
protected $suggestedPackagesReporter;
|
protected $suggestedPackagesReporter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -115,6 +118,9 @@ EOT
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$config = Factory::createConfig();
|
$config = Factory::createConfig();
|
||||||
|
@ -160,9 +166,26 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string|null $packageName
|
||||||
|
* @param string|null $directory
|
||||||
|
* @param string|null $packageVersion
|
||||||
|
* @param string $stability
|
||||||
|
* @param bool $preferSource
|
||||||
|
* @param bool $preferDist
|
||||||
|
* @param bool $installDevPackages
|
||||||
|
* @param string|array<string>|null $repositories
|
||||||
|
* @param bool $disablePlugins
|
||||||
|
* @param bool $noScripts
|
||||||
|
* @param bool $noProgress
|
||||||
|
* @param bool $noInstall
|
||||||
|
* @param bool $ignorePlatformReqs
|
||||||
|
* @param bool $secureHttp
|
||||||
|
* @param bool $addRepository
|
||||||
|
*
|
||||||
* @return int
|
* @return int
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositories = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true, $addRepository = false)
|
public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName = null, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repositories = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true, $addRepository = false)
|
||||||
{
|
{
|
||||||
$oldCwd = getcwd();
|
$oldCwd = getcwd();
|
||||||
|
|
||||||
|
@ -308,7 +331,22 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $packageName
|
||||||
|
* @param string|null $directory
|
||||||
|
* @param string|null $packageVersion
|
||||||
|
* @param string|null $stability
|
||||||
|
* @param bool $preferSource
|
||||||
|
* @param bool $preferDist
|
||||||
|
* @param bool $installDevPackages
|
||||||
|
* @param array<string>|null $repositories
|
||||||
|
* @param bool $disablePlugins
|
||||||
|
* @param bool $noScripts
|
||||||
|
* @param bool $noProgress
|
||||||
|
* @param bool $ignorePlatformReqs
|
||||||
|
* @param bool $secureHttp
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, array $repositories = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
|
protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, array $repositories = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,8 @@ class DependsCommand extends BaseDependencyCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Configure command metadata.
|
* Configure command metadata.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
|
@ -51,8 +53,6 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Execute the function.
|
* Execute the function.
|
||||||
*
|
*
|
||||||
* @param InputInterface $input
|
|
||||||
* @param OutputInterface $output
|
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
|
|
|
@ -48,6 +48,9 @@ class DiagnoseCommand extends BaseCommand
|
||||||
/** @var int */
|
/** @var int */
|
||||||
protected $exitCode = 0;
|
protected $exitCode = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -65,6 +68,9 @@ EOT
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$composer = $this->getComposer(false);
|
$composer = $this->getComposer(false);
|
||||||
|
@ -237,6 +243,8 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $proto
|
||||||
|
*
|
||||||
* @return string|string[]|true
|
* @return string|string[]|true
|
||||||
*/
|
*/
|
||||||
private function checkHttp($proto, Config $config)
|
private function checkHttp($proto, Config $config)
|
||||||
|
@ -303,6 +311,9 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $domain
|
||||||
|
* @param string $token
|
||||||
|
*
|
||||||
* @return string|true|\Exception
|
* @return string|true|\Exception
|
||||||
*/
|
*/
|
||||||
private function checkGithubOauth($domain, $token)
|
private function checkGithubOauth($domain, $token)
|
||||||
|
@ -356,7 +367,7 @@ EOT
|
||||||
/**
|
/**
|
||||||
* @return string|true
|
* @return string|true
|
||||||
*/
|
*/
|
||||||
private function checkDiskSpace($config)
|
private function checkDiskSpace(Config $config)
|
||||||
{
|
{
|
||||||
$minSpaceFree = 1024 * 1024;
|
$minSpaceFree = 1024 * 1024;
|
||||||
if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
|
if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
|
||||||
|
@ -371,7 +382,7 @@ EOT
|
||||||
/**
|
/**
|
||||||
* @return string[]|true
|
* @return string[]|true
|
||||||
*/
|
*/
|
||||||
private function checkPubKeys($config)
|
private function checkPubKeys(Config $config)
|
||||||
{
|
{
|
||||||
$home = $config->get('home');
|
$home = $config->get('home');
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
@ -403,7 +414,7 @@ EOT
|
||||||
/**
|
/**
|
||||||
* @return string|\Exception|true
|
* @return string|\Exception|true
|
||||||
*/
|
*/
|
||||||
private function checkVersion($config)
|
private function checkVersion(Config $config)
|
||||||
{
|
{
|
||||||
$result = $this->checkConnectivity();
|
$result = $this->checkConnectivity();
|
||||||
if ($result !== true) {
|
if ($result !== true) {
|
||||||
|
@ -446,6 +457,8 @@ EOT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool|string|string[]|\Exception $result
|
* @param bool|string|string[]|\Exception $result
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function outputResult($result)
|
private function outputResult($result)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
*/
|
*/
|
||||||
class DumpAutoloadCommand extends BaseCommand
|
class DumpAutoloadCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -50,6 +53,9 @@ EOT
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$composer = $this->getComposer();
|
$composer = $this->getComposer();
|
||||||
|
|
|
@ -22,6 +22,9 @@ use Symfony\Component\Console\Input\InputArgument;
|
||||||
*/
|
*/
|
||||||
class ExecCommand extends BaseCommand
|
class ExecCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -46,6 +49,9 @@ EOT
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$composer = $this->getComposer();
|
$composer = $this->getComposer();
|
||||||
|
|
|
@ -28,6 +28,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
*/
|
*/
|
||||||
class FundCommand extends BaseCommand
|
class FundCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this->setName('fund')
|
$this->setName('fund')
|
||||||
|
@ -38,6 +41,9 @@ class FundCommand extends BaseCommand
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$composer = $this->getComposer();
|
$composer = $this->getComposer();
|
||||||
|
@ -125,6 +131,10 @@ class FundCommand extends BaseCommand
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array[] $fundings
|
||||||
|
* @return array[]
|
||||||
|
*/
|
||||||
private function insertFundingData(array $fundings, CompletePackageInterface $package)
|
private function insertFundingData(array $fundings, CompletePackageInterface $package)
|
||||||
{
|
{
|
||||||
foreach ($package->getFunding() as $fundingOption) {
|
foreach ($package->getFunding() as $fundingOption) {
|
||||||
|
|
|
@ -25,6 +25,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
*/
|
*/
|
||||||
class GlobalCommand extends BaseCommand
|
class GlobalCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -57,6 +60,10 @@ EOT
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int|void
|
||||||
|
* @throws \Symfony\Component\Console\Exception\ExceptionInterface
|
||||||
|
*/
|
||||||
public function run(InputInterface $input, OutputInterface $output)
|
public function run(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
if (!method_exists($input, '__toString')) {
|
if (!method_exists($input, '__toString')) {
|
||||||
|
|
|
@ -30,6 +30,8 @@ class HomeCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
|
@ -98,6 +100,8 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param bool $showHomepage
|
||||||
|
* @param bool $showOnly
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
|
private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
|
||||||
|
|
|
@ -54,6 +54,8 @@ class InitCommand extends BaseCommand
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
|
@ -89,6 +91,9 @@ EOT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* @throws \Seld\JsonLint\ParsingException
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
@ -220,6 +225,8 @@ EOT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function interact(InputInterface $input, OutputInterface $output)
|
protected function interact(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
@ -480,6 +487,10 @@ EOT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $name
|
||||||
|
* @return list<array{name: string, description: ?string}>
|
||||||
|
*/
|
||||||
protected function findPackages($name)
|
protected function findPackages($name)
|
||||||
{
|
{
|
||||||
return $this->getRepos()->search($name);
|
return $this->getRepos()->search($name);
|
||||||
|
@ -500,6 +511,16 @@ EOT
|
||||||
return $this->repos;
|
return $this->repos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string> $requires
|
||||||
|
* @param PlatformRepository|null $platformRepo
|
||||||
|
* @param string $preferredStability
|
||||||
|
* @param bool $checkProvidedVersions
|
||||||
|
* @param bool $fixed
|
||||||
|
*
|
||||||
|
* @return array<string>
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
final protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), PlatformRepository $platformRepo = null, $preferredStability = 'stable', $checkProvidedVersions = true, $fixed = false)
|
final protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), PlatformRepository $platformRepo = null, $preferredStability = 'stable', $checkProvidedVersions = true, $fixed = false)
|
||||||
{
|
{
|
||||||
if ($requires) {
|
if ($requires) {
|
||||||
|
@ -667,6 +688,8 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $author
|
||||||
|
*
|
||||||
* @return array<int, array{name: string, email: string}>
|
* @return array<int, array{name: string, email: string}>
|
||||||
*/
|
*/
|
||||||
protected function formatAuthors($author)
|
protected function formatAuthors($author)
|
||||||
|
@ -702,6 +725,9 @@ EOT
|
||||||
return join('\\', $namespace);
|
return join('\\', $namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
protected function getGitConfig()
|
protected function getGitConfig()
|
||||||
{
|
{
|
||||||
if (null !== $this->gitConfig) {
|
if (null !== $this->gitConfig) {
|
||||||
|
@ -767,6 +793,12 @@ EOT
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $ignoreFile
|
||||||
|
* @param string $vendor
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
|
protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
|
||||||
{
|
{
|
||||||
$contents = "";
|
$contents = "";
|
||||||
|
@ -782,6 +814,8 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $email
|
||||||
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
protected function isValidEmail($email)
|
protected function isValidEmail($email)
|
||||||
|
@ -800,6 +834,8 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string|null $minimumStability
|
||||||
|
*
|
||||||
* @return RepositorySet
|
* @return RepositorySet
|
||||||
*/
|
*/
|
||||||
private function getRepositorySet(InputInterface $input, $minimumStability = null)
|
private function getRepositorySet(InputInterface $input, $minimumStability = null)
|
||||||
|
@ -838,7 +874,6 @@ EOT
|
||||||
*
|
*
|
||||||
* This returns a version with the ~ operator prefixed when possible.
|
* This returns a version with the ~ operator prefixed when possible.
|
||||||
*
|
*
|
||||||
* @param InputInterface $input
|
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param PlatformRepository|null $platformRepo
|
* @param PlatformRepository|null $platformRepo
|
||||||
* @param string $preferredStability
|
* @param string $preferredStability
|
||||||
|
@ -846,7 +881,7 @@ EOT
|
||||||
* @param string $minimumStability
|
* @param string $minimumStability
|
||||||
* @param bool $fixed
|
* @param bool $fixed
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return array name version
|
* @return array{string, string} name version
|
||||||
*/
|
*/
|
||||||
private function findBestVersionAndNameForPackage(InputInterface $input, $name, PlatformRepository $platformRepo = null, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null, $fixed = null)
|
private function findBestVersionAndNameForPackage(InputInterface $input, $name, PlatformRepository $platformRepo = null, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null, $fixed = null)
|
||||||
{
|
{
|
||||||
|
@ -987,6 +1022,11 @@ EOT
|
||||||
return ':'.PHP_EOL.' - ' . implode(PHP_EOL.' - ', $details);
|
return ':'.PHP_EOL.' - ' . implode(PHP_EOL.' - ', $details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $package
|
||||||
|
*
|
||||||
|
* @return array<string>
|
||||||
|
*/
|
||||||
private function findSimilar($package)
|
private function findSimilar($package)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
@ -1014,7 +1054,7 @@ EOT
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function updateDependencies($output)
|
private function updateDependencies(OutputInterface $output)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$updateCommand = $this->getApplication()->find('update');
|
$updateCommand = $this->getApplication()->find('update');
|
||||||
|
@ -1028,7 +1068,7 @@ EOT
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function runDumpAutoloadCommand($output)
|
private function runDumpAutoloadCommand(OutputInterface $output)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$command = $this->getApplication()->find('dump-autoload');
|
$command = $this->getApplication()->find('dump-autoload');
|
||||||
|
@ -1040,6 +1080,7 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param array<string, string|array<string>> $options
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function hasDependencies($options)
|
private function hasDependencies($options)
|
||||||
|
|
|
@ -29,6 +29,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
*/
|
*/
|
||||||
class InstallCommand extends BaseCommand
|
class InstallCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
namespace Composer\Command;
|
namespace Composer\Command;
|
||||||
|
|
||||||
use Composer\Json\JsonFile;
|
use Composer\Json\JsonFile;
|
||||||
|
use Composer\Package\BasePackage;
|
||||||
|
use Composer\Package\CompletePackageInterface;
|
||||||
use Composer\Plugin\CommandEvent;
|
use Composer\Plugin\CommandEvent;
|
||||||
use Composer\Plugin\PluginEvents;
|
use Composer\Plugin\PluginEvents;
|
||||||
use Composer\Package\PackageInterface;
|
use Composer\Package\PackageInterface;
|
||||||
|
@ -28,6 +30,9 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
*/
|
*/
|
||||||
class LicensesCommand extends BaseCommand
|
class LicensesCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -48,6 +53,9 @@ EOT
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$composer = $this->getComposer();
|
$composer = $this->getComposer();
|
||||||
|
@ -91,7 +99,7 @@ EOT
|
||||||
$table->addRow(array(
|
$table->addRow(array(
|
||||||
$package->getPrettyName(),
|
$package->getPrettyName(),
|
||||||
$package->getFullPrettyVersion(),
|
$package->getFullPrettyVersion(),
|
||||||
implode(', ', $package->getLicense()) ?: 'none',
|
implode(', ', $package instanceof CompletePackageInterface ? $package->getLicense() : array()) ?: 'none',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
$table->render();
|
$table->render();
|
||||||
|
@ -102,7 +110,7 @@ EOT
|
||||||
foreach ($packages as $package) {
|
foreach ($packages as $package) {
|
||||||
$dependencies[$package->getPrettyName()] = array(
|
$dependencies[$package->getPrettyName()] = array(
|
||||||
'version' => $package->getFullPrettyVersion(),
|
'version' => $package->getFullPrettyVersion(),
|
||||||
'license' => $package->getLicense(),
|
'license' => $package instanceof CompletePackageInterface ? $package->getLicense() : array(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +125,7 @@ EOT
|
||||||
case 'summary':
|
case 'summary':
|
||||||
$usedLicenses = array();
|
$usedLicenses = array();
|
||||||
foreach ($packages as $package) {
|
foreach ($packages as $package) {
|
||||||
$license = $package->getLicense();
|
$license = $package instanceof CompletePackageInterface ? $package->getLicense() : array();
|
||||||
$licenseName = $license[0];
|
$licenseName = $license[0];
|
||||||
if (!isset($usedLicenses[$licenseName])) {
|
if (!isset($usedLicenses[$licenseName])) {
|
||||||
$usedLicenses[$licenseName] = 0;
|
$usedLicenses[$licenseName] = 0;
|
||||||
|
@ -149,10 +157,8 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Find package requires and child requires
|
* Find package requires and child requires
|
||||||
*
|
*
|
||||||
* @param RepositoryInterface $repo
|
* @param array<string, PackageInterface> $bucket
|
||||||
* @param PackageInterface $package
|
* @return array<string, PackageInterface>
|
||||||
* @param array $bucket
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
|
private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
|
||||||
{
|
{
|
||||||
|
@ -178,9 +184,9 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Adds packages to the package list
|
* Adds packages to the package list
|
||||||
*
|
*
|
||||||
* @param array $packages the list of packages to add
|
* @param PackageInterface[] $packages the list of packages to add
|
||||||
* @param array $bucket the list to add packages to
|
* @param array<string, PackageInterface> $bucket the list to add packages to
|
||||||
* @return array
|
* @return array<string, PackageInterface>
|
||||||
*/
|
*/
|
||||||
public function appendPackages(array $packages, array $bucket)
|
public function appendPackages(array $packages, array $bucket)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
*/
|
*/
|
||||||
class OutdatedCommand extends ShowCommand
|
class OutdatedCommand extends ShowCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
|
|
@ -24,6 +24,8 @@ class ProhibitsCommand extends BaseDependencyCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Configure command metadata.
|
* Configure command metadata.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
|
@ -52,8 +54,6 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Execute the function.
|
* Execute the function.
|
||||||
*
|
*
|
||||||
* @param InputInterface $input
|
|
||||||
* @param OutputInterface $output
|
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
|
|
|
@ -29,6 +29,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
*/
|
*/
|
||||||
class ReinstallCommand extends BaseCommand
|
class ReinstallCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
|
|
@ -31,6 +31,9 @@ use Composer\Package\BasePackage;
|
||||||
*/
|
*/
|
||||||
class RemoveCommand extends BaseCommand
|
class RemoveCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -70,6 +73,9 @@ EOT
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function interact(InputInterface $input, OutputInterface $output)
|
protected function interact(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
if ($input->getOption('unused')) {
|
if ($input->getOption('unused')) {
|
||||||
|
@ -117,6 +123,10 @@ EOT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
* @throws \Seld\JsonLint\ParsingException
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$packages = $input->getArgument('packages');
|
$packages = $input->getArgument('packages');
|
||||||
|
|
|
@ -56,6 +56,9 @@ class RequireCommand extends InitCommand
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
private $dependencyResolutionCompleted = false;
|
private $dependencyResolutionCompleted = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -106,6 +109,10 @@ EOT
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
* @throws \Seld\JsonLint\ParsingException
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
|
if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
|
||||||
|
@ -280,6 +287,11 @@ EOT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string> $newRequirements
|
||||||
|
* @param string $requireKey
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
private function getInconsistentRequireKeys(array $newRequirements, $requireKey)
|
private function getInconsistentRequireKeys(array $newRequirements, $requireKey)
|
||||||
{
|
{
|
||||||
$requireKeys = $this->getPackagesByRequireKey();
|
$requireKeys = $this->getPackagesByRequireKey();
|
||||||
|
@ -296,6 +308,9 @@ EOT
|
||||||
return $inconsistentRequirements;
|
return $inconsistentRequirements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
private function getPackagesByRequireKey()
|
private function getPackagesByRequireKey()
|
||||||
{
|
{
|
||||||
$composerDefinition = $this->json->read();
|
$composerDefinition = $this->json->read();
|
||||||
|
@ -318,12 +333,20 @@ EOT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function markSolverComplete()
|
public function markSolverComplete()
|
||||||
{
|
{
|
||||||
$this->dependencyResolutionCompleted = true;
|
$this->dependencyResolutionCompleted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string> $requirements
|
||||||
|
* @param string $requireKey
|
||||||
|
* @param string $removeKey
|
||||||
|
* @return int
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements, $requireKey, $removeKey)
|
private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements, $requireKey, $removeKey)
|
||||||
{
|
{
|
||||||
// Update packages
|
// Update packages
|
||||||
|
@ -418,9 +441,13 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param array<string, string> $new
|
||||||
|
* @param string $requireKey
|
||||||
|
* @param string $removeKey
|
||||||
|
* @param bool $sortPackages
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
|
private function updateFileCleanly(JsonFile $json, array $new, $requireKey, $removeKey, $sortPackages)
|
||||||
{
|
{
|
||||||
$contents = file_get_contents($json->getPath());
|
$contents = file_get_contents($json->getPath());
|
||||||
|
|
||||||
|
@ -447,6 +474,10 @@ EOT
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $hardExit
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function revertComposerFile($hardExit = true)
|
public function revertComposerFile($hardExit = true)
|
||||||
{
|
{
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
|
|
|
@ -44,6 +44,9 @@ class RunScriptCommand extends BaseCommand
|
||||||
ScriptEvents::POST_AUTOLOAD_DUMP,
|
ScriptEvents::POST_AUTOLOAD_DUMP,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
|
|
@ -27,6 +27,10 @@ class ScriptAliasCommand extends BaseCommand
|
||||||
/** @var string */
|
/** @var string */
|
||||||
private $description;
|
private $description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $script
|
||||||
|
* @param string $description
|
||||||
|
*/
|
||||||
public function __construct($script, $description)
|
public function __construct($script, $description)
|
||||||
{
|
{
|
||||||
$this->script = $script;
|
$this->script = $script;
|
||||||
|
@ -35,6 +39,9 @@ class ScriptAliasCommand extends BaseCommand
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -57,6 +64,9 @@ EOT
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$composer = $this->getComposer();
|
$composer = $this->getComposer();
|
||||||
|
|
|
@ -29,6 +29,9 @@ use Composer\Plugin\PluginEvents;
|
||||||
*/
|
*/
|
||||||
class SearchCommand extends BaseCommand
|
class SearchCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
|
|
@ -38,6 +38,9 @@ class SelfUpdateCommand extends BaseCommand
|
||||||
const HOMEPAGE = 'getcomposer.org';
|
const HOMEPAGE = 'getcomposer.org';
|
||||||
const OLD_INSTALL_EXT = '-old.phar';
|
const OLD_INSTALL_EXT = '-old.phar';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -70,6 +73,10 @@ EOT
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
* @throws FilesystemException
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$config = Factory::createConfig();
|
$config = Factory::createConfig();
|
||||||
|
@ -105,7 +112,8 @@ EOT
|
||||||
$localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
|
$localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
|
||||||
|
|
||||||
if ($input->getOption('update-keys')) {
|
if ($input->getOption('update-keys')) {
|
||||||
return $this->fetchKeys($io, $config);
|
$this->fetchKeys($io, $config);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure composer.phar location is accessible
|
// ensure composer.phar location is accessible
|
||||||
|
@ -324,6 +332,10 @@ TAGSPUBKEY
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
protected function fetchKeys(IOInterface $io, Config $config)
|
protected function fetchKeys(IOInterface $io, Config $config)
|
||||||
{
|
{
|
||||||
if (!$io->isInteractive()) {
|
if (!$io->isInteractive()) {
|
||||||
|
@ -370,7 +382,10 @@ TAGSPUBKEY
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $rollbackDir
|
||||||
|
* @param string $localFilename
|
||||||
* @return int
|
* @return int
|
||||||
|
* @throws FilesystemException
|
||||||
*/
|
*/
|
||||||
protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
|
protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
|
||||||
{
|
{
|
||||||
|
@ -451,6 +466,12 @@ TAGSPUBKEY
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $rollbackDir
|
||||||
|
* @param string|null $except
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function cleanBackups($rollbackDir, $except = null)
|
protected function cleanBackups($rollbackDir, $except = null)
|
||||||
{
|
{
|
||||||
$finder = $this->getOldInstallationFinder($rollbackDir);
|
$finder = $this->getOldInstallationFinder($rollbackDir);
|
||||||
|
@ -468,6 +489,7 @@ TAGSPUBKEY
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $rollbackDir
|
||||||
* @return string|false
|
* @return string|false
|
||||||
*/
|
*/
|
||||||
protected function getLastBackupVersion($rollbackDir)
|
protected function getLastBackupVersion($rollbackDir)
|
||||||
|
@ -484,6 +506,7 @@ TAGSPUBKEY
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $rollbackDir
|
||||||
* @return Finder
|
* @return Finder
|
||||||
*/
|
*/
|
||||||
protected function getOldInstallationFinder($rollbackDir)
|
protected function getOldInstallationFinder($rollbackDir)
|
||||||
|
|
|
@ -59,6 +59,9 @@ class ShowCommand extends BaseCommand
|
||||||
/** @var ?RepositorySet */
|
/** @var ?RepositorySet */
|
||||||
private $repositorySet;
|
private $repositorySet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -553,6 +556,9 @@ EOT
|
||||||
return $exitCode;
|
return $exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
protected function getRootRequires()
|
protected function getRootRequires()
|
||||||
{
|
{
|
||||||
$rootPackage = $this->getComposer()->getPackage();
|
$rootPackage = $this->getComposer()->getPackage();
|
||||||
|
@ -563,6 +569,9 @@ EOT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array|string|string[]
|
||||||
|
*/
|
||||||
protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
|
protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
|
||||||
{
|
{
|
||||||
return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
|
return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
|
||||||
|
@ -571,12 +580,10 @@ EOT
|
||||||
/**
|
/**
|
||||||
* finds a package by name and version if provided
|
* finds a package by name and version if provided
|
||||||
*
|
*
|
||||||
* @param InstalledRepository $installedRepo
|
|
||||||
* @param RepositoryInterface $repos
|
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param ConstraintInterface|string $version
|
* @param ConstraintInterface|string $version
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return array array(CompletePackageInterface, array of versions)
|
* @return array{CompletePackageInterface|null, array<string, string>}
|
||||||
*/
|
*/
|
||||||
protected function getPackage(InstalledRepository $installedRepo, RepositoryInterface $repos, $name, $version = null)
|
protected function getPackage(InstalledRepository $installedRepo, RepositoryInterface $repos, $name, $version = null)
|
||||||
{
|
{
|
||||||
|
@ -617,10 +624,10 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Prints package info.
|
* Prints package info.
|
||||||
*
|
*
|
||||||
* @param CompletePackageInterface $package
|
* @param array<string, string> $versions
|
||||||
* @param array $versions
|
|
||||||
* @param InstalledRepository $installedRepo
|
|
||||||
* @param PackageInterface|null $latestPackage
|
* @param PackageInterface|null $latestPackage
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printPackageInfo(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null)
|
protected function printPackageInfo(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null)
|
||||||
{
|
{
|
||||||
|
@ -645,10 +652,10 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Prints package metadata.
|
* Prints package metadata.
|
||||||
*
|
*
|
||||||
* @param CompletePackageInterface $package
|
* @param array<string, string> $versions
|
||||||
* @param array $versions
|
|
||||||
* @param InstalledRepository $installedRepo
|
|
||||||
* @param PackageInterface|null $latestPackage
|
* @param PackageInterface|null $latestPackage
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printMeta(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null)
|
protected function printMeta(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null)
|
||||||
{
|
{
|
||||||
|
@ -713,9 +720,9 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Prints all available versions of this package and highlights the installed one if any.
|
* Prints all available versions of this package and highlights the installed one if any.
|
||||||
*
|
*
|
||||||
* @param CompletePackageInterface $package
|
* @param array<string, string> $versions
|
||||||
* @param array $versions
|
*
|
||||||
* @param InstalledRepository $installedRepo
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printVersions(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo)
|
protected function printVersions(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo)
|
||||||
{
|
{
|
||||||
|
@ -741,9 +748,10 @@ EOT
|
||||||
/**
|
/**
|
||||||
* print link objects
|
* print link objects
|
||||||
*
|
*
|
||||||
* @param CompletePackageInterface $package
|
|
||||||
* @param string $linkType
|
* @param string $linkType
|
||||||
* @param string $title
|
* @param string $title
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
|
protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
|
||||||
{
|
{
|
||||||
|
@ -761,7 +769,7 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Prints the licenses of a package with metadata
|
* Prints the licenses of a package with metadata
|
||||||
*
|
*
|
||||||
* @param CompletePackageInterface $package
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function printLicenses(CompletePackageInterface $package)
|
protected function printLicenses(CompletePackageInterface $package)
|
||||||
{
|
{
|
||||||
|
@ -791,10 +799,9 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Prints package info in JSON format.
|
* Prints package info in JSON format.
|
||||||
*
|
*
|
||||||
* @param CompletePackageInterface $package
|
* @param array<string, string> $versions
|
||||||
* @param array $versions
|
*
|
||||||
* @param InstalledRepository $installedRepo
|
* @return void
|
||||||
* @param PackageInterface|null $latestPackage
|
|
||||||
*/
|
*/
|
||||||
protected function printPackageInfoAsJson(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null)
|
protected function printPackageInfoAsJson(CompletePackageInterface $package, array $versions, InstalledRepository $installedRepo, PackageInterface $latestPackage = null)
|
||||||
{
|
{
|
||||||
|
@ -862,6 +869,11 @@ EOT
|
||||||
$this->getIO()->write(JsonFile::encode($json));
|
$this->getIO()->write(JsonFile::encode($json));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string|string[]|null> $json
|
||||||
|
* @param array<string, string> $versions
|
||||||
|
* @return array<string, string|string[]|null>
|
||||||
|
*/
|
||||||
private function appendVersions($json, array $versions)
|
private function appendVersions($json, array $versions)
|
||||||
{
|
{
|
||||||
uasort($versions, 'version_compare');
|
uasort($versions, 'version_compare');
|
||||||
|
@ -871,6 +883,10 @@ EOT
|
||||||
return $json;
|
return $json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string|string[]|null> $json
|
||||||
|
* @return array<string, string|string[]|null>
|
||||||
|
*/
|
||||||
private function appendLicenses($json, CompletePackageInterface $package)
|
private function appendLicenses($json, CompletePackageInterface $package)
|
||||||
{
|
{
|
||||||
if ($licenses = $package->getLicense()) {
|
if ($licenses = $package->getLicense()) {
|
||||||
|
@ -894,6 +910,10 @@ EOT
|
||||||
return $json;
|
return $json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string|string[]|null> $json
|
||||||
|
* @return array<string, string|string[]|null>
|
||||||
|
*/
|
||||||
private function appendAutoload($json, CompletePackageInterface $package)
|
private function appendAutoload($json, CompletePackageInterface $package)
|
||||||
{
|
{
|
||||||
if ($package->getAutoload()) {
|
if ($package->getAutoload()) {
|
||||||
|
@ -923,6 +943,10 @@ EOT
|
||||||
return $json;
|
return $json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string|string[]|null> $json
|
||||||
|
* @return array<string, string|string[]|null>
|
||||||
|
*/
|
||||||
private function appendLinks($json, CompletePackageInterface $package)
|
private function appendLinks($json, CompletePackageInterface $package)
|
||||||
{
|
{
|
||||||
foreach (Link::$TYPES as $linkType) {
|
foreach (Link::$TYPES as $linkType) {
|
||||||
|
@ -932,6 +956,11 @@ EOT
|
||||||
return $json;
|
return $json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, string|string[]|null> $json
|
||||||
|
* @param string $linkType
|
||||||
|
* @return array<string, string|string[]|null>
|
||||||
|
*/
|
||||||
private function appendLink($json, CompletePackageInterface $package, $linkType)
|
private function appendLink($json, CompletePackageInterface $package, $linkType)
|
||||||
{
|
{
|
||||||
$links = $package->{'get' . ucfirst($linkType)}();
|
$links = $package->{'get' . ucfirst($linkType)}();
|
||||||
|
@ -950,7 +979,7 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Init styles for tree
|
* Init styles for tree
|
||||||
*
|
*
|
||||||
* @param OutputInterface $output
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function initStyles(OutputInterface $output)
|
protected function initStyles(OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
@ -971,7 +1000,8 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Display the tree
|
* Display the tree
|
||||||
*
|
*
|
||||||
* @param array $arrayTree
|
* @param array<int, array<string, string|array>> $arrayTree
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function displayPackageTree(array $arrayTree)
|
protected function displayPackageTree(array $arrayTree)
|
||||||
{
|
{
|
||||||
|
@ -1016,10 +1046,7 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Generate the package tree
|
* Generate the package tree
|
||||||
*
|
*
|
||||||
* @param PackageInterface $package
|
* @return array<string, array<int, array<string, array|string>>|string|null>
|
||||||
* @param InstalledRepository $installedRepo
|
|
||||||
* @param RepositoryInterface $remoteRepos
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
protected function generatePackageTree(
|
protected function generatePackageTree(
|
||||||
PackageInterface $package,
|
PackageInterface $package,
|
||||||
|
@ -1061,10 +1088,12 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Display a package tree
|
* Display a package tree
|
||||||
*
|
*
|
||||||
* @param array|string $package
|
* @param array<string, array<int, array<string, array|string>>|string|null>|string $package
|
||||||
* @param array $packagesInTree
|
* @param array<int, string|array> $packagesInTree
|
||||||
* @param string $previousTreeBar
|
* @param string $previousTreeBar
|
||||||
* @param int $level
|
* @param int $level
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function displayTree(
|
protected function displayTree(
|
||||||
$package,
|
$package,
|
||||||
|
@ -1115,11 +1144,8 @@ EOT
|
||||||
* Display a package tree
|
* Display a package tree
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param Link $link
|
* @param string[] $packagesInTree
|
||||||
* @param InstalledRepository $installedRepo
|
* @return array<int, array<string, array<int, array<string, string>>|string>>
|
||||||
* @param RepositoryInterface $remoteRepos
|
|
||||||
* @param array $packagesInTree
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
protected function addTree(
|
protected function addTree(
|
||||||
$name,
|
$name,
|
||||||
|
@ -1161,6 +1187,10 @@ EOT
|
||||||
return $children;
|
return $children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $updateStatus
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
private function updateStatusToVersionStyle($updateStatus)
|
private function updateStatusToVersionStyle($updateStatus)
|
||||||
{
|
{
|
||||||
// 'up-to-date' is printed green
|
// 'up-to-date' is printed green
|
||||||
|
@ -1169,6 +1199,9 @@ EOT
|
||||||
return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
|
return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
|
private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
|
||||||
{
|
{
|
||||||
if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
|
if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
|
||||||
|
@ -1188,6 +1221,11 @@ EOT
|
||||||
return 'update-possible';
|
return 'update-possible';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $line
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
private function writeTreeLine($line)
|
private function writeTreeLine($line)
|
||||||
{
|
{
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
|
@ -1201,9 +1239,6 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Given a package, this finds the latest package matching it
|
* Given a package, this finds the latest package matching it
|
||||||
*
|
*
|
||||||
* @param PackageInterface $package
|
|
||||||
* @param Composer $composer
|
|
||||||
* @param PlatformRepository $platformRepo
|
|
||||||
* @param bool $minorOnly
|
* @param bool $minorOnly
|
||||||
*
|
*
|
||||||
* @return PackageInterface|false
|
* @return PackageInterface|false
|
||||||
|
@ -1257,10 +1292,8 @@ EOT
|
||||||
/**
|
/**
|
||||||
* Find package requires and child requires
|
* Find package requires and child requires
|
||||||
*
|
*
|
||||||
* @param RepositoryInterface $repo
|
* @param array<PackageInterface> $bucket
|
||||||
* @param PackageInterface $package
|
* @return array<PackageInterface>
|
||||||
* @param array $bucket
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
|
private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,7 @@ class StatusCommand extends BaseCommand
|
||||||
const EXIT_CODE_VERSION_CHANGES = 4;
|
const EXIT_CODE_VERSION_CHANGES = 4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @return void
|
||||||
* @throws \Symfony\Component\Console\Exception\InvalidArgumentException
|
* @throws \Symfony\Component\Console\Exception\InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
|
@ -59,8 +60,6 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param InputInterface $input
|
|
||||||
* @param OutputInterface $output
|
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
|
@ -82,7 +81,6 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param InputInterface $input
|
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private function doExecute(InputInterface $input)
|
private function doExecute(InputInterface $input)
|
||||||
|
|
|
@ -23,6 +23,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
class SuggestsCommand extends BaseCommand
|
class SuggestsCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
|
|
@ -36,6 +36,9 @@ use Symfony\Component\Console\Question\Question;
|
||||||
*/
|
*/
|
||||||
class UpdateCommand extends BaseCommand
|
class UpdateCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this
|
$this
|
||||||
|
@ -105,6 +108,10 @@ EOT
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$io = $this->getIO();
|
$io = $this->getIO();
|
||||||
|
@ -241,6 +248,10 @@ EOT
|
||||||
return $install->run();
|
return $install->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string> $packages
|
||||||
|
* @return array<string>
|
||||||
|
*/
|
||||||
private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
|
private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
|
||||||
{
|
{
|
||||||
if (!$input->isInteractive()) {
|
if (!$input->isInteractive()) {
|
||||||
|
@ -305,6 +316,7 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param string $constraint
|
||||||
* @return Link
|
* @return Link
|
||||||
*/
|
*/
|
||||||
private function appendConstraintToLink(Link $link, $constraint)
|
private function appendConstraintToLink(Link $link, $constraint)
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
namespace Composer\Command;
|
namespace Composer\Command;
|
||||||
|
|
||||||
use Composer\Factory;
|
use Composer\Factory;
|
||||||
|
use Composer\IO\IOInterface;
|
||||||
use Composer\Package\Loader\ValidatingArrayLoader;
|
use Composer\Package\Loader\ValidatingArrayLoader;
|
||||||
use Composer\Plugin\CommandEvent;
|
use Composer\Plugin\CommandEvent;
|
||||||
use Composer\Plugin\PluginEvents;
|
use Composer\Plugin\PluginEvents;
|
||||||
|
@ -35,6 +36,7 @@ class ValidateCommand extends BaseCommand
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* configure
|
* configure
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
|
@ -65,9 +67,6 @@ EOT
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param InputInterface $input
|
|
||||||
* @param OutputInterface $output
|
|
||||||
*
|
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output)
|
protected function execute(InputInterface $input, OutputInterface $output)
|
||||||
|
@ -161,7 +160,19 @@ EOT
|
||||||
return max($eventCode, $exitCode);
|
return max($eventCode, $exitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
|
/**
|
||||||
|
* @param string $name
|
||||||
|
* @param string[] $errors
|
||||||
|
* @param string[] $warnings
|
||||||
|
* @param bool $checkPublish
|
||||||
|
* @param string[] $publishErrors
|
||||||
|
* @param bool $checkLock
|
||||||
|
* @param string[] $lockErrors
|
||||||
|
* @param bool $printSchemaUrl
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
private function outputResult(IOInterface $io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
|
||||||
{
|
{
|
||||||
$doPrintSchemaUrl = false;
|
$doPrintSchemaUrl = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue