psalm doesn't recognize with a function halts program flow

Created on 30 Jun 2019  路  2Comments  路  Source: vimeo/psalm

Compare [1] and [2]. The only difference is that [1] calls croak() to exit and [2[ calls exit directly.

Both [1] and [2] should be seen as the same

Instead, because psalm does not recognize that program flow is halted when croak() is called in [1], it raises this waning: "Argument 1 of echo cannot be mixed, expecting string"

[1] https://psalm.dev/r/ac5b9561c3
[2] https://psalm.dev/r/b97b83f0ae

Most helpful comment

You can get the effect you want with explicit @return never-returns (or @psalm-return never-returns if your other tools have a problem with that)^ https://psalm.dev/r/5c90f84576

All 2 comments

@psalm-return never-return is your friend: https://psalm.dev/r/a52074019f

You can get the effect you want with explicit @return never-returns (or @psalm-return never-returns if your other tools have a problem with that)^ https://psalm.dev/r/5c90f84576

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ErikBooijCB picture ErikBooijCB  路  4Comments

muglug picture muglug  路  3Comments

roukmoute picture roukmoute  路  3Comments

greg0ire picture greg0ire  路  3Comments

staabm picture staabm  路  3Comments