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

Narrow enum_exists() arg to UnitEnum #2764

Merged
merged 2 commits into from
Nov 25, 2023
Merged

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Nov 22, 2023

@staabm staabm marked this pull request as ready for review November 22, 2023 08:44
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@@ -54,6 +55,17 @@ public function specifyTypes(FunctionReflection $functionReflection, FuncCall $n
);
}

if ($functionReflection->getName() === 'enum_exists') {
return $this->typeSpecifier->create(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please less code duplication here. The only thing different is the type argument.

@ondrejmirtes ondrejmirtes merged commit de2b200 into phpstan:1.10.x Nov 25, 2023
424 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

@ZejdCicak
Copy link

This makes enum_exists always treat an enum as UnitEnum, and never as BackedEnum, do you think there is a way to deal with this in library?

@ondrejmirtes
Copy link
Member

@ZejdCicak Please open a new issue with a reproducing snippet of your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants