Open asgrim opened 1 year ago
I found these snippets:
Oh forgot to say - this only appears to happen with Closure
- if I replace it with any other standard defined class, the same assertion works: https://psalm.dev/r/a153bf3546
I found these snippets:
Got a confusing one, might just be my understanding, or a weird edge case bug.
When using an assertion function (such as
\Webmozart\Assert::assertInstanceOf
) to assert a value is aClosure
appears to correctly do an assertion, but Psalm reports that the inferred typeClosure
does not match the declared return typeClosure
, which is a confusing error message for sure!Example of the error: https://psalm.dev/r/f041c54218
Not sure if it helps, but the issue can be side-stepped by doing an
if/throw
, for example in: https://psalm.dev/r/365931c953