Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit daa7d00

Browse files
committed
[DependencyInjection] ContainerBuilder: Remove obsolete definitions
1 parent 8e3967d commit daa7d00

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
5050
*/
5151
private $definitions = array();
5252

53-
/**
54-
* @var Definition[]
55-
*/
56-
private $obsoleteDefinitions = array();
57-
5853
/**
5954
* @var Alias[]
6055
*/
@@ -346,21 +341,8 @@ public function set($id, $service)
346341
{
347342
$id = strtolower($id);
348343

349-
if ($this->isFrozen()) {
350-
// setting a synthetic service on a frozen container is alright
351-
if (
352-
(!isset($this->definitions[$id]) && !isset($this->obsoleteDefinitions[$id]))
353-
||
354-
(isset($this->definitions[$id]) && !$this->definitions[$id]->isSynthetic())
355-
||
356-
(isset($this->obsoleteDefinitions[$id]) && !$this->obsoleteDefinitions[$id]->isSynthetic())
357-
) {
358-
throw new BadMethodCallException(sprintf('Setting service "%s" on a frozen container is not allowed.', $id));
359-
}
360-
}
361-
362-
if (isset($this->definitions[$id])) {
363-
$this->obsoleteDefinitions[$id] = $this->definitions[$id];
344+
if ($this->isFrozen() && (!isset($this->definitions[$id]) || !$this->definitions[$id]->isSynthetic())) {
345+
throw new BadMethodCallException(sprintf('Setting service "%s" for an unknown or non-synthetic service definition on a frozen container is not allowed.', $id));
364346
}
365347

366348
unset($this->definitions[$id], $this->aliasDefinitions[$id]);

0 commit comments

Comments
 (0)