diff --git a/src/DI/ContainerBuilder.php b/src/DI/ContainerBuilder.php index fe973d835..9a85e8096 100644 --- a/src/DI/ContainerBuilder.php +++ b/src/DI/ContainerBuilder.php @@ -75,7 +75,7 @@ public function addDefinition(?string $name, ?Definition $definition = null): De $name = '0' . $i; // prevents converting to integer in array key } elseif (is_int(key([$name => 1])) || !preg_match('#^\w+(\.\w+)*$#D', $name)) { - throw new Nette\InvalidArgumentException(sprintf('Service name must be a alpha-numeric string and not a number, %s given.', gettype($name))); + throw new Nette\InvalidArgumentException(sprintf("Service name must be a alpha-numeric string and not a number, '%s' given.", $name)); } else { $name = $this->aliases[$name] ?? $name; @@ -176,10 +176,10 @@ public function hasDefinition(string $name): bool public function addAlias(string $alias, string $service): void { if (!$alias) { // builder is not ready for falsy names such as '0' - throw new Nette\InvalidArgumentException(sprintf('Alias name must be a non-empty string, %s given.', gettype($alias))); + throw new Nette\InvalidArgumentException(sprintf("Alias name must be a non-empty string, '%s' given.", $alias)); } elseif (!$service) { // builder is not ready for falsy names such as '0' - throw new Nette\InvalidArgumentException(sprintf('Service name must be a non-empty string, %s given.', gettype($service))); + throw new Nette\InvalidArgumentException(sprintf("Service name must be a non-empty string, '%s' given.", $service)); } elseif (isset($this->aliases[$alias])) { throw new Nette\InvalidStateException(sprintf("Alias '%s' has already been added.", $alias));