Skip to content

Commit 355cefb

Browse files
committed
fixed exception messages
1 parent e22a353 commit 355cefb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/DI/ContainerBuilder.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function addDefinition(?string $name, ?Definition $definition = null): De
7575
$name = '0' . $i; // prevents converting to integer in array key
7676

7777
} elseif (is_int(key([$name => 1])) || !preg_match('#^\w+(\.\w+)*$#D', $name)) {
78-
throw new Nette\InvalidArgumentException(sprintf('Service name must be a alpha-numeric string and not a number, %s given.', gettype($name)));
78+
throw new Nette\InvalidArgumentException(sprintf("Service name must be a alpha-numeric string and not a number, '%s' given.", $name));
7979

8080
} else {
8181
$name = $this->aliases[$name] ?? $name;
@@ -176,10 +176,10 @@ public function hasDefinition(string $name): bool
176176
public function addAlias(string $alias, string $service): void
177177
{
178178
if (!$alias) { // builder is not ready for falsy names such as '0'
179-
throw new Nette\InvalidArgumentException(sprintf('Alias name must be a non-empty string, %s given.', gettype($alias)));
179+
throw new Nette\InvalidArgumentException(sprintf("Alias name must be a non-empty string, '%s' given.", $alias));
180180

181181
} elseif (!$service) { // builder is not ready for falsy names such as '0'
182-
throw new Nette\InvalidArgumentException(sprintf('Service name must be a non-empty string, %s given.', gettype($service)));
182+
throw new Nette\InvalidArgumentException(sprintf("Service name must be a non-empty string, '%s' given.", $service));
183183

184184
} elseif (isset($this->aliases[$alias])) {
185185
throw new Nette\InvalidStateException(sprintf("Alias '%s' has already been added.", $alias));

0 commit comments

Comments
 (0)