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 8fe1f15):
ERROR: RedundantCondition - 18:13 - Type int for $v is never float
ERROR: InvalidReturnStatement - 20:20 - The inferred type 'int' does not match the declared return type 'string' for g
INFO: Trace - 20:13 - $v: int
INFO: MixedReturnStatement - 23:20 - Possibly-mixed return value
INFO: MixedReturnStatement - 23:20 - Could not infer a return type
INFO: Trace - 23:13 - $v: float|mixed
INFO: MixedReturnStatement - 28:16 - Possibly-mixed return value
INFO: MixedReturnStatement - 28:16 - Could not infer a return type
INFO: Trace - 28:9 - $v: float|mixed
INFO: MixedInferredReturnType - 16:23 - Could not verify return type 'string' for g
Psalm doesn't support multiple @psalm-assert like this yet for the same variable.
Atm (since a recent PR by me) psalm now supports up to 2 (1 psalm-assert-if-true, 1 psalm-assert-if-false) for the same variable.
Feel free to add support for additional assertions though.
Bug report
When there is multiple @psalm-assert* annotation, only ...if-true is remembered if present
Code snippet that reproduces the problem
https://psalm.dev/r/bb2095da13
Expected output
$v should be detected as an int line 20, a float line 23 and a !(int|float) line 28
The text was updated successfully, but these errors were encountered: