Skip to content

Commit 9f8d989

Browse files
[DI] Add missing deprecation when fetching private services from ContainerBuilder
1 parent b9fb27c commit 9f8d989

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,10 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV
559559
if ($this->isCompiled()) {
560560
$id = $this->normalizeId($id);
561561

562-
if (isset($this->definitions[$id]) && $this->definitions[$id]->isPrivate()) {
562+
if (isset($this->definitions[$id]) && (!$this->definitions[$id]->isPublic() || $this->definitions[$id]->isPrivate())) {
563563
@trigger_error(sprintf('Fetching the "%s" private service is deprecated and will fail in Symfony 4.0. Make the service public instead.', $id), E_USER_DEPRECATED);
564564
}
565-
if (isset($this->aliasDefinitions[$id]) && $this->aliasDefinitions[$id]->isPrivate()) {
565+
if (isset($this->aliasDefinitions[$id]) && (!$this->aliasDefinitions[$id]->isPublic() || $this->aliasDefinitions[$id]->isPrivate())) {
566566
@trigger_error(sprintf('Fetching the "%s" private alias is deprecated and will fail in Symfony 4.0. Make the alias public instead.', $id), E_USER_DEPRECATED);
567567
}
568568
}

0 commit comments

Comments
 (0)