WordPress PHPStan Review Skill
Overview
Systematic review guidance for PHPStan in WordPress projects. Core principle: static analysis should be strict enough to catch real bugs without becoming noise, and WordPress-specific extensions or stubs should be wired in intentionally. Review covers config files, includes, baselines, CI integration, analysis paths, bootstrap files, WordPress stubs, and gradual adoption strategy.
When to Use
Use when:
- Reviewing
phpstan.neon, phpstan.neon.dist, or CI config
- Planning PHPStan adoption in a WordPress plugin or theme
- Auditing baseline usage or ignored errors
- Reviewing
szepeviktor/phpstan-wordpress setup
- Checking analysis scope, bootstrap files, or stub configuration
Don't use for:
- Runtime performance review
- PHPUnit or browser test strategy without static analysis focus
- General PHP refactors unrelated to analysis setup
Code Review Workflow
Identify the analysis entrypoints
phpstan.neon / phpstan.neon.dist
- Composer
require-dev
- CI workflows and scripts
- bootstrap or stub files
Check base configuration first
- Config file naming and includes
- Level and analysed paths
- Exclusions and bootstrap files
- Whether WordPress-specific extensions/stubs are actually loaded
Review baseline and ignore strategy
- Baseline used to phase in analysis, not bury new issues forever
- Ignored errors are intentional and reviewable
- New code is still held to a higher bar
Review CI ergonomics
- Deterministic command
- Correct config path
- Reasonable failure behavior
- No accidental drift between local and CI config
Classify findings
- CRITICAL: PHPStan appears configured but is not really analysing project code, WordPress extension missing, baseline hiding everything indefinitely
- WARNING: overly broad exclusions, stale baseline workflow, config split is confusing, analysis paths too narrow
- INFO: could raise level, document bootstrap behavior, or tighten ignores
File-Type Specific Checks
PHPStan Config
- CRITICAL: Config analyses no meaningful project paths
- WARNING:
ignoreErrors or excludes are too broad
- WARNING: WordPress extension installed but not included when extension installer is not present
- INFO: Could split local overrides into
phpstan.neon on top of a committed .dist file
Baseline Files
- WARNING: Baseline regenerated casually instead of fixed deliberately
- WARNING: Baseline used when analysis still appears underconfigured
- INFO: Could document when to refresh versus when to fix findings
CI and Composer
- WARNING: CI command differs materially from the documented local command
- WARNING:
require-dev includes stubs/extension but config does not use them correctly
- INFO: Could add clearer scripts or output formatting
Search Patterns for Quick Detection (PST-21)
Use these rg commands to find PHPStan setup quickly.
Config and CI Discovery
rg -n "phpstan|phpstan\\.neon|phpstan\\.neon\\.dist|phpstan-baseline" . -g '*.{neon,php,json,md,yml,yaml}'
rg -n "vendor/bin/phpstan|composer .*phpstan|phpstan analyse" . -g '*.{json,md,yml,yaml,sh}'
WordPress-Specific Setup
rg -n "szepeviktor/phpstan-wordpress|php-stubs/wordpress-stubs|extension\\.neon" . -g '*.{json,neon,md}'
rg -n "bootstrapFiles|scanFiles|scanDirectories|paths|ignoreErrors|includes:" . -g '*.neon*'
Reference Files
references/config-and-bootstrap.md - Config structure, includes, analysed paths, bootstrap files, and WordPress extension wiring
references/baseline-and-ci.md - Baseline strategy, CI integration, and rollout heuristics
references/wordpress-stubs-guide.md - phpstan-wordpress, WordPress stubs, and common WordPress static-analysis tradeoffs
references/sample-phpstan.neon.dist - Sample shared config file for a WordPress plugin or theme
Output Format (PST-23)
For each finding include:
- Severity:
CRITICAL, WARNING, or INFO
- File and line number
- Static-analysis issue summary
- Why it matters for WordPress PHPStan coverage or signal quality
- Recommended fix
If no issues are found, say so clearly and mention any residual risk such as baseline growth, narrow analysis scope, or undocumented local overrides.
1---2name: wp-phpstan-review-23description: WordPress PHPStan review and setup guidance. Use when reviewing `phpstan.neon`, WordPress static-analysis setup, baselines, PHPStan levels, CI jobs, WordPress stubs, `szepeviktor/phpstan-wordpress`, or when user mentions "PHPStan", "static analysis", "phpstan.neon", "baseline", "WordPress stubs", or "CI type checks". Helps review WordPress-specific PHPStan configuration, baseline strategy, extension wiring, and practical rollout patterns for plugins, themes, and larger WordPress codebases.4---56# WordPress PHPStan Review Skill78## Overview910Systematic review guidance for PHPStan in WordPress projects. **Core principle:** static analysis should be strict enough to catch real bugs without becoming noise, and WordPress-specific extensions or stubs should be wired in intentionally. Review covers config files, includes, baselines, CI integration, analysis paths, bootstrap files, WordPress stubs, and gradual adoption strategy.1112## When to Use1314**Use when:**15- Reviewing `phpstan.neon`, `phpstan.neon.dist`, or CI config16- Planning PHPStan adoption in a WordPress plugin or theme17- Auditing baseline usage or ignored errors18- Reviewing `szepeviktor/phpstan-wordpress` setup19- Checking analysis scope, bootstrap files, or stub configuration2021**Don't use for:**22- Runtime performance review23- PHPUnit or browser test strategy without static analysis focus24- General PHP refactors unrelated to analysis setup2526## Code Review Workflow27281. **Identify the analysis entrypoints**29 - `phpstan.neon` / `phpstan.neon.dist`30 - Composer `require-dev`31 - CI workflows and scripts32 - bootstrap or stub files33342. **Check base configuration first**35 - Config file naming and includes36 - Level and analysed paths37 - Exclusions and bootstrap files38 - Whether WordPress-specific extensions/stubs are actually loaded39403. **Review baseline and ignore strategy**41 - Baseline used to phase in analysis, not bury new issues forever42 - Ignored errors are intentional and reviewable43 - New code is still held to a higher bar44454. **Review CI ergonomics**46 - Deterministic command47 - Correct config path48 - Reasonable failure behavior49 - No accidental drift between local and CI config50515. **Classify findings**52 - **CRITICAL:** PHPStan appears configured but is not really analysing project code, WordPress extension missing, baseline hiding everything indefinitely53 - **WARNING:** overly broad exclusions, stale baseline workflow, config split is confusing, analysis paths too narrow54 - **INFO:** could raise level, document bootstrap behavior, or tighten ignores5556## File-Type Specific Checks5758### PHPStan Config5960- CRITICAL: Config analyses no meaningful project paths61- WARNING: `ignoreErrors` or excludes are too broad62- WARNING: WordPress extension installed but not included when extension installer is not present63- INFO: Could split local overrides into `phpstan.neon` on top of a committed `.dist` file6465### Baseline Files6667- WARNING: Baseline regenerated casually instead of fixed deliberately68- WARNING: Baseline used when analysis still appears underconfigured69- INFO: Could document when to refresh versus when to fix findings7071### CI and Composer7273- WARNING: CI command differs materially from the documented local command74- WARNING: `require-dev` includes stubs/extension but config does not use them correctly75- INFO: Could add clearer scripts or output formatting7677## Search Patterns for Quick Detection (PST-21)7879Use these `rg` commands to find PHPStan setup quickly.8081### Config and CI Discovery8283```bash84rg -n "phpstan|phpstan\\.neon|phpstan\\.neon\\.dist|phpstan-baseline" . -g '*.{neon,php,json,md,yml,yaml}'85rg -n "vendor/bin/phpstan|composer .*phpstan|phpstan analyse" . -g '*.{json,md,yml,yaml,sh}'86```8788### WordPress-Specific Setup8990```bash91rg -n "szepeviktor/phpstan-wordpress|php-stubs/wordpress-stubs|extension\\.neon" . -g '*.{json,neon,md}'92rg -n "bootstrapFiles|scanFiles|scanDirectories|paths|ignoreErrors|includes:" . -g '*.neon*'93```9495## Reference Files9697- `references/config-and-bootstrap.md` - Config structure, includes, analysed paths, bootstrap files, and WordPress extension wiring98- `references/baseline-and-ci.md` - Baseline strategy, CI integration, and rollout heuristics99- `references/wordpress-stubs-guide.md` - `phpstan-wordpress`, WordPress stubs, and common WordPress static-analysis tradeoffs100- `references/sample-phpstan.neon.dist` - Sample shared config file for a WordPress plugin or theme101102## Output Format (PST-23)103104For each finding include:1051061. Severity: `CRITICAL`, `WARNING`, or `INFO`1072. File and line number1083. Static-analysis issue summary1094. Why it matters for WordPress PHPStan coverage or signal quality1105. Recommended fix111112If no issues are found, say so clearly and mention any residual risk such as baseline growth, narrow analysis scope, or undocumented local overrides.