Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

allow enum casting not only enum value casting #301

Merged
merged 1 commit into from
Sep 14, 2022
Merged

allow enum casting not only enum value casting #301

merged 1 commit into from
Sep 14, 2022

Conversation

regnerisch
Copy link
Contributor

This PR allows to cast enums, not just enum values.

@aidan-casey aidan-casey merged commit 488bef8 into spatie:main Sep 14, 2022
@aidan-casey
Copy link
Collaborator

Thanks, @regnerisch! I think this is a good approach even for backed enums as it will now allow the value to be an enum instance. 👍🏼

@regnerisch
Copy link
Contributor Author

That's the idea. I was a little irritated I have to do something like $data = MyData(origin: MyEnum::SOMETHING->value) to use the enum caster, so I created this PR :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants