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

Support union type in Type::nullable() #141

Merged
merged 1 commit into from Sep 29, 2023
Merged

Conversation

GromNaN
Copy link
Contributor

@GromNaN GromNaN commented Sep 28, 2023

I did some benchmarks. in_array vs preg_replace approaches are almost identical in terms of performance (very fast). Got the simplest implementation with explode, in_array and array_diff.

@dg
Copy link
Member

dg commented Sep 29, 2023

Thanks

@dg dg merged commit 86d00d7 into nette:master Sep 29, 2023
dg pushed a commit that referenced this pull request Sep 29, 2023
@dg
Copy link
Member

dg commented Sep 29, 2023

I've tweaked it a bit, to make it work case insensitive, because theoretically you can write Null or NULL in PHP, and to throw an exception on intersection type.

dg pushed a commit that referenced this pull request Sep 29, 2023
dg pushed a commit that referenced this pull request Sep 29, 2023
@GromNaN GromNaN deleted the null-union branch September 29, 2023 13:21
dg pushed a commit that referenced this pull request Oct 15, 2023
dg pushed a commit that referenced this pull request Oct 17, 2023
dg pushed a commit that referenced this pull request Oct 17, 2023
dg pushed a commit that referenced this pull request Oct 29, 2023
dg pushed a commit that referenced this pull request Oct 29, 2023
dg pushed a commit that referenced this pull request Oct 29, 2023
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.

Nullable union type
2 participants