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

Breadcrumb

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

function RuleWatchNode::watch2OnHighest

Places the second watch on the rule's literal, decided at the highest level

Useful for learned rules where the literal for the highest rule is most likely to quickly lead to further decisions.

Parameters

Decisions $decisions The decisions made so far by the solver:

File

vendor/composer/composer/src/Composer/DependencyResolver/RuleWatchNode.php, line 56

Class

RuleWatchNode
Wrapper around a Rule which keeps track of the two literals it watches

Namespace

Composer\DependencyResolver

Code

public function watch2OnHighest(Decisions $decisions) : void {
    $literals = $this->rule
        ->getLiterals();
    // if there are only 2 elements, both are being watched anyway
    if (\count($literals) < 3 || $this->rule instanceof MultiConflictRule) {
        return;
    }
    $watchLevel = 0;
    foreach ($literals as $literal) {
        $level = $decisions->decisionLevel($literal);
        if ($level > $watchLevel) {
            $this->watch2 = $literal;
            $watchLevel = $level;
        }
    }
}

API Navigation

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