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

ForbidEnumInFunctionArgumentsRule shouldn't report error when SORT_REGULAR is used as second argument #195

Closed
kamil-zacek opened this issue Dec 22, 2023 · 1 comment · Fixed by #196

Comments

@kamil-zacek
Copy link

Argument 1 in array_unique() cannot contain enum as the function causes implicit __toString conversion which is not supported for enums

For this code

$countries = [Country::CZ, Country::CZ, Country::SK];
array_unique($countries, SORT_REGULAR)

shouldn't be reported this error, because of second argument the __toString is not used for compare.

Probably there are some other combinations of other functions which check this rule where there are different default $flag for comparing method type.

@janedbal
Copy link
Member

Released as 2.11.1

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 a pull request may close this issue.

2 participants