private function 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 drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php
Processes the ContainerBuilder to validate References.

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php, line 92

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);
    }
  }
}