wp-phpstan

Configure and maintain PHPStan static analysis for WordPress projects.

14|1|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/wpgaurav/WordPress-skills --skill wp-phpstan-wpgaurav
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-phpstan
Source: https://github.com/wpgaurav/WordPress-skills/tree/main/skills/wordpress/wp-phpstan
Command: npx skills add https://github.com/wpgaurav/WordPress-skills --skill wp-phpstan-wpgaurav

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Configures and maintains PHPStan static analysis for WordPress projects (plugins/themes/sites), including phpstan.neon setup, baselines, WordPress-focused typing, and third-party class handling.

Core Features & Use Cases

  • Setup and maintain a WordPress-ready PHPStan configuration (phpstan.neon, phpstan.neon.dist).
  • Generate and update phpstan-baseline.neon to prevent fallout from new errors.
  • Improve WordPress typings across REST, hooks, and WP core interactions using stubs and targeted PHPDoc guidance.
  • Handle third-party plugin and theme classes safely with stubs and selective ignores; suitable for CI, development, and audits.

Quick Start

Run the PHPStan workflow against your WordPress project to identify typing issues and apply WordPress-specific fixes.

Frequently Asked Questions about wp-phpstan

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure PHPStan for a WordPress plugin or theme?

To configure PHPStan for WordPress, create a phpstan.neon configuration file that applies WordPress stubs and targeted typing rules. This ensures static analysis correctly understands WordPress core interactions, hooks, and REST API endpoints.

How do I generate a PHPStan baseline to prevent new static analysis errors?

Generate a phpstan-baseline.neon file to catalog existing static analysis errors and prevent new fallout. Re-running the baseline generation updates ignored errors, allowing you to enforce strict standards incrementally without fixing legacy code immediately.

Does PHPStan work with WordPress multisite installations and third-party plugins?

Yes, PHPStan works with WordPress multisite and third-party plugins by applying WordPress stubs and selective ignore rules. This safely handles external classes and hooks during static analysis in CI pipelines and local development.

Why does PHPStan report unknown types for WordPress core functions and hooks?

PHPStan reports unknown types for WordPress core functions and hooks when WordPress stubs are not configured in phpstan.neon. Applying these stubs and targeted PHPDoc guidance resolves typing issues by providing accurate static analysis definitions.