Skip to content
Browse files

Container builder tweaks

  • Loading branch information...
1 parent 302dbd1 commit b7db5482d7c2632493e3bae2862226cee5f7655e @vicb vicb committed with fabpot Dec 23, 2010
Showing with 3 additions and 5 deletions.
  1. +3 −5 src/Symfony/Component/DependencyInjection/ContainerBuilder.php
View
8 src/Symfony/Component/DependencyInjection/ContainerBuilder.php
@@ -115,10 +115,9 @@ public function addResource(ResourceInterface $resource)
public function addObjectResource($object)
{
$parent = new \ReflectionObject($object);
- $this->addResource(new FileResource($parent->getFileName()));
- while ($parent = $parent->getParentClass()) {
+ do {
$this->addResource(new FileResource($parent->getFileName()));
- }
+ } while ($parent = $parent->getParentClass());
}
/**
@@ -182,8 +181,7 @@ public function set($id, $service)
throw new \BadMethodCallException('Setting service on a frozen container is not allowed');
}
- unset($this->definitions[$id]);
- unset($this->aliases[$id]);
+ unset($this->definitions[$id], $this->aliases[$id]);
parent::set($id, $service);
}

0 comments on commit b7db548

Please sign in to comment.
Something went wrong with that request. Please try again.