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

feat: handle native enum casts #1494

Merged
merged 2 commits into from Jan 15, 2023
Merged

Conversation

erikgaal
Copy link
Contributor

@erikgaal erikgaal commented Dec 28, 2022

Extends my previous PR, where I forgot to implement support for native enum casts.

Changes

Breaking changes

@canvural
Copy link
Collaborator

Weird, how did this pass in the CI with PHP 8.0? 🤔

Anyway, can you also add a test with backed enums?

@levu42
Copy link

levu42 commented Jan 13, 2023

What's the status of this PR? Is there something missing that I can help to provide? The bug fixed by this PR is still causing a bunch of false positives on my side, which is quite annoying, so: how can I help accelerate it to get it merged & released?

@erikgaal
Copy link
Contributor Author

@canvural I've added a test for backed enums.

@levu42 The PR is ready now. 😄

@szepeviktor
Copy link
Collaborator

@erikgaal Could it be that enum BackedEnumeration : string is not executed but analyzed on PHP 8.0 that is why it passes?

@erikgaal
Copy link
Contributor Author

@szepeviktor Yes, that's completely correct. It's not using the native PHP reflection (which would crash on 8.0), but the BetterReflection which comes from the PHPStan parser. 😄

@canvural
Copy link
Collaborator

This looks good. I'm merging it now, and gonna add some more test cases for the writeable type later.

Thank you.

@canvural canvural closed this Jan 15, 2023
@canvural canvural reopened this Jan 15, 2023
@canvural canvural merged commit 92cd4f5 into larastan:master Jan 15, 2023
@erikgaal erikgaal deleted the patch-enum-cast branch January 17, 2023 10:47
@levu42
Copy link

levu42 commented Feb 8, 2023

@canvural Do you have an estimation for when a release will be made with this included?

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.

Model field (enum via $casts) has type mixed
4 participants