8000 bug #26400 [Config] ReflectionClassResource check abstract class (and… · symfony/symfony@f77db05 · GitHub
[go: up one dir, main page]

Skip to content

Commit f77db05

Browse files
committed
bug #26400 [Config] ReflectionClassResource check abstract class (andrey1s)
This PR was merged into the 3.4 branch. Discussion ---------- [Config] ReflectionClassResource check abstract class generate Signature update hash methods `ServiceSubscriberInterface::getSubscribedServices` and `EventSubscriberInterface::getSubscribedEvents` if the class is not abstract | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #26459, #26501 | License | MIT Commits ------- e851514 [Config] ReflectionClassResource check abstract ServiceSubscriberInterface and EventSubscriberInterface
2 parents 2655496 + e851514 commit f77db05

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Symfony/Component/Config/Resource/ReflectionClassResource.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,16 @@ private function generateSignature(\ReflectionClass $class)
155155
}
156156
}
157157

158-
if ($class->isSubclassOf(EventSubscriberInterface::class)) {
158+
if ($class->isAbstract() || $class->isInterface() || $class->isTrait()) {
159+
return;
160+
}
161+
162+
if (interface_exists(EventSubscriberInterface::class, false) && $class->isSubclassOf(EventSubscriberInterface::class)) {
159163
yield EventSubscriberInterface::class;
160164
yield print_r(\call_user_func(array($class->name, 'getSubscribedEvents')), true);
161165
}
162166

163-
if ($class->isSubclassOf(ServiceSubscriberInterface::class)) {
167+
if (interface_exists(ServiceSubscriberInterface::class, false) && $class->isSubclassOf(ServiceSubscriberInterface::class)) {
164168
yield ServiceSubscriberInterface::class;
165169
yield print_r(\call_user_func(array($class->name, 'getSubscribedServices')), true);
166170
}

0 commit comments

Comments
 (0)
0