Removed passing of parameters with default value

main
Simon Berger 4 years ago
parent cda6e8bea6
commit 002fd39bc6

@ -234,7 +234,7 @@ EOT
->setApcuAutoloader($config->get('apcu-autoloader')); ->setApcuAutoloader($config->get('apcu-autoloader'));
if (!$composer->getLocker()->isLocked()) { if (!$composer->getLocker()->isLocked()) {
$installer->setUpdate(true); $installer->setUpdate();
} }
if ($disablePlugins) { if ($disablePlugins) {
@ -254,7 +254,7 @@ EOT
&& ( && (
$input->getOption('remove-vcs') $input->getOption('remove-vcs')
|| !$io->isInteractive() || !$io->isInteractive()
|| $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true) || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ')
) )
) { ) {
$finder = new Finder(); $finder = new Finder();
@ -414,7 +414,7 @@ EOT
$fs = new Filesystem(); $fs = new Filesystem();
$fs->removeDirectory($realDir); $fs->removeDirectory($realDir);
exit(130); exit(130);
}, true); });
} }
} }

@ -52,6 +52,6 @@ EOT
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
return parent::doExecute($input, $output, false); return parent::doExecute($input, $output);
} }
} }

@ -124,7 +124,7 @@ EOT
if ($input->isInteractive()) { if ($input->isInteractive()) {
$io->writeError(array('', $json, '')); $io->writeError(array('', $json, ''));
if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) { if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ')) {
$io->writeError('<error>Command aborted</error>'); $io->writeError('<error>Command aborted</error>');
return 1; return 1;
@ -143,14 +143,14 @@ EOT
if (!$this->hasVendorIgnore($ignoreFile)) { if (!$this->hasVendorIgnore($ignoreFile)) {
$question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? '; $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
if ($io->askConfirmation($question, true)) { if ($io->askConfirmation($question)) {
$this->addVendorIgnore($ignoreFile); $this->addVendorIgnore($ignoreFile);
} }
} }
} }
$question = 'Would you like to install dependencies now [<comment>yes</comment>]? '; $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question, true)) { if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question)) {
$this->installDependencies($output); $this->installDependencies($output);
} }
@ -358,7 +358,7 @@ EOT
$question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? '; $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
$require = $input->getOption('require'); $require = $input->getOption('require');
$requirements = array(); $requirements = array();
if ($require || $io->askConfirmation($question, true)) { if ($require || $io->askConfirmation($question)) {
$requirements = $this->determineRequirements($input, $output, $require, $platformRepo, $preferredStability); $requirements = $this->determineRequirements($input, $output, $require, $platformRepo, $preferredStability);
} }
$input->setOption('require', $requirements); $input->setOption('require', $requirements);
@ -366,7 +366,7 @@ EOT
$question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? '; $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
$requireDev = $input->getOption('require-dev'); $requireDev = $input->getOption('require-dev');
$devRequirements = array(); $devRequirements = array();
if ($requireDev || $io->askConfirmation($question, true)) { if ($requireDev || $io->askConfirmation($question)) {
$devRequirements = $this->determineRequirements($input, $output, $requireDev, $platformRepo, $preferredStability); $devRequirements = $this->determineRequirements($input, $output, $requireDev, $platformRepo, $preferredStability);
} }
$input->setOption('require-dev', $devRequirements); $input->setOption('require-dev', $devRequirements);

@ -158,7 +158,7 @@ EOT
} elseif (isset($composer[$altType][$package])) { } elseif (isset($composer[$altType][$package])) {
$io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>'); $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
if ($io->isInteractive()) { if ($io->isInteractive()) {
if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) { if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ')) {
if ($dryRun) { if ($dryRun) {
$toRemove[$altType][] = $composer[$altType][$package]; $toRemove[$altType][] = $composer[$altType][$package];
} else { } else {
@ -178,7 +178,7 @@ EOT
foreach ($matches as $matchedPackage) { foreach ($matches as $matchedPackage) {
$io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>'); $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
if ($io->isInteractive()) { if ($io->isInteractive()) {
if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) { if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ')) {
if ($dryRun) { if ($dryRun) {
$toRemove[$altType][] = $matchedPackage; $toRemove[$altType][] = $matchedPackage;
} else { } else {
@ -249,7 +249,7 @@ EOT
->setOptimizeAutoloader($optimize) ->setOptimizeAutoloader($optimize)
->setClassMapAuthoritative($authoritative) ->setClassMapAuthoritative($authoritative)
->setApcuAutoloader($apcu) ->setApcuAutoloader($apcu)
->setUpdate(true) ->setUpdate()
->setInstall(!$input->getOption('no-install')) ->setInstall(!$input->getOption('no-install'))
->setUpdateAllowList($packages) ->setUpdateAllowList($packages)
->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies) ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)

@ -302,7 +302,7 @@ EOT
->setOptimizeAutoloader($optimize) ->setOptimizeAutoloader($optimize)
->setClassMapAuthoritative($authoritative) ->setClassMapAuthoritative($authoritative)
->setApcuAutoloader($apcu) ->setApcuAutoloader($apcu)
->setUpdate(true) ->setUpdate()
->setInstall(!$input->getOption('no-install')) ->setInstall(!$input->getOption('no-install'))
->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies) ->setUpdateAllowTransitiveDependencies($updateAllowTransitiveDependencies)
->setIgnorePlatformRequirements($ignorePlatformReqs) ->setIgnorePlatformRequirements($ignorePlatformReqs)

@ -211,7 +211,7 @@ EOT
->setOptimizeAutoloader($optimize) ->setOptimizeAutoloader($optimize)
->setClassMapAuthoritative($authoritative) ->setClassMapAuthoritative($authoritative)
->setApcuAutoloader($apcu) ->setApcuAutoloader($apcu)
->setUpdate(true) ->setUpdate()
->setInstall(!$input->getOption('no-install')) ->setInstall(!$input->getOption('no-install'))
->setUpdateMirrors($updateMirrors) ->setUpdateMirrors($updateMirrors)
->setUpdateAllowList($packages) ->setUpdateAllowList($packages)
@ -284,7 +284,7 @@ EOT
if ($io->askConfirmation(sprintf( if ($io->askConfirmation(sprintf(
'Would you like to continue and update the above package%s [<comment>yes</comment>]? ', 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
1 === count($packages) ? '' : 's' 1 === count($packages) ? '' : 's'
), true)) { ))) {
return $packages; return $packages;
} }
@ -295,7 +295,7 @@ EOT
{ {
$parser = new VersionParser; $parser = new VersionParser;
$oldPrettyString = $link->getConstraint()->getPrettyString(); $oldPrettyString = $link->getConstraint()->getPrettyString();
$newConstraint = MultiConstraint::create(array($link->getConstraint(), $parser->parseConstraints($constraint)), true); $newConstraint = MultiConstraint::create(array($link->getConstraint(), $parser->parseConstraints($constraint)));
$newConstraint->setPrettyString($oldPrettyString.', '.$constraint); $newConstraint->setPrettyString($oldPrettyString.', '.$constraint);
return new Link( return new Link(
$link->getSource(), $link->getSource(),

@ -171,7 +171,7 @@ class Application extends BaseApplication
// abort when we reach the home dir or top of the filesystem // abort when we reach the home dir or top of the filesystem
while (dirname($dir) !== $dir && $dir !== $home) { while (dirname($dir) !== $dir && $dir !== $home) {
if (file_exists($dir.'/'.Factory::getComposerFile())) { if (file_exists($dir.'/'.Factory::getComposerFile())) {
if ($io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ', true)) { if ($io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ')) {
$oldWorkingDir = getcwd(); $oldWorkingDir = getcwd();
chdir($dir); chdir($dir);
} }
@ -254,7 +254,7 @@ class Application extends BaseApplication
$io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>'); $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
if ($io->isInteractive()) { if ($io->isInteractive()) {
if (!$io->askConfirmation('<info>Continue as root/super user</info> [<comment>yes</comment>]? ', true)) { if (!$io->askConfirmation('<info>Continue as root/super user</info> [<comment>yes</comment>]? ')) {
return 1; return 1;
} }
} }
@ -518,7 +518,7 @@ class Application extends BaseApplication
$composer = $this->getComposer(false, false); $composer = $this->getComposer(false, false);
if (null === $composer) { if (null === $composer) {
$composer = Factory::createGlobal($this->io, false); $composer = Factory::createGlobal($this->io);
} }
if (null !== $composer) { if (null !== $composer) {

@ -173,6 +173,6 @@ class RuleSet implements \IteratorAggregate, \Countable
public function __toString() public function __toString()
{ {
return $this->getPrettyString(null, null, null); return $this->getPrettyString();
} }
} }

@ -313,7 +313,7 @@ class DownloadManager
throw $e; throw $e;
} }
$this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>'); $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) { if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ')) {
throw $e; throw $e;
} }
} }

@ -94,7 +94,7 @@ class PerforceDownloader extends VcsDownloader
*/ */
public function getLocalChanges(PackageInterface $package, $path) public function getLocalChanges(PackageInterface $package, $path)
{ {
$this->io->writeError('Perforce driver does not check for local changes before overriding', true); $this->io->writeError('Perforce driver does not check for local changes before overriding');
} }
/** /**

@ -271,9 +271,9 @@ abstract class BaseIO implements IOInterface
public function log($level, $message, array $context = array()) public function log($level, $message, array $context = array())
{ {
if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) { if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
$this->writeError('<error>'.$message.'</error>', true, self::NORMAL); $this->writeError('<error>'.$message.'</error>');
} elseif ($level === LogLevel::WARNING) { } elseif ($level === LogLevel::WARNING) {
$this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL); $this->writeError('<warning>'.$message.'</warning>');
} elseif ($level === LogLevel::NOTICE) { } elseif ($level === LogLevel::NOTICE) {
$this->writeError('<info>'.$message.'</info>', true, self::VERBOSE); $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
} elseif ($level === LogLevel::INFO) { } elseif ($level === LogLevel::INFO) {

@ -73,7 +73,7 @@ class BufferIO extends ConsoleIO
private function createStream(array $inputs) private function createStream(array $inputs)
{ {
$stream = fopen('php://memory', 'r+', false); $stream = fopen('php://memory', 'r+');
foreach ($inputs as $input) { foreach ($inputs as $input) {
fwrite($stream, $input.PHP_EOL); fwrite($stream, $input.PHP_EOL);

@ -568,7 +568,7 @@ class Installer
$repositorySet = $this->createRepositorySet(true, $platformRepo, $aliases); $repositorySet = $this->createRepositorySet(true, $platformRepo, $aliases);
$repositorySet->addRepository($resultRepo); $repositorySet->addRepository($resultRepo);
$request = $this->createRequest($this->fixedRootPackage, $platformRepo, null); $request = $this->createRequest($this->fixedRootPackage, $platformRepo);
$links = $this->package->getRequires(); $links = $this->package->getRequires();
foreach ($links as $link) { foreach ($links as $link) {
@ -996,7 +996,7 @@ class Installer
if (!$this->optimizeAutoloader) { if (!$this->optimizeAutoloader) {
// Force classMapAuthoritative off when not optimizing the // Force classMapAuthoritative off when not optimizing the
// autoloader // autoloader
$this->setClassMapAuthoritative(false); $this->setClassMapAuthoritative();
} }
return $this; return $this;

@ -230,7 +230,7 @@ class InstallationManager
exit(130); exit(130);
}; };
sapi_windows_set_ctrl_handler($windowsHandler, true); sapi_windows_set_ctrl_handler($windowsHandler);
} }
try { try {

@ -385,7 +385,7 @@ class JsonManipulator
if ($subName !== null) { if ($subName !== null) {
$curVal = json_decode($matches['content'], true); $curVal = json_decode($matches['content'], true);
unset($curVal[$name][$subName]); unset($curVal[$name][$subName]);
$childrenClean = $that->format($curVal, 0); $childrenClean = $that->format($curVal);
} }
return $matches['start'] . $childrenClean . $matches['end']; return $matches['start'] . $childrenClean . $matches['end'];

@ -637,7 +637,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
} }
// load acceptable packages in the providers // load acceptable packages in the providers
$loadedPackages = $this->createPackages($versionsToLoad, 'Composer\Package\CompletePackage'); $loadedPackages = $this->createPackages($versionsToLoad);
$uids = array_keys($versionsToLoad); $uids = array_keys($versionsToLoad);
foreach ($loadedPackages as $index => $package) { foreach ($loadedPackages as $index => $package) {
@ -667,7 +667,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
$repoData = $this->loadDataFromServer(); $repoData = $this->loadDataFromServer();
foreach ($this->createPackages($repoData, 'Composer\Package\CompletePackage') as $package) { foreach ($this->createPackages($repoData) as $package) {
$this->addPackage($package); $this->addPackage($package);
} }
} }
@ -764,7 +764,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
} }
} }
$loadedPackages = $repo->createPackages($versionsToLoad, 'Composer\Package\CompletePackage'); $loadedPackages = $repo->createPackages($versionsToLoad);
foreach ($loadedPackages as $package) { foreach ($loadedPackages as $package) {
$package->setRepository($repo); $package->setRepository($repo);
$packages[spl_object_hash($package)] = $package; $packages[spl_object_hash($package)] = $package;

@ -207,7 +207,7 @@ class Svn
$this->credentials['username'] = $this->io->ask("Username: "); $this->credentials['username'] = $this->io->ask("Username: ");
$this->credentials['password'] = $this->io->askAndHideAnswer("Password: "); $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
$this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true); $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ");
return $this; return $this;
} }

Loading…
Cancel
Save