Skip to content

Commit

Permalink
exception messages: register -> add
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Aug 13, 2020
1 parent 6495c95 commit 67ee8ec
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/DI/Extensions/InjectExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private static function checkType($class, string $name, ?string $type, $containe
} elseif (!class_exists($type) && !interface_exists($type)) {
throw new Nette\InvalidStateException("Class or interface '$type' used in @var annotation at $propName not found. Check annotation and 'use' statements.");
} elseif ($container && !$container->getByType($type, false)) {
throw new Nette\DI\MissingServiceException("Service of type $type used in @var annotation at $propName not found. Did you register it in configuration file?");
throw new Nette\DI\MissingServiceException("Service of type $type used in @var annotation at $propName not found. Did you add it to configuration file?");
}
}
}
2 changes: 1 addition & 1 deletion src/DI/Resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ private static function autowireArgument(\ReflectionParameter $parameter, callab
if ($res !== null || $parameter->allowsNull()) {
return $res;
} elseif (class_exists($type) || interface_exists($type)) {
throw new ServiceCreationException("Service of type $type needed by $desc not found. Did you register it in configuration file?");
throw new ServiceCreationException("Service of type $type needed by $desc not found. Did you add it to configuration file?");
} else {
throw new ServiceCreationException("Class $type needed by $desc not found. Check type hint and 'use' statements.");
}
Expand Down
2 changes: 1 addition & 1 deletion tests/DI/ContainerBuilder.selfdependency.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ $builder->addDefinition(null)

Assert::exception(function () use ($builder) {
createContainer($builder);
}, Nette\DI\ServiceCreationException::class, 'Service of type Foo: Service of type Foo needed by $foo in __construct() not found. Did you register it in configuration file?');
}, Nette\DI\ServiceCreationException::class, 'Service of type Foo: Service of type Foo needed by $foo in __construct() not found. Did you add it to configuration file?');
2 changes: 1 addition & 1 deletion tests/DI/InjectExtension.errors.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ services:
factory: ServiceA
inject: yes
');
}, InvalidStateException::class, 'Service of type DateTimeImmutable used in @var annotation at ServiceA::$a not found. Did you register it in configuration file?');
}, InvalidStateException::class, 'Service of type DateTimeImmutable used in @var annotation at ServiceA::$a not found. Did you add it to configuration file?');


Assert::exception(function () use ($compiler) {
Expand Down
2 changes: 1 addition & 1 deletion tests/DI/Resolver.autowireArguments.errors.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php';

Assert::exception(function () {
Resolver::autowireArguments(new ReflectionFunction(function (stdClass $x) {}), [], function () {});
}, Nette\DI\ServiceCreationException::class, 'Service of type stdClass needed by $x in {closure}() not found. Did you register it in configuration file?');
}, Nette\DI\ServiceCreationException::class, 'Service of type stdClass needed by $x in {closure}() not found. Did you add it to configuration file?');


Assert::exception(function () {
Expand Down

0 comments on commit 67ee8ec

Please sign in to comment.