class ServiceNotFoundException
This exception is thrown when a non-existent service is requested.
@author Johannes M. Schmitt <schmittjoh@gmail.com>
Hierarchy
- class \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException extends \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException implements \Symfony\Component\DependencyInjection\Exception\ExceptionInterface
- class \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException extends \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException implements \Symfony\Component\DependencyInjection\Exception\ExceptionInterface
- class \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException extends \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException implements \Psr\Container\NotFoundExceptionInterface
- class \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException extends \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException implements \Symfony\Component\DependencyInjection\Exception\ExceptionInterface
Expanded class hierarchy of ServiceNotFoundException
13 files declare their use of ServiceNotFoundException
- AbstractServiceConfigurator.php in vendor/
symfony/ dependency-injection/ Loader/ Configurator/ AbstractServiceConfigurator.php - CheckExceptionOnInvalidReferenceBehaviorPass.php in vendor/
symfony/ dependency-injection/ Compiler/ CheckExceptionOnInvalidReferenceBehaviorPass.php - Container.php in vendor/
symfony/ dependency-injection/ Container.php - Container.php in core/
lib/ Drupal/ Component/ DependencyInjection/ Container.php - ContainerBuilder.php in vendor/
symfony/ dependency-injection/ ContainerBuilder.php
File
-
vendor/
symfony/ dependency-injection/ Exception/ ServiceNotFoundException.php, line 21
Namespace
Symfony\Component\DependencyInjection\ExceptionView source
class ServiceNotFoundException extends InvalidArgumentException implements NotFoundExceptionInterface {
public function __construct(string $id, ?string $sourceId = null, ?\Throwable $previous = null, array $alternatives = [], ?string $msg = null) {
if (null !== $msg) {
// no-op
}
elseif (null === $sourceId) {
$msg = \sprintf('You have requested a non-existent service "%s".', $id);
}
else {
$msg = \sprintf('The service "%s" has a dependency on a non-existent service "%s".', $sourceId, $id);
}
if ($alternatives) {
if (1 == \count($alternatives)) {
$msg .= ' Did you mean this: "';
}
else {
$msg .= ' Did you mean one of these: "';
}
$msg .= implode('", "', $alternatives) . '"?';
}
parent::__construct($msg, 0, $previous);
}
public function getId() : string {
return $this->id;
}
public function getSourceId() : ?string {
return $this->sourceId;
}
public function getAlternatives() : array {
return $this->alternatives;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ServiceNotFoundException::getAlternatives | public | function | |
ServiceNotFoundException::getId | public | function | |
ServiceNotFoundException::getSourceId | public | function | |
ServiceNotFoundException::__construct | public | function |