Skip to content

[9.x] Fix pure enums validation - #45121

Merged
taylorotwell merged 1 commit into
laravel:9.xfrom
trckster:fix-pure-enums-validation
Nov 28, 2022
Merged

taylorotwell merged 1 commit into
laravel:9.xfrom
trckster:fix-pure-enums-validation

Conversation

@trckster

Copy link
Copy Markdown
Contributor

There was a problem when passing UnitEnum instance to the Enum rule, not BackedEnum. UnitEnum doesn't have tryFrom method, but in the first condition there is a check that such method exists.
Basically, what we should do is just swap first condition with the second. If $value instanceof $this->type is true, it is surely enum, no matter Backed or not.

@taylorotwell
taylorotwell merged commit b6b4a19 into laravel:9.x Nov 28, 2022
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.

2 participants