Skip to content

Commit e32f1b3

Browse files
[Config] Handle Service/EventSubscriberInterface in ReflectionClassResource
1 parent 4b2717e commit e32f1b3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Compiler/RegisterServiceSubscribersPass.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ protected function processValue($value, $isRoot = false)
5656
}
5757
$class = $value->getClass();
5858

59-
if (!is_subclass_of($class, ServiceSubscriberInterface::class)) {
60-
if (!class_exists($class, false)) {
61-
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $this->currentId));
62-
}
63-
59+
if (!$r = $this->container->getReflectionClass($class)) {
60+
throw new InvalidArgumentException(sprintf('Class "%s" used for service "%s" cannot be found.', $class, $this->currentId));
61+
}
62+
if (!$r->isSubclassOf(ServiceSubscriberInterface::class)) {
6463
throw new InvalidArgumentException(sprintf('Service "%s" must implement interface "%s".', $this->currentId, ServiceSubscriberInterface::class));
6564
}
66-
$this->container->addObjectResource($class);
65+
$class = $r->name;
66+
6767
$subscriberMap = array();
6868
$declaringClass = (new \ReflectionMethod($class, 'getSubscribedServices'))->class;
6969

0 commit comments

Comments
 (0)