How to let Psalm know that some method asserts a variable type? #6163
Unanswered
fluffycondor
asked this question in
Q&A
Replies: 1 comment 2 replies
-
This solves the issue: But I would have expected the @psalm-assert-if-true to be located on Comparable instead of Foo for this to work. This makes it possible to do that kind of nonsense: https://psalm.dev/r/b8f9c6f6eb |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Let's say I have code like this:
https://psalm.dev/r/38611b4f08
On line 24 there are two false-positives:
$object
isFoo
for sure, but Psalm still thinks it's justComparable
.How can I let Psalm know that if that method returns true, the first argument has the same type as
$this
has?Beta Was this translation helpful? Give feedback.
All reactions