You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Psalm output (using commit d51ee03):
ERROR: InvalidReturnStatement - 18:12 - The type 'int' does not match the declared return type 'string' for iFooFirst2
ERROR: InvalidReturnType - 17:27 - The declared return type 'string' for iFooFirst2 is incorrect, got 'int'
Psalm reports issues about iFooFirst2, but nothing about iFooFirst1. There should be issues reported for both iFooFirst1 and iFooFirst2, since no class can implement both interfaces. If the interface types were docbloc types then the class could exist, but it's foo function wouldn't be able return without violating LSP, so again anything expecting a return value from it is likely wrong.
The text was updated successfully, but these errors were encountered:
I think Psalm should just prevent the intersection in the first place.
muglug
changed the title
intersection between int and string should return no-return
Prevent intersections between impossible interface methods
May 27, 2019
This is improved now to show mixed as the return type since the interfaces don't agree, but it would still be nice to show a warning for the impossible intersection as well. I've added a test for this to my type comparison rewrite.
As metnioned in comments of #1686. Code at https://psalm.dev/r/20aa96387e :
Psalm reports issues about iFooFirst2, but nothing about iFooFirst1. There should be issues reported for both iFooFirst1 and iFooFirst2, since no class can implement both interfaces. If the interface types were docbloc types then the class could exist, but it's foo function wouldn't be able return without violating LSP, so again anything expecting a return value from it is likely wrong.
The text was updated successfully, but these errors were encountered: