Skip to content

[config] Cannot extend EventSubscriberInterface #26459

Closed
@blackandred

Description

@blackandred
Q A
Bug report? yes
Feature request? no
BC Break report? ?
RFC? no
Symfony version 4.0.5

Cannot create an interface that extends EventSubscriberInterface because the ReflectionClassResource is not considering an inheritence of this interface.

The temporary solution is to get the interface out of autowiring namespace.
Exclusion from autowiring does not work.

The conflicting code is this:

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

The error:

Warning: call_user_func() expects parameter 1 to be a valid callback, cannot call abstract method App\Event\SubscriberInterface::getSubscribedEvents()

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