Skip to content

Commit 58ed2d8

Browse files
committed
ContainerBuilder::removeDefinition() fixed keys in $classes [Closes #72]
1 parent 94f96ad commit 58ed2d8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/DI/ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function removeDefinition($name)
8383
if ($this->classes) {
8484
foreach ($this->classes as & $tmp) {
8585
foreach ($tmp as & $names) {
86-
$names = array_diff($names, [$name]);
86+
$names = array_values(array_diff($names, [$name]));
8787
}
8888
}
8989
}

tests/DI/ContainerBuilder.removeDefinition.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ Assert::exception(function () use ($builder) {
4242
Assert::count( 4, $builder->findByType('stdClass') );
4343

4444

45-
$builder->removeDefinition('two');
45+
$builder->removeDefinition('one');
4646
$builder->removeDefinition('four');
4747

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

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

0 commit comments

Comments
 (0)