Skip to content

Commit

Permalink
fixed exception messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Mar 13, 2023
1 parent 59791c6 commit ecddce5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/DI/ContainerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,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;
Expand Down Expand Up @@ -170,10 +170,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));
Expand Down

0 comments on commit ecddce5

Please sign in to comment.