Skip to content

Config\Resource\ReflectionClassResource have not needed dependencies on EventSubscriberInterface #26501

Closed
@mpoiriert

Description

@mpoiriert
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version >= 3.4.5

There is a dependency on Symfony\Component\EventDispatcher\EventSubscriberInterface in Symfony\Component\Config\Resource\ReflectionClassResource.
I am using the config and dependency-injection components and when trying to compile/dump the container I get a exception. Same thing would happen on Symfony\Component\DependencyInjection\ServiceSubscriberInterface.

Those if should also have a class_exists check:

 if ($class->isSubclassOf(EventSubscriberInterface::class)) {
            yield EventSubscriberInterface::class;
            yield print_r(\call_user_func(array($class->name, 'getSubscribedEvents')), true);
        }

        if ($class->isSubclassOf(ServiceSubscriberInterface::class)) {
            yield ServiceSubscriberInterface::class;
            yield print_r(\call_user_func(array($class->name, 'getSubscribedServices')), true);
        } 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions