-
Notifications
You must be signed in to change notification settings - Fork 546
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. |
14a8b06 to
62f8200
Compare
|
Hi @staabm, when I run both mutator are caught locally. Any idea why it could be reported on CI ? Is there some cache ? |
5467db0 to
278db29
Compare
This reverts commit 6cb52a2.
As shown by 6cb52a2 if I tried the mutant reported by https://github.com/phpstan/phpstan-src/actions/runs/19963970402/job/57251263461?pr=4548 it failed. I got the same issue with the following PR #4548 Either I misunderstand something, either it's buggy |
|
I had a look but cannot yet make sense of it |
Closes phpstan/phpstan#12219
Closes phpstan/phpstan#13638
Closes phpstan/phpstan#13282
Closes phpstan/phpstan#13782