function InlineServiceDefinitionsPass::processValue
Overrides AbstractRecursivePass::processValue
1 call to InlineServiceDefinitionsPass::processValue()
- InlineServiceDefinitionsPass::process in vendor/
symfony/ dependency-injection/ Compiler/ InlineServiceDefinitionsPass.php - You can modify the container here before it is dumped to PHP code.
File
-
vendor/
symfony/ dependency-injection/ Compiler/ InlineServiceDefinitionsPass.php, line 110
Class
- InlineServiceDefinitionsPass
- Inline service definitions where this is possible.
Namespace
Symfony\Component\DependencyInjection\CompilerCode
protected function processValue(mixed $value, bool $isRoot = false) : mixed {
if ($value instanceof ArgumentInterface) {
// References found in ArgumentInterface::getValues() are not inlineable
return $value;
}
if ($value instanceof Definition && $this->cloningIds) {
if ($value->isShared()) {
return $value;
}
$value = clone $value;
}
if (!$value instanceof Reference) {
return parent::processValue($value, $isRoot);
}
elseif (!$this->container
->hasDefinition($id = (string) $value)) {
return $value;
}
$definition = $this->container
->getDefinition($id);
if (isset($this->notInlinableIds[$id]) || !$this->isInlineableDefinition($id, $definition)) {
if ($this->currentId !== $id) {
$this->notInlinableIds[$id] = true;
}
return $value;
}
$this->container
->log($this, \sprintf('Inlined service "%s" to "%s".', $id, $this->currentId));
$this->inlinedIds[$id] = $definition->isPublic() || !$definition->isShared();
$this->notInlinedIds[$this->currentId] = true;
if ($definition->isShared()) {
return $definition;
}
if (isset($this->cloningIds[$id])) {
$ids = array_keys($this->cloningIds);
$ids[] = $id;
throw new ServiceCircularReferenceException($id, \array_slice($ids, array_search($id, $ids)));
}
$this->cloningIds[$id] = true;
try {
return $this->processValue($definition);
} finally {
unset($this->cloningIds[$id]);
}
}