Is there a way to configure Psalm that calls to die
or exit
cause an error?
I have trouble with a codebase that heavily uses these two commands and want to at least avoid people adding new die commands that should not exist.
Is there a way to configure Psalm that calls to die
or exit
cause an error?
I have trouble with a codebase that heavily uses these two commands and want to at least avoid people adding new die commands that should not exist.
Starting with Psalm 4.12 you can forbid both die()
and exit()
by listing them in <forbiddenFunctions>
config section:
<?xml version="1.0"?>
<psalm
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
>
<!-- ...... -->
<forbiddenFunctions>
<function name="exit" />
<function name="die" />
</forbiddenFunctions>
<!-- ...... -->
Not currently, but it should be fairly easy to add. Please file an issue here: https://github.com/vimeo/psalm/issues