Skip to content

Commit d089514

Browse files
[DependencyInjection] Fix inlining when public services are involved
1 parent 4d94056 commit d089514

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Compiler/InlineServiceDefinitionsPass.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public function process(ContainerBuilder $container)
7373
if (!$this->graph->hasNode($id)) {
7474
continue;
7575
}
76+
if ($definition->isPublic()) {
77+
$this->connectedIds[$id] = true;
78+
}
7679
foreach ($this->graph->getNode($id)->getOutEdges() as $edge) {
7780
if (isset($notInlinedIds[$edge->getSourceNode()->getId()])) {
7881
$this->currentId = $id;
@@ -189,17 +192,13 @@ private function isInlineableDefinition(string $id, Definition $definition): boo
189192
return true;
190193
}
191194

192-
if ($definition->isPublic()) {
195+
if ($definition->isPublic()
196+
|| $this->currentId === $id
197+
|| !$this->graph->hasNode($id)
198+
) {
193199
return false;
194200
}
195201

196-
if (!$this->graph->hasNode($id)) {
197-
return true;
198-
}
199-
200-
if ($this->currentId === $id) {
201-
return false;
202-
}
203202
$this->connectedIds[$id] = true;
204203

205204
$srcIds = [];

0 commit comments

Comments
 (0)