function RuleWatchGraph::insert
Inserts a rule node into the appropriate chains within the graph
The node is prepended to the watch chains for each of the two literals it watches.
Assertions are skipped because they only depend on a single package and have no alternative literal that could be true, so there is no need to watch changes in any literals.
Parameters
RuleWatchNode $node The rule node to be inserted into the graph:
File
-
vendor/
composer/ composer/ src/ Composer/ DependencyResolver/ RuleWatchGraph.php, line 42
Class
- RuleWatchGraph
- The RuleWatchGraph efficiently propagates decisions to other rules
Namespace
Composer\DependencyResolverCode
public function insert(RuleWatchNode $node) : void {
if ($node->getRule()
->isAssertion()) {
return;
}
if (!$node->getRule() instanceof MultiConflictRule) {
foreach ([
$node->watch1,
$node->watch2,
] as $literal) {
if (!isset($this->watchChains[$literal])) {
$this->watchChains[$literal] = new RuleWatchChain();
}
$this->watchChains[$literal]
->unshift($node);
}
}
else {
foreach ($node->getRule()
->getLiterals() as $literal) {
if (!isset($this->watchChains[$literal])) {
$this->watchChains[$literal] = new RuleWatchChain();
}
$this->watchChains[$literal]
->unshift($node);
}
}
}