Consider MixedType explicitness in MethodParameterComparisonHelper::isTypeCompatible#1491
Conversation
|
Yeah, the issue phpstan/phpstan#7415 is really weird. I don't think your fix is correct, because the message "is not covariant with tentative return type void of method" should be triggered only when considering native return types. The codepath should only by executed for them. It looks wrong to me to exclude explicit mixed types to fix this case - comparing PHPDoc-based types (generics) shouldn't be done when checking tentative return types... |
|
I need to think more about this but the changes here did not activate the "is not covariant with tentative return type void of method", they were already there. The errors about mixed returns are missing though. If I understood it correctly, than the problem is that But this is a kind of error I'm not good with and very unsure :) |
|
I'm not sure what to do with this one. It makes sense to me, but maybe I misunderstood what was going on. I'll give it a good old last force-push and if this is the wrong solution we can just close it :) |
fbd12ed to
70181d7
Compare
…::isTypeCompatible`
|
Alright, thank you :) |
|
I reviewed the situation and indeed it looks correct. |
|
I have a follow-up for you. This is allowed in PHP: https://3v4l.org/GAoP2 But PHPStan started reporting this as an error after this PR: https://phpstan.org/r/66db5967-78af-4abe-b21e-12b311dafcbb |
Closes phpstan/phpstan#7415
Doesn't feel like the most elegant solution though.. I played around a bit with
MixedType::isSuperTypeOfbut did not find something better unfortunately.