You are here

private function CheckReferenceValidityPass::validateReferences in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/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 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php
Processes the ContainerBuilder to validate References.

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php, line 91

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