Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

PHPStan level presets

PHPStan’s levels as analyse presets: phpstan/level_<n> runs what phpstan analyse --level <n> runs with PHPStan’s default parameters. Turn one on in pun.toml:

[analyse]
preset = "phpstan/level_5"

phpstan/level_max is phpstan/level_10. PHPStan’s opt-in checks, phpstan-strict-rules and phpstan-deprecation-rules are not part of any level: turn their rules on in [analyse.rules]. Larastan’s default rules run when the laravel extension is on. PHPStan checks that are lint rules in Pun are turned on in [lint] too. The few that are format rules (such as format/whitespace/encoding) are not: turn them on in [format.rules]. Planned rules do not run. Presets and sets explains the rest.

phpstan/level_0

phpstan/level_1

phpstan/level_2

phpstan/level_3

phpstan/level_4

phpstan/level_5

phpstan/level_6

phpstan/level_7

  • union-types = true: checks each member of a union.

phpstan/level_8

  • nullables = true: checks nullable values.

phpstan/level_9

  • explicit-mixed = true: checks explicit mixed.

phpstan/level_10

  • implicit-mixed = true: checks implicit mixed.

Last updated on

Was this page helpful?