function ServiceLocator::get
Same name in this branch
- 11.1.x vendor/symfony/dependency-injection/Argument/ServiceLocator.php \Symfony\Component\DependencyInjection\Argument\ServiceLocator::get()
2 calls to ServiceLocator::get()
- ServiceLocator::getIterator in vendor/
symfony/ dependency-injection/ ServiceLocator.php - ServiceLocator::__invoke in vendor/
symfony/ dependency-injection/ ServiceLocator.php
1 method overrides ServiceLocator::get()
- ServiceLocator::get in vendor/
symfony/ dependency-injection/ Argument/ ServiceLocator.php
File
-
vendor/
symfony/ dependency-injection/ ServiceLocator.php, line 40
Class
- ServiceLocator
- @author Robin Chalas <robin.chalas@gmail.com> @author Nicolas Grekas <p@tchwork.com>
Namespace
Symfony\Component\DependencyInjectionCode
public function get(string $id) : mixed {
if (!$this->externalId) {
return $this->doGet($id);
}
try {
return $this->doGet($id);
} catch (RuntimeException $e) {
$what = \sprintf('service "%s" required by "%s"', $id, $this->externalId);
$message = preg_replace('/service "\\.service_locator\\.[^"]++"/', $what, $e->getMessage());
if ($e->getMessage() === $message) {
$message = \sprintf('Cannot resolve %s: %s', $what, $message);
}
$r = new \ReflectionProperty($e, 'message');
$r->setValue($e, $message);
throw $e;
}
}