Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Solver.php

function Solver::solve

File

vendor/composer/composer/src/Composer/DependencyResolver/Solver.php, line 175

Class

Solver
@author Nils Adermann <naderman@naderman.de>

Namespace

Composer\DependencyResolver

Code

public function solve(Request $request, ?PlatformRequirementFilterInterface $platformRequirementFilter = null) : LockTransaction {
    $platformRequirementFilter = $platformRequirementFilter ?? PlatformRequirementFilterFactory::ignoreNothing();
    $this->setupFixedMap($request);
    $this->io
        ->writeError('Generating rules', true, IOInterface::DEBUG);
    $ruleSetGenerator = new RuleSetGenerator($this->policy, $this->pool);
    $this->rules = $ruleSetGenerator->getRulesFor($request, $platformRequirementFilter);
    unset($ruleSetGenerator);
    $this->checkForRootRequireProblems($request, $platformRequirementFilter);
    $this->decisions = new Decisions($this->pool);
    $this->watchGraph = new RuleWatchGraph();
    foreach ($this->rules as $rule) {
        $this->watchGraph
            ->insert(new RuleWatchNode($rule));
    }
    
    /* make decisions based on root require/fix assertions */
    $this->makeAssertionRuleDecisions();
    $this->io
        ->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
    $before = microtime(true);
    $this->runSat();
    $this->io
        ->writeError('', true, IOInterface::DEBUG);
    $this->io
        ->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
    if (\count($this->problems) > 0) {
        throw new SolverProblemsException($this->problems, $this->learnedPool);
    }
    return new LockTransaction($this->pool, $request->getPresentMap(), $request->getFixedPackagesMap(), $this->decisions);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal