wp-phpstan

Configure PHPStan for WordPress projects with phpstan.neon, baselines, and stubs.

Updated Jan 13, 2026
One-click install
npx skills add https://github.com/MrGKanev/agent-skills --skill wp-phpstan-mrgkanev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-phpstan
Source: https://github.com/MrGKanev/agent-skills/tree/main/skills/wp-phpstan
Command: npx skills add https://github.com/MrGKanev/agent-skills --skill wp-phpstan-mrgkanev

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

WordPress projects often struggle with maintaining reliable static analysis due to dynamic WordPress APIs, numerous plugins, and third-party code. This skill guides teams in configuring PHPStan for WordPress, using stubs, and applying targeted ignore patterns to reduce false positives.

Core Features & Use Cases

  • WordPress-specific PHPStan setup: phpstan.neon, baselines, and WP annotations
  • Use cases include plugins, themes, and site codebases with REST endpoints, hooks, and database queries
  • Baseline-driven migration and safe stubbing with community-provided stubs

Quick Start

Install PHPStan and WordPress stubs via Composer, then create a minimal phpstan.neon referencing the stubs, and run PHPStan through the project's Composer scripts or vendor/bin/phpstan.

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 reduce false positives?

Configuring PHPStan for WordPress involves setting up a phpstan.neon file, integrating WordPress stubs via Composer, and applying baseline-driven workflows to reduce false positives from dynamic APIs.

Why does PHPStan report errors on WordPress core functions and hooks in my codebase?

PHPStan reports errors on WordPress functions because it lacks native understanding of the platform's dynamic APIs. Using community-provided WordPress stubs and specific annotations supplies the necessary type definitions.

What is a PHPStan baseline and when do I need it for static analysis?

A PHPStan baseline captures existing errors to ignore, allowing you to enforce static analysis on new code without fixing legacy errors immediately. It is needed when introducing PHPStan to an existing WordPress project.

Can I use WordPress stubs to analyze REST endpoints and database queries with PHPStan?

Yes, you can use WordPress stubs to analyze REST endpoints and database queries. This skill prescribes using stub packages and WordPress-specific annotations to safely tune PHPStan for these use cases.

Do I need Composer to set up WordPress stubs for PHPStan?

Yes, Composer is required to install PHPStan and community-provided WordPress stubs. The setup process involves creating a minimal phpstan.neon file and running the analyzer through Composer scripts or vendor/bin/phpstan.