wp-phpstan

Configure and run PHPStan static analysis for WordPress projects.

1|Updated Jan 31, 2026
One-click install
npx skills add https://github.com/javiercasares/cloudfest-wporgdownload --skill wp-phpstan-javiercasares
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-phpstan
Source: https://github.com/javiercasares/cloudfest-wporgdownload/tree/main/.claude/skills/wp-phpstan
Command: npx skills add https://github.com/javiercasares/cloudfest-wporgdownload --skill wp-phpstan-javiercasares

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps WordPress developers configure, run, and fix PHPStan static analysis across plugins, themes, and sites by guiding setup like phpstan.neon, baselines, and WordPress-specific typing.

Core Features & Use Cases

  • WordPress-focused configuration: Ensures WordPress stubs are loaded and the PHPStan config is tailored to WP environments.
  • Baseline management: Generates and updates a PHPStan baseline to progressively reduce noise from legacy code.
  • Third-party integration support: Provides guidance and stubs for common plugins (WooCommerce, ACF, etc.) to improve analysis accuracy.
  • Use Case: A developer adds a new plugin and runs PHPStan to identify typing issues, then updates docblocks and stubs to resolve them.

Quick Start

Configure PHPStan for a WordPress project by running:

  • Ensure dependencies are installed: composer install
  • Run PHPStan via the project script (preferred): composer run phpstan
  • If no script exists, run: vendor/bin/phpstan analyse -c phpstan.neon

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?

Configuring PHPStan for WordPress requires a tailored phpstan.neon file that loads WordPress stubs and handles third-party plugin typing. This setup ensures accurate static analysis across your site codebase.

What's the best way to manage PHPStan baseline errors in legacy WordPress code?

Managing PHPStan baselines involves generating a baseline file to suppress existing errors, allowing you to progressively reduce noise from legacy code. You update this baseline as you fix typing issues over time.

Can I use PHPStan static analysis with WooCommerce or ACF?

Yes, you can use PHPStan with WooCommerce or ACF by utilizing specific third-party integration stubs. These stubs provide the necessary class definitions to improve analysis accuracy for common plugins.

Do I need Composer to run PHPStan in WordPress projects?

Yes, you need Composer to run PHPStan in WordPress projects. The preferred workflow uses Composer-based PHPStan, executing analysis via project scripts or the vendor/bin/phpstan executable.

Why does PHPStan report unknown classes in my WordPress site codebase?

PHPStan reports unknown classes in WordPress because native WP functions and classes are missing from its scope. Loading WordPress stubs resolves this by providing the required typing definitions.