New advertisers: 50% off your first month with code FIRSTMONTHSee slots
wordpress avatar

Wp Phpstan

Setup, baseline, and typing guidance for running PHPStan static analysis on WordPress plugins, themes, and sites.

skills.sh installs
5.1K
GitHub stars
2.4K
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers PHPStan config setup, baseline generation and reduction, and fixing errors with WordPress-specific PHPDoc types
  • Requires WordPress core stubs (szepeviktor/phpstan-wordpress or php-stubs/wordpress-stubs) and points to references for third-party plugin classes
  • Enforces narrow ignoreErrors patterns, and treats baselines as a migration tool that never absorbs newly introduced errors
  • Designed for WordPress 7.0+ projects on PHP 7.4.0+ using Composer-based PHPStan, run first after wp-project-triage

Install

$ npx -y skills add wordpress/agent-skills --skill wp-phpstan -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

WP PHPStan

When to use

Use this skill when working on PHPStan in a WordPress codebase, for example:

  • setting up or updating phpstan.neon / phpstan.neon.dist
  • generating or updating phpstan-baseline.neon
  • fixing PHPStan errors via WordPress-friendly PHPDoc (REST requests, hooks, query results)
  • handling third-party plugin/theme classes safely (stubs/autoload/targeted ignores)

Inputs required

  • wp-project-triage output (run first if you haven't)
  • Whether adding/updating Composer dev dependencies is allowed (stubs).
  • Whether changing the baseline is allowed for this task.

Procedure

0) Discover PHPStan entrypoints (deterministic)

  1. Inspect PHPStan setup (config, baseline, scripts):
    • node skills/wp-phpstan/scripts/phpstan_inspect.mjs

Prefer the repo’s existing composer script (e.g. composer run phpstan) when present.

1) Ensure WordPress core stubs are loaded

szepeviktor/phpstan-wordpress or php-stubs/wordpress-stubs are effectively required for most WordPress plugin/theme repos. Without it, expect a high volume of errors about unknown WordPress core functions.

Details

Repository
github.com/wordpress/agent-skills
Categories
PHP & Laravel, Code Review & Quality
First seen
Apr 16, 2026

More from wordpress/agent-skills

All 17

Similar to Wp Phpstan

More PHP & Laravel