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

No default value for EnumCase Validator #405

Open
Buzka91 opened this issue Dec 11, 2024 · 3 comments
Open

No default value for EnumCase Validator #405

Buzka91 opened this issue Dec 11, 2024 · 3 comments
Assignees
Labels
Bug Something isn't working Invalid This doesn't seem right

Comments

@Buzka91
Copy link

Buzka91 commented Dec 11, 2024

Bug Report

Q A
Version(s) >=3.0.0

Summary

In EnumCase Validator there is no optional value for enum key.

Current behavior

Undefined index enum

How to reproduce

Do not pass enum in option array.

Expected behavior

Fix in EnumCase Validator to set default value, which will lead to throw exception.

--edit
Same as in InArray Validator

@Buzka91 Buzka91 added the Bug Something isn't working label Dec 11, 2024
@gsteel
Copy link
Member

gsteel commented Dec 11, 2024

This is not a bug. If you want to use the enum validator, you need to tell it which enum to use.

@gsteel gsteel added the Invalid This doesn't seem right label Dec 11, 2024
@gsteel gsteel self-assigned this Dec 11, 2024
@gsteel gsteel closed this as not planned Won't fix, can't repro, duplicate, stale Dec 11, 2024
@froschdesign
Copy link
Member

froschdesign commented Dec 12, 2024

@gsteel
I think the error reporting refers to the problem of the undefined index. Shouldn't there be a check that this is available? Maybe with an exception for this problem.

@gsteel
Copy link
Member

gsteel commented Dec 12, 2024

Ah, I see - we'd be trading undefined index for a psalm error I think, as the options have a well-defined expected shape and your static analysis tooling should alert you to that.

@gsteel gsteel reopened this Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants