← ClaudeAtlas

phpstan-analysislisted

Invoke BEFORE running PHPStan or fixing PHPStan errors. Covers error resolution strategy (refactoring > phpDoc > ignoring), common Nette error patterns, baseline management, and type tests. Use this whenever the user mentions PHPStan, static analysis, type errors, wants to suppress warnings, or manage the baseline - even for a single error.
nette/agent-plugins · ★ 44 · AI & Automation · score 81
Install: claude install-skill nette/agent-plugins
## PHPStan Analysis ### Running PHPStan Never use `--error-format=json` - its output format can change between PHPStan versions and is not designed for stable machine consumption. For machine-readable output, use `--error-format=raw`. **Take the verdict from the exit code, never from grepping the output.** A filter defines what you see, so anything it misses reads as success - and some findings (an unmatched `ignoreErrors` pattern, for one) are not tied to any file and carry no file prefix at all. ### Target Levels Target level for Nette libraries is **8**. Levels higher than 8 are not worth pursuing - the additional strictness (e.g., `non-empty-string`, `positive-int`) catches very few real bugs relative to the annotation burden. - **Level 7**: Union types checked - **Level 8**: Null checks, strict types (our target) ### nette/phpstan-rules Installed by all Nette libraries. It works in both directions, and mixing them up is a real hazard: - **It narrows types and silences false positives** — many PHPStan errors disappear without manual fixes. Don't fight those (list below). - **It also REPORTS errors of its own and turns on stricter reporting.** Two rules of its own: `nette.abortException` (an `AbortException` caught and not rethrown — the fix is to rethrow it in its own `catch`, which is not guessable) and `nette.strings.regexpPattern` (an invalid regular expression). On top of that `extension.neon` forces nine flags on, including `checkMissingCallableSig