-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Nullable value for enum #77
Labels
Comments
Implementation: |
You can combine if (isset($array[$name]) || \array_key_exists($name, $array)) {
|
Yes, I agree. In this case, array_key_exists will be executed secondary if isset returns false |
Really nice fix and thanks @willemstuursma too, merging! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To do this, I had to expand Enum to support
null
values.It is also a good idea to support null as a separate enum value.
I recommend to use
array_key_exist()
instead ofisset()
for validate Enum value:New:
Example:
I can put
null
to__construct()
But i cant do it with static:
And finally i can remove excess
?
operator from methods and constructors:This is look better
then this
The text was updated successfully, but these errors were encountered: