Skip to content

Commit

Permalink
ContainerBuilder::removeDefinition() fixed keys in $classes [Closes #72]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jun 17, 2015
1 parent 4f0d2f8 commit d690c94
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/DI/ContainerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function removeDefinition($name)
if ($this->classes) {
foreach ($this->classes as & $tmp) {
foreach ($tmp as & $names) {
$names = array_diff($names, array($name));
$names = array_values(array_diff($names, array($name)));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/DI/ContainerBuilder.removeDefinition.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ Assert::exception(function () use ($builder) {
Assert::count( 4, $builder->findByType('stdClass') );


$builder->removeDefinition('two');
$builder->removeDefinition('one');
$builder->removeDefinition('four');

Assert::same( 'one', $builder->getByType('stdClass') );
Assert::same( 'two', $builder->getByType('stdClass') );

Assert::count( 2, $builder->findByType('stdClass') );

Expand Down

0 comments on commit d690c94

Please sign in to comment.