-
Notifications
You must be signed in to change notification settings - Fork 509
Add test for phpstan issue 7396 #1442
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.0.x
Are you sure you want to change the base?
Conversation
f8326f6
to
eee8782
Compare
$m = random_int(0, 1) === 0 ? new Model() : new class() extends Model implements Iface {}; | ||
assertType('Bug7385\Model', $m); | ||
$m->assertHasIface(); | ||
assertType('Bug7385\Iface&Bug7385\Model', $m); |
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.
@ondrejmirtes this assertion is not passing, do you know why?
Bug7385MethodTypeSpecifyingExtension::specifyTypes()
is correctly reached and$type
is (the expected)Bug7385\Iface&Bug7385\Model
- I am not completely sure what
TypeSpecifierContext::createXxx()
is used for or if I should useTypeSpecifierContext::createTrue()
, but I tried it. - I also tried to to set
$overwrite
param totrue
in$this->typeSpecifier->create()
factory method, but it seems the$m
type is stillBug7385\Model
as if theMethodTypeSpecifyingExtension
result is completely ignored
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.
@ondrejmirtes can you please take a look on this issue?
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.
There's 343 open bug reports (https://github.com/phpstan/phpstan/labels/bug) and 323 feature requests (https://github.com/phpstan/phpstan/labels/feature-request). Your issue isn't anything urgent to warrant immediate attention - it's not anything special and doesn't stand out from other 666 open issues.
This PR doesn't even have an associated issue - I closed #7385 because there wasn't anything about type-specifying extensions in the description.
There might even be an open issue about "type-specifying extension doesn't allow me to change the type of the object the method is called on", I'm not sure.
Anyway, if you're already this far, you can take one more step and debug where it actually gets lost, and fix it.
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.
yes, there is phpstan/phpstan#7396 issue I opened later after a short discussion about an implicit support in phpstan/phpstan#7385
5e86e33
to
92c4220
Compare
This reverts commit e89b50a2b03e2f635eb6b2a2e0c0cf61a54692f8.
92c4220
to
d90bc0a
Compare
repro for phpstan/phpstan#7396