-
Notifications
You must be signed in to change notification settings - Fork 506
Fix MixedType->equals(ErrorType) #3934
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. |
@@ -314,6 +314,10 @@ public function equals(Type $type): bool | |||
return false; | |||
} | |||
|
|||
if ($type instanceof ErrorType) { |
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.
MixedType isn't equal to TemplateMixedType.
A bunch of types use !$type instanceof static
, maybe we should do it in more cases.
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.
changing MixedType->equals()
to return false for TemplateMixedType
makes this test fail.
1) PHPStan\Generics\TemplateTypeFactoryTest::testCreate with data set #6 (PHPStan\Type\Generic\TemplateMixedType Object (...), PHPStan\Type\MixedType Object (...))
mixed -> equals(U (function a(), parameter))
Failed asserting that false is true.
I am not into generics enough to oversee how this should work
👍 I suppose this improves the weird cases I had before too, where error is accepted as a mixed or at least something like that 😊 |
refs #3933 (comment)