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

Added an extra rejection to prevent events being passed to invalid handlers #438

Merged
merged 5 commits into from
Sep 5, 2023

Conversation

27pchrisl
Copy link
Contributor

@27pchrisl 27pchrisl commented Sep 1, 2023

Fixes #437. Essentially if you'll accept null you're too accepting (un-typed params, variadics etc.) I also added a test to check handling interfaces still works.

Copy link
Member

@sebastiandedeyne sebastiandedeyne left a comment

Choose a reason for hiding this comment

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

Can we do this in HandlesEvents too to keep the logic between discovering handlers for aggregate roots & projectors/reactors consistent?

Or could that be a breaking change for some?

@27pchrisl
Copy link
Contributor Author

I can't think of a reason someone would have deliberately created a real event handler that could accept null as its first argument, or even done that accidentally....

@sebastiandedeyne
Copy link
Member

The only case I can think of is a "catch-all" projector or reactor without a typehint, but in that case it can be fixed by hinting ShouldBeStored.

Merging and tagging, thank you!

@sebastiandedeyne sebastiandedeyne merged commit 83a06c8 into spatie:main Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Version 7.3.7 tries to apply events to variadic and untyped functions in the aggregate root
2 participants