function AutowirePass::processValue
Overrides AbstractRecursivePass::processValue
2 calls to AutowirePass::processValue()
- AutowirePass::autowireMethod in vendor/
symfony/ dependency-injection/ Compiler/ AutowirePass.php - Autowires the constructor or a method.
- AutowirePass::doProcessValue in vendor/
symfony/ dependency-injection/ Compiler/ AutowirePass.php
File
-
vendor/
symfony/ dependency-injection/ Compiler/ AutowirePass.php, line 85
Class
- AutowirePass
- Inspects existing service definitions and wires the autowired ones using the type hints of their classes.
Namespace
Symfony\Component\DependencyInjection\CompilerCode
protected function processValue(mixed $value, bool $isRoot = false) : mixed {
if ($value instanceof Autowire) {
return $this->processValue($this->container
->getParameterBag()
->resolveValue($value->value));
}
if ($value instanceof AutowireDecorated) {
$definition = $this->container
->getDefinition($this->currentId);
return new Reference($definition->innerServiceId ?? $this->currentId . '.inner', $definition->decorationOnInvalid ?? ContainerInterface::NULL_ON_INVALID_REFERENCE);
}
try {
return $this->doProcessValue($value, $isRoot);
} catch (AutowiringFailedException $e) {
if ($this->throwOnAutowiringException) {
throw $e;
}
$this->container
->getDefinition($this->currentId)
->addError($e->getMessageCallback() ?? $e->getMessage());
return parent::processValue($value, $isRoot);
}
}