diff --git a/src/Symfony/ContainerMeta.php b/src/Symfony/ContainerMeta.php
index 433c021..f64347b 100644
--- a/src/Symfony/ContainerMeta.php
+++ b/src/Symfony/ContainerMeta.php
@@ -97,14 +97,20 @@ private function init(array $containerXmlPaths): void
$xml->load($containerXmlPath);
foreach ($this->container->getDefinitions() as $definition) {
+ if ($definition->hasTag('container.service_locator')) {
+ continue;
+ }
+
$definitionFactory = $definition->getFactory();
if ($definition->hasTag('container.service_locator_context') && is_array($definitionFactory)) {
/** @var Reference $reference */
$reference = $definitionFactory[0];
$id = $definition->getTag('container.service_locator_context')[0]['id'];
- $this->classLocators[$this->container->getDefinition($id)->getClass() ?? $id] = (string) $reference;
- } elseif ($definition->hasTag('container.service_locator')) {
- continue;
+ try {
+ $this->classLocators[$this->container->getDefinition($id)->getClass() ?? $id] = (string) $reference;
+ } catch (ServiceNotFoundException) {
+ continue;
+ }
} elseif (null !== $className = $definition->getClass()) {
$this->classNames[] = $className;
}
diff --git a/tests/acceptance/container.xml b/tests/acceptance/container.xml
index 7b34076..3d20c51 100644
--- a/tests/acceptance/container.xml
+++ b/tests/acceptance/container.xml
@@ -46,7 +46,7 @@
-
+
@@ -66,7 +66,7 @@
-
+
@@ -87,5 +87,12 @@
+
+
+
+ kernel::registerContainerConfiguration()
+
+
+