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

Breadcrumb

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

function ResolveChildDefinitionsPass::processValue

Overrides AbstractRecursivePass::processValue

File

vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php, line 34

Class

ResolveChildDefinitionsPass
This replaces all ChildDefinition instances with their equivalent fully merged Definition instance.

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

protected function processValue(mixed $value, bool $isRoot = false) : mixed {
    if (!$value instanceof Definition) {
        return parent::processValue($value, $isRoot);
    }
    if ($isRoot) {
        // yes, we are specifically fetching the definition from the
        // container to ensure we are not operating on stale data
        $value = $this->container
            ->getDefinition($this->currentId);
    }
    if ($value instanceof ChildDefinition) {
        $this->currentPath = [];
        $value = $this->resolveDefinition($value);
        if ($isRoot) {
            $this->container
                ->setDefinition($this->currentId, $value);
        }
    }
    return parent::processValue($value, $isRoot);
}
RSS feed
Powered by Drupal