wp-phpstan

Configure, run, and resolve PHPStan static analysis errors in WordPress projects.

27|1|Updated Feb 16, 2026
One-click install
npx skills add https://github.com/dr-robert-li/cowork-wordpress-expert --skill wp-phpstan-dr-robert-li
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-phpstan
Source: https://github.com/dr-robert-li/cowork-wordpress-expert/tree/main/references/wp-phpstan
Command: npx skills add https://github.com/dr-robert-li/cowork-wordpress-expert --skill wp-phpstan-dr-robert-li

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill streamlines the process of setting up, running, and fixing static analysis errors using PHPStan within WordPress projects, ensuring code quality and maintainability.

Core Features & Use Cases

  • PHPStan Configuration: Assists in setting up phpstan.neon and phpstan-baseline.neon files.
  • Error Resolution: Guides on fixing PHPStan errors by applying WordPress-specific typing and annotations.
  • Third-Party Integration: Provides strategies for handling classes from third-party plugins and themes.
  • Use Case: When encountering numerous "class not found" errors during a PHPStan run on a WordPress plugin, this Skill can help configure stubs and ignore rules to resolve them efficiently.

Quick Start

Use the wp-phpstan skill to inspect the current PHPStan setup in the project.

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?

Configuring PHPStan for WordPress involves setting up the phpstan.neon file and managing the phpstan-baseline.neon to ensure proper static analysis and baseline handling. It requires a Composer-based PHPStan environment and WordPress 6.9+ compatibility.

Why does PHPStan report class not found errors in WordPress projects?

PHPStan reports class not found errors in WordPress projects because it cannot locate third-party plugin and theme classes by default. You can resolve these static analysis errors by configuring stubs and ignore rules to handle the undefined classes efficiently.

How do I fix PHPStan errors related to WordPress-specific typing?

Fixing PHPStan errors for WordPress-specific typing requires applying proper type annotations and stubs within your phpstan.neon configuration. This guides the static analyzer to correctly interpret WordPress core functions and third-party class structures.

Do I need Composer to run PHPStan on WordPress 6.9+?

Yes, running PHPStan on WordPress 6.9+ requires a Composer-based PHPStan installation. This dependency management ensures the static analysis tool is properly integrated with your project environment to accurately resolve code quality issues.

What is the best way to manage a PHPStan baseline in WordPress?

The best way to manage a PHPStan baseline in WordPress is by utilizing the phpstan-baseline.neon file. This process records existing static analysis errors, allowing you to progressively fix code quality issues without disrupting ongoing development.

Can PHPStan handle classes from third-party WordPress plugins and themes?

Yes, PHPStan can handle third-party WordPress plugins and themes by applying specific configuration strategies in your phpstan.neon file. This involves setting up stubs and ignore rules to resolve static analysis errors for external dependencies.