Remove the allowUninstall policy option and clean up the only usage
parent
cbc021c05d
commit
ec61297122
|
@ -21,11 +21,6 @@ use Composer\Package\LinkConstraint\VersionConstraint;
|
||||||
*/
|
*/
|
||||||
class DefaultPolicy implements PolicyInterface
|
class DefaultPolicy implements PolicyInterface
|
||||||
{
|
{
|
||||||
public function allowUninstall()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
|
public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
|
||||||
{
|
{
|
||||||
$constraint = new VersionConstraint($operator, $b->getVersion());
|
$constraint = new VersionConstraint($operator, $b->getVersion());
|
||||||
|
|
|
@ -20,7 +20,6 @@ use Composer\Package\PackageInterface;
|
||||||
*/
|
*/
|
||||||
interface PolicyInterface
|
interface PolicyInterface
|
||||||
{
|
{
|
||||||
function allowUninstall();
|
|
||||||
function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
|
function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
|
||||||
function findUpdatePackages(Solver $solver, Pool $pool, array $installedMap, PackageInterface $package);
|
function findUpdatePackages(Solver $solver, Pool $pool, array $installedMap, PackageInterface $package);
|
||||||
function installable(Solver $solver, Pool $pool, array $installedMap, PackageInterface $package);
|
function installable(Solver $solver, Pool $pool, array $installedMap, PackageInterface $package);
|
||||||
|
|
|
@ -986,14 +986,9 @@ class Solver
|
||||||
$updates = $this->policy->findUpdatePackages($this, $this->pool, $this->installedMap, $package);
|
$updates = $this->policy->findUpdatePackages($this, $this->pool, $this->installedMap, $package);
|
||||||
$rule = $this->createUpdateRule($package, $updates, self::RULE_INTERNAL_ALLOW_UPDATE, (string) $package);
|
$rule = $this->createUpdateRule($package, $updates, self::RULE_INTERNAL_ALLOW_UPDATE, (string) $package);
|
||||||
|
|
||||||
if ($this->policy->allowUninstall()) {
|
|
||||||
$rule->setWeak(true);
|
$rule->setWeak(true);
|
||||||
$this->addRule(RuleSet::TYPE_FEATURE, $rule);
|
$this->addRule(RuleSet::TYPE_FEATURE, $rule);
|
||||||
$this->packageToFeatureRule[$package->getId()] = $rule;
|
$this->packageToFeatureRule[$package->getId()] = $rule;
|
||||||
} else {
|
|
||||||
$this->addRule(RuleSet::TYPE_UPDATE, $rule);
|
|
||||||
$this->packageToUpdateRule[$package->getId()] = $rule;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->jobs as $job) {
|
foreach ($this->jobs as $job) {
|
||||||
|
|
Loading…
Reference in New Issue