private function CheckReferenceValidityPass::validateScope in Service Container 7.2
Same name and namespace in other branches
- 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php \Symfony\Component\DependencyInjection\Compiler\CheckReferenceValidityPass::validateScope()
Validates the scope of a single Reference.
Parameters
Reference $reference:
Definition $definition:
Throws
ScopeWideningInjectionException when the definition references a service of a narrower scope
ScopeCrossingInjectionException when the definition references a service of another scope hierarchy
1 call to CheckReferenceValidityPass::validateScope()
- CheckReferenceValidityPass::validateReferences in modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Compiler/ CheckReferenceValidityPass.php - Validates an array of References.
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Compiler/ CheckReferenceValidityPass.php, line 122
Class
- CheckReferenceValidityPass
- Checks the validity of references.
Namespace
Symfony\Component\DependencyInjection\CompilerCode
private function validateScope(Reference $reference, Definition $definition = null) {
if (ContainerInterface::SCOPE_PROTOTYPE === $this->currentScope) {
return;
}
if (!$reference
->isStrict()) {
return;
}
if (null === $definition) {
return;
}
if ($this->currentScope === ($scope = $definition
->getScope())) {
return;
}
$id = (string) $reference;
if (in_array($scope, $this->currentScopeChildren, true)) {
throw new ScopeWideningInjectionException($this->currentId, $this->currentScope, $id, $scope);
}
if (!in_array($scope, $this->currentScopeAncestors, true)) {
throw new ScopeCrossingInjectionException($this->currentId, $this->currentScope, $id, $scope);
}
}