You are here

private function CheckReferenceValidityPass::validateReferences in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php \Symfony\Component\DependencyInjection\Compiler\CheckReferenceValidityPass::validateReferences()

Validates an array of References.

Parameters

array $arguments An array of Reference objects:

Throws

RuntimeException when there is a reference to an abstract definition.

1 call to CheckReferenceValidityPass::validateReferences()
CheckReferenceValidityPass::process in vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php
Processes the ContainerBuilder to validate References.

File

vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php, line 90

Class

CheckReferenceValidityPass
Checks the validity of references.

Namespace

Symfony\Component\DependencyInjection\Compiler

Code

private function validateReferences(array $arguments) {
  foreach ($arguments as $argument) {
    if (is_array($argument)) {
      $this
        ->validateReferences($argument);
    }
    elseif ($argument instanceof Reference) {
      $targetDefinition = $this
        ->getDefinition((string) $argument);
      if (null !== $targetDefinition && $targetDefinition
        ->isAbstract()) {
        throw new RuntimeException(sprintf('The definition "%s" has a reference to an abstract definition "%s". ' . 'Abstract definitions cannot be the target of references.', $this->currentId, $argument));
      }
      $this
        ->validateScope($argument, $targetDefinition);
    }
  }
}