-
Notifications
You must be signed in to change notification settings - Fork 544
Resolve template with value of BackEnum #4548
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
base: 2.1.x
Are you sure you want to change the base?
Conversation
|
This pull request has been marked as ready for review. |
|
interessting.. does it also solve phpstan/phpstan#13782 ? |
You don't appear on the issue bot https://github.com/phpstan/phpstan-src/actions/runs/19269104831?pr=4548 |
yes, thats because the issue does not yet have a label like "bug" or "feature request". |
src/Type/ValueOfType.php
Outdated
| if ($this->type->isEnum()->yes()) { | ||
| if ( | ||
| $this->type instanceof TemplateType | ||
| && $this->type->getBound()->equals(new ObjectType('BackedEnum')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be the other way arround?
| && $this->type->getBound()->equals(new ObjectType('BackedEnum')) | |
| && new ObjectType('BackedEnum')->isSuperTypeOf($this->type->getBound())->yes()? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just had a look into the code-base. it seems we have spots where a Bound is compared using equals and sometimes it uses isSuperTypeOf.
I am not sure whether thats on purpose or an oversight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isSuperTypeOf is better here indeed, in case someone use
interface SuperBackedEnum extends \BackedEnum
and a template of SuperBackedEnum.
test added
Oh ok. Test added and seems like it does close phpstan/phpstan#13782. |
Closes phpstan/phpstan#12219
Closes phpstan/phpstan#13638
Closes phpstan/phpstan#13282
Closes phpstan/phpstan#13782