diff --git a/src/Composer/Command/CheckPlatformReqsCommand.php b/src/Composer/Command/CheckPlatformReqsCommand.php
index 6d59a93ba..b8fdbd78a 100644
--- a/src/Composer/Command/CheckPlatformReqsCommand.php
+++ b/src/Composer/Command/CheckPlatformReqsCommand.php
@@ -29,7 +29,7 @@ class CheckPlatformReqsCommand extends BaseCommand
$this->setName('check-platform-reqs')
->setDescription('Check that platform requirements are satisfied.')
->setDefinition(array(
- new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements, implies --lock.'),
+ new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
new InputOption('lock', null, InputOption::VALUE_NONE, 'Checks requirements only from the lock file, not from installed packages.'),
))
->setHelp(
@@ -49,21 +49,22 @@ EOT
$composer = $this->getComposer();
$requires = array();
- if ($input->getOption('no-dev') || $input->getOption('lock')) {
- if ($input->getOption('lock')) {
- $this->getIO()->writeError('Checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements using the lock file');
- } else {
- $this->getIO()->writeError('The --no-dev option implies --lock, checking platform requirements from lock file instead of vendor dir');
- }
+ $removePackages = array();
+ if ($input->getOption('lock')) {
+ $this->getIO()->writeError('Checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements using the lock file');
$installedRepo = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'));
} else {
$installedRepo = $composer->getRepositoryManager()->getLocalRepository();
// fallback to lockfile if installed repo is empty
if (!$installedRepo->getPackages()) {
- $this->getIO()->writeError('No vendor dir present, checking platform requirements from the lock file');
- $installedRepo = $composer->getLocker()->getLockedRepository(true);
+ $this->getIO()->writeError('No vendor dir present, checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements from the lock file');
+ $installedRepo = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'));
} else {
- $this->getIO()->writeError('Checking platform requirements for packages in the vendor dir');
+ if ($input->getOption('no-dev')) {
+ $removePackages = $installedRepo->getDevPackageNames();
+ }
+
+ $this->getIO()->writeError('Checking '.($input->getOption('no-dev') ? 'non-dev ' : '').'platform requirements for packages in the vendor dir');
}
}
if (!$input->getOption('no-dev')) {
@@ -76,6 +77,9 @@ EOT
$installedRepo = new InstalledRepository(array($installedRepo, new RootPackageRepository($composer->getPackage())));
foreach ($installedRepo->getPackages() as $package) {
+ if (in_array($package->getName(), $removePackages, true)) {
+ continue;
+ }
foreach ($package->getRequires() as $require => $link) {
$requires[$require][] = $link;
}