fixed id case when setting a service (also slightly enhanced an error message)
This commit is contained in:
parent
cf29581cb2
commit
639c30c9be
@ -347,15 +347,15 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
*/
|
||||
public function set($id, $service, $scope = self::SCOPE_CONTAINER)
|
||||
{
|
||||
$id = strtolower($id);
|
||||
|
||||
if ($this->isFrozen()) {
|
||||
// setting a synthetic service on a frozen container is alright
|
||||
if (!isset($this->definitions[$id]) || !$this->definitions[$id]->isSynthetic()) {
|
||||
throw new BadMethodCallException('Setting service on a frozen container is not allowed');
|
||||
throw new BadMethodCallException(sprintf('Setting service "%s" on a frozen container is not allowed.', $id));
|
||||
}
|
||||
}
|
||||
|
||||
$id = strtolower($id);
|
||||
|
||||
unset($this->definitions[$id], $this->aliases[$id]);
|
||||
|
||||
parent::set($id, $service, $scope);
|
||||
|
Reference in New Issue
Block a user