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
@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
Most helpful comment
You can get the effect you want with explicit
@return never-returns(or@psalm-return never-returnsif your other tools have a problem with that)^ https://psalm.dev/r/5c90f84576