Skip to content

PHPStan extension installer support

Compare
Choose a tag to compare
@spaze spaze released this 29 Aug 05:41
5dd06ed
  • Support for PHPStan's extension installer, more straightforward config (#9)
  • Sample dangerous config (#10)

Migration to extension installer:

If you're not using the extension installer, you're fine with the configuration you already use and can continue using it as long as you wish.

If you're using the extension installer, the extension.neon where the classes are set up will be included automatically by PHPStan and you'll probably get "Multiple services found" when you'll run PHPStan. In that case you'd need to change the configuration slightly:

  1. Remove Spaze\PHPStan\Rules\Disallowed\DisallowedHelper from your phpstan.neon
  2. Copy forbiddenCalls keys and values from Spaze\PHPStan\Rules\Disallowed\{Method,Static,Function}Calls definitions to parameters > disallowedMethodCalls (and disallowedStaticCalls, disallowedFunctionCalls, respectively), can even put them in a new file (e.g. disallowed-calls.neon) which you can then include manually
  3. Delete Spaze\PHPStan\Rules\Disallowed\{Method,Static,Function}Calls definitions from your phpstan.neon including the keys and values under arguments > forbiddenCalls

If you'd like to switch to using extension.neon even without using the extension installer, follow the steps above and manually include vendor/spaze/phpstan-disallowed-calls/extension.neon in your phpstan.neon.