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

ArrayType::unique with strict comparison #9

Closed
wants to merge 1 commit into from

Conversation

tomasfejfar
Copy link
Contributor

By default array_unique converts values to string.

When using Enum classes with array_unique you'll get PHP Warning: Uncaught Object of class Some\EnumType could not be converted to string unless you specify optional SORT_REGULAR parameter. And even then filtering array ['1', 1] will yield ['1'].

ArrayType::unique solves this by using strict comparison using ArrayType::inArray.

Supersedes #7

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