1
0
Fork 0

Fix require failing to do a dry-run when requiring a package with a stability flag, fixes #11112

pull/11079/merge
Jordi Boggiano 2022-10-13 16:29:08 +02:00
parent 7e679f3da3
commit acddc1f5e4
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 10 additions and 0 deletions

View File

@ -14,6 +14,7 @@ namespace Composer\Command;
use Composer\DependencyResolver\Request;
use Composer\Package\CompletePackageInterface;
use Composer\Package\Loader\RootPackageLoader;
use Composer\Util\Filesystem;
use Composer\Util\PackageSorter;
use Seld\Signal\SignalHandler;
@ -410,6 +411,15 @@ EOT
}
$rootPackage->setRequires($links['require']);
$rootPackage->setDevRequires($links['require-dev']);
// extract stability flags & references as they weren't present when loading the unmodified composer.json
$references = $rootPackage->getReferences();
$references = RootPackageLoader::extractReferences($requirements, $references);
$rootPackage->setReferences($references);
$stabilityFlags = $rootPackage->getStabilityFlags();
$stabilityFlags = RootPackageLoader::extractStabilityFlags($requirements, $rootPackage->getMinimumStability(), $stabilityFlags);
$rootPackage->setStabilityFlags($stabilityFlags);
unset($stabilityFlags, $references);
}
$updateDevMode = !$input->getOption('update-no-dev');