Skip to content
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

[EventDispatcher] Improve method resolving when event is omitted in tag #50777

Open
wants to merge 1 commit into
base: 7.1
Choose a base branch
from

Conversation

nikophil
Copy link
Contributor

@nikophil nikophil commented Jun 26, 2023

Q A
Branch? 6.4
Bug fix? no
New feature? no
Deprecations? no
License MIT
Doc PR don't know if it is needed

if both event and method names are omitted in the listener's tag, we automatically fallback on __invoke
maybe we can check if a unique public method exists, and then fallback on it?

(not sure if this should be considered as a bugfix or new feature...)

ping @GromNaN

@carsonbot carsonbot added this to the 6.4 milestone Jun 26, 2023
|| !($r = $container->getReflectionClass($class, false))
|| 1 !== count($publicMethods = $r->getMethods(\ReflectionMethod::IS_PUBLIC))
) {
return '__invoke';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept this for BC, but I'm wondering if an exception should not be thrown here 🤔

@nikophil nikophil force-pushed the feat/improve-method-resolving branch from 1846724 to 3a59207 Compare June 26, 2023 07:33
@kbond kbond changed the title [EnventDispatcher] Improve method resolving when event is omitted in tag [EventDispatcher] Improve method resolving when event is omitted in tag Jun 26, 2023
@nicolas-grekas nicolas-grekas modified the milestones: 6.4, 7.1 Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants