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

Presets

Format presets, lint sets, and analyse presets.

Each command picks its rules on its own. There is no top-level preset.

Format presets

Preset Rules
laravel Pint’s default rules. The default
psr12 PSR-12 rules
empty Only the rules you turn on

[format.rules] overrides the preset. Pint’s per is not a Pun preset. pun migrate expands it into rules over empty. Pun has no symfony preset, and pun migrate stops with an error on a pint.json that uses it.

Lint sets

Sets turn on groups of lint rules at "error". A rule can belong to several sets.

Set Turns on rules for
dead-code Code that never runs, or whose result is never used
modernize Newer PHP syntax, up to [php] version
code-quality Simpler equivalents and likely bugs
types Missing type declarations and PHPDoc types
early-return Early returns and continues instead of nesting
privatization Narrower visibility, final classes and constants
naming Names that match their types. Currently empty
coding-style One consistent way to write the same thing
[lint]
sets = ["dead-code", "modernize"]

Laravel, Pest, and PHPUnit rules also need their extension. To turn on a rule outside your sets, name the rule or its group. See [lint] for precedence and path overrides.

Analyse presets

Each preset includes the ones above it.

Preset PHPStan levels Adds
basic 0–1 Unknown classes, functions and methods on $this, wrong argument counts, undefined variables
essential 2–3 Unknown methods and properties on every expression, PHPDoc, return and property types
recommended 4–5 Dead code, constant conditions, argument types. The default
strict 6–8 Missing typehints, union types, and nullables
max 9–10 Explicit and implicit mixed
[analyse]
preset = "strict"

Pun doesn’t run every PHPStan rule at each level. See analysis limitations.

pun.toml doesn’t accept a numeric [analyse] level. pun migrate picks the preset that contains your PHPStan level and writes the rule differences.

Last updated on

Was this page helpful?