Skip to content

Narrow enum_exists() arg to UnitEnum#2764

Merged
ondrejmirtes merged 2 commits intophpstan:1.10.xfrom
staabm:enumexists
Nov 25, 2023
Merged

Narrow enum_exists() arg to UnitEnum#2764
ondrejmirtes merged 2 commits intophpstan:1.10.xfrom
staabm:enumexists

Conversation

@staabm
Copy link
Copy Markdown
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
Copy Markdown
Collaborator

This pull request has been marked as ready for review.

}

if ($functionReflection->getName() === 'enum_exists') {
return $this->typeSpecifier->create(
Copy link
Copy Markdown
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
@ondrejmirtes
Copy link
Copy Markdown
Member

Thank you.

@ZejdCicak
Copy link
Copy Markdown

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
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

4 participants