From a0c5d519e985009fc6a50df03cffb6b886674ffa Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Tue, 14 Apr 2020 22:35:13 +0200 Subject: [PATCH] Restore --no-suggest but mark it deprecated, remove --no-custom-installers and mark --dev also deprecated with stronger wording --- src/Composer/Command/InstallCommand.php | 20 +++++++++----------- src/Composer/Command/RequireCommand.php | 5 +++++ src/Composer/Command/UpdateCommand.php | 14 ++++++-------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Composer/Command/InstallCommand.php b/src/Composer/Command/InstallCommand.php index d059928cc..033f32195 100644 --- a/src/Composer/Command/InstallCommand.php +++ b/src/Composer/Command/InstallCommand.php @@ -38,9 +38,9 @@ class InstallCommand extends BaseCommand new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'), new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'), new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'), - new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'), + new InputOption('dev', null, InputOption::VALUE_NONE, 'DEPRECATED: Enables installation of require-dev packages (enabled by default, only present for BC).'), + new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'), new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'), - new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'), new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'), new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'), new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'), @@ -69,21 +69,19 @@ EOT protected function execute(InputInterface $input, OutputInterface $output) { $io = $this->getIO(); + if ($input->getOption('dev')) { + $io->writeError('You are using the deprecated option "--dev". It has no effect and will break in Composer 3.'); + } + if ($input->getOption('no-suggest')) { + $io->writeError('You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.'); + } + if ($args = $input->getArgument('packages')) { $io->writeError('Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.'); return 1; } - if ($input->getOption('no-custom-installers')) { - $io->writeError('You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.'); - $input->setOption('no-plugins', true); - } - - if ($input->getOption('dev')) { - $io->writeError('You are using the deprecated option "dev". Dev packages are installed by default now.'); - } - $composer = $this->getComposer(true, $input->getOption('no-plugins')); $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output); diff --git a/src/Composer/Command/RequireCommand.php b/src/Composer/Command/RequireCommand.php index 5b040b038..67188504d 100644 --- a/src/Composer/Command/RequireCommand.php +++ b/src/Composer/Command/RequireCommand.php @@ -59,6 +59,7 @@ class RequireCommand extends InitCommand new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'), new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'), new InputOption('fixed', null, InputOption::VALUE_NONE, 'Write fixed version to the composer.json.'), + new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'), new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'), new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'), new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'), @@ -104,6 +105,10 @@ EOT $this->file = Factory::getComposerFile(); $io = $this->getIO(); + if ($input->getOption('no-suggest')) { + $io->writeError('You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.'); + } + $this->newlyCreated = !file_exists($this->file); if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) { $io->writeError(''.$this->file.' could not be created.'); diff --git a/src/Composer/Command/UpdateCommand.php b/src/Composer/Command/UpdateCommand.php index 840f7ae28..9c875a57d 100644 --- a/src/Composer/Command/UpdateCommand.php +++ b/src/Composer/Command/UpdateCommand.php @@ -42,12 +42,12 @@ class UpdateCommand extends BaseCommand new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'), new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'), new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'), - new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'), + new InputOption('dev', null, InputOption::VALUE_NONE, 'DEPRECATED: Enables installation of require-dev packages (enabled by default, only present for BC).'), new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'), new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'), - new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'), new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'), new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'), + new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'DEPRECATED: This flag does not exist anymore.'), new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'), new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Update also dependencies of packages in the argument list, except those which are root requirements.'), new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Update also dependencies of packages in the argument list, including those which are root requirements.'), @@ -90,13 +90,11 @@ EOT protected function execute(InputInterface $input, OutputInterface $output) { $io = $this->getIO(); - if ($input->getOption('no-custom-installers')) { - $io->writeError('You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.'); - $input->setOption('no-plugins', true); - } - if ($input->getOption('dev')) { - $io->writeError('You are using the deprecated option "dev". Dev packages are installed by default now.'); + $io->writeError('You are using the deprecated option "--dev". It has no effect and will break in Composer 3.'); + } + if ($input->getOption('no-suggest')) { + $io->writeError('You are using the deprecated option "--no-suggest". It has no effect and will break in Composer 3.'); } $composer = $this->getComposer(true, $input->getOption('no-plugins'));