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
So how do I deal with this? Yes, it might not make sense in the pseudo code, but I would really like to resolve the errors. Do I need to do something with @template?
edit:
So what I have found out is that by adding a docblock @return static no issues are reported?
Looking at the error (when not using a @return docblock) it says this:
INFO: LessSpecificReturnStatement - 33:16 - The type 'Foobar\AException&static' is more general than the declared return type 'Foobar\BException&static' for Foobar\BException::foobarException
So it says it thinks that the declared return type is 'Foobar\AException&static', but that, to me, looks wrong and I think that should be 'Foobar\BException&static' instead?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
So I really don't know how to deal with
static
return types in combination with subclasses. Whatever I do it seams to give me errors.I made an pseudo example here based on the
RunTimeException
class: https://psalm.dev/r/cc3c151c67So how do I deal with this? Yes, it might not make sense in the pseudo code, but I would really like to resolve the errors. Do I need to do something with @template?
edit:
So what I have found out is that by adding a docblock
@return static
no issues are reported?Without return docblock: https://psalm.dev/r/cc3c151c67
With return dockblock: https://psalm.dev/r/ad47fd1bf1
Looking at the error (when not using a
@return
docblock) it says this:So it says it thinks that the declared return type is
'Foobar\AException&static'
, but that, to me, looks wrong and I think that should be'Foobar\BException&static'
instead?So might this be a bug in Psalm?
Beta Was this translation helpful? Give feedback.
All reactions