Skip to content

Commit

Permalink
added functionality for PhpFileLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
przemyslaw-bogusz committed Jan 27, 2019
1 parent 36c62ca commit 3bbf849
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Expand Up @@ -1525,9 +1525,14 @@ public function getRemovedBindingIds()
*
* @internal
*/
public function addRemovedBindingId($id)
public function addRemovedBindingIds($id)
{
$this->removedBindingIds[(int) $id] = true;
if ($this->hasDefinition($id)) {
foreach ($this->getDefinition($id)->getBindings() as $key => $binding) {
list(, $bindingId) = $binding->getValues();
$this->removedBindingIds[(int) $bindingId] = true;
}
}
}

/**
Expand Down
Expand Up @@ -59,6 +59,8 @@ public function __destruct()
{
parent::__destruct();

$this->container->addRemovedBindingIds($this->id);

if (!$this->definition instanceof ChildDefinition) {
$this->container->setDefinition($this->id, $this->definition->setInstanceofConditionals($this->instanceof));
} else {
Expand Down
Expand Up @@ -91,12 +91,7 @@ public function registerClasses(Definition $prototype, $namespace, $resource, $e
*/
protected function setDefinition($id, Definition $definition)
{
if ($this->container->hasDefinition($id)) {
foreach ($this->container->getDefinition($id)->getBindings() as $key => $binding) {
list(, $bindingId) = $binding->getValues();
$this->container->addRemovedBindingId($bindingId);
}
}
$this->container->addRemovedBindingIds($id);

if ($this->isLoadingInstanceof) {
if (!$definition instanceof ChildDefinition) {
Expand Down

0 comments on commit 3bbf849

Please sign in to comment.