0

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.

FabianTe
  • 516
  • 4
  • 22

1 Answers1

0

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>
<!-- ...... -->
Outdated answer

Not currently, but it should be fairly easy to add. Please file an issue here: https://github.com/vimeo/psalm/issues

weirdan
  • 2,499
  • 23
  • 27