8000 [config] Cannot extend EventSubscriberInterface · Issue #26459 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[config] Cannot extend EventSubscriberInterface #26459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
blackandred opened this issue Mar 8, 2018 · 2 comments
Closed

[config] Cannot extend EventSubscriberInterface #26459

blackandred opened this issue Mar 8, 2018 · 2 comments

Comments

@blackandred
Copy link
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()
@stof
Copy link
Member
stof commented Mar 8, 2018

@nicolas-grekas we should probably skip this code for abstract classes and interfaces.

@jakzal
Copy link
Contributor
jakzal commented Mar 8, 2018

see #26400

fabpot added a commit that referenced this issue Mar 13, 2018
…rey1s)

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
@fabpot fabpot closed this as completed Mar 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
0