Skip to content

Commit e15974d

Browse files
committed
fixed id case when setting a service (also slightly enhanced an error message)
1 parent ecd0974 commit e15974d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ContainerBuilder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,15 +347,15 @@ public function getScopeChildren()
347347
*/
348348
public function set($id, $service, $scope = self::SCOPE_CONTAINER)
349349
{
350+
$id = strtolower($id);
351+
350352
if ($this->isFrozen()) {
351353
// setting a synthetic service on a frozen container is alright
352354
if (!isset($this->definitions[$id]) || !$this->definitions[$id]->isSynthetic()) {
353-
throw new BadMethodCallException('Setting service on a frozen container is not allowed');
355+
throw new BadMethodCallException(sprintf('Setting service "%s" on a frozen container is not allowed.', $id));
354356
}
355357
}
356358

357-
$id = strtolower($id);
358-
359359
unset($this->definitions[$id], $this->aliases[$id]);
360360

361361
parent::set($id, $service, $scope);

0 commit comments

Comments
 (0)