Skip to content

Commit 0000cd2

Browse files
[DependencyInjection] Fix inlining when public services are involved
1 parent f8cca42 commit 0000cd2

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class UnusedTagsPass implements CompilerPassInterface
3232
'chatter.transport_factory',
3333
'config_cache.resource_checker',
3434
'console.command',
35+
'container.decorator',
3536
'container.do_not_inline',
3637
'container.env_var_loader',
3738
'container.env_var_processor',

src/Symfony/Component/DependencyInjection/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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy