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

Enum-Validator #167

Closed
reinfi opened this issue Dec 29, 2022 · 4 comments · Fixed by #372
Closed

Enum-Validator #167

reinfi opened this issue Dec 29, 2022 · 4 comments · Fixed by #372

Comments

@reinfi
Copy link

reinfi commented Dec 29, 2022

Feature Request

I would like to have an enum validator.

Q A
New Feature yes
RFC no
BC Break may be, it depends

Summary

Like I have a value and if it is in the specific enum it is valid.

Of course this would be a php > 8.0 feature. So I just want to know if you're open for that or if it is not in the scope of this package.

I you're open for it I will try to add a pull request :-)

@Ocramius
Copy link
Member

Perhaps just an expansion of the InArray validator for PHP > 8.1?

@reinfi
Copy link
Author

reinfi commented Dec 29, 2022

Like adding an Enum Class as Haystack?

Would make it a bit complicated to differentiate and you need to mix types.

@Ocramius
Copy link
Member

Maybe: let's start with a proposal patch though, so go for it 💪

Please test it 😁

@reinfi
Copy link
Author

reinfi commented Dec 29, 2022

public function setHaystack(array $haystack)

just to be sure, I will need to change that to something supporting array and enum values and need to add a PHP-Version check because there is still 8.0 support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants