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

Breadcrumb

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

function CheckCircularReferencesPass::checkOutEdges

Checks for circular references.

Parameters

ServiceReferenceGraphEdge[] $edges An array of Edges:

Throws

ServiceCircularReferenceException when a circular reference is found

1 call to CheckCircularReferencesPass::checkOutEdges()
CheckCircularReferencesPass::process in vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php
Checks the ContainerBuilder object for circular references.

File

vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php, line 54

Class

CheckCircularReferencesPass
Checks your services for circular references.

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

private function checkOutEdges(array $edges) : void {
    foreach ($edges as $edge) {
        $node = $edge->getDestNode();
        $id = $node->getId();
        if (empty($this->checkedNodes[$id])) {
            // Don't check circular references for lazy edges
            if (!$node->getValue() || !$edge->isLazy() && !$edge->isWeak()) {
                $searchKey = array_search($id, $this->currentPath);
                $this->currentPath[] = $id;
                if (false !== $searchKey) {
                    throw new ServiceCircularReferenceException($id, \array_slice($this->currentPath, $searchKey));
                }
                $this->checkOutEdges($node->getOutEdges());
            }
            $this->checkedNodes[$id] = true;
            array_pop($this->currentPath);
        }
    }
}
RSS feed
Powered by Drupal