wp-phpstan

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

Updated Jan 29, 2026
One-click install
npx skills add https://github.com/HungNth/wordpress-notify-nth --skill wp-phpstan-hungnth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-phpstan
Source: https://github.com/HungNth/wordpress-notify-nth/tree/main/.opencode/skills/wp-phpstan
Command: npx skills add https://github.com/HungNth/wordpress-notify-nth --skill wp-phpstan-hungnth

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 in WordPress codebases, enabling WordPress-specific typing, proper baselining, and safer handling of third-party plugins.

Core Features & Use Cases

  • PHPStan setup & configuration: Create or update phpstan.neon files to work with WordPress environments, including core stubs and plugin typings.
  • Baseline & typing: Generate and manage baselines, and improve type hints for REST requests, hooks, and database results using WordPress patterns.
  • Third-party class handling: Use stubs and targeted ignores to safely analyze plugins and themes without breaking on unavailable classes.

Quick Start

Use the repository's PHPStan workflow to scan a WordPress project, then run the baseline update to align with current code.

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 project to handle core stubs and plugin typings?

Configure PHPStan for WordPress by creating or updating a phpstan.neon file that includes WordPress core stubs and plugin typings. This ensures static analysis correctly recognizes WordPress-specific functions and classes without reporting false positives.

Why does PHPStan report unknown classes when analyzing WordPress plugins, and how do I fix it?

PHPStan reports unknown classes in WordPress plugins because third-party classes are unavailable during analysis. Fix this by using WordPress stubs and targeted ignores to safely analyze plugins and themes without breaking on unavailable classes.

What is the best way to generate a PHPStan baseline for an existing WordPress codebase?

Generate a PHPStan baseline for a WordPress codebase by running the baseline update command through your repository's workflow. This aligns the baseline with current code so existing errors are ignored while new code is strictly analyzed.

How do I improve type hints for WordPress REST requests, hooks, and database results in PHPStan?

Improve WordPress typing in PHPStan by applying WordPress-specific patterns for REST requests, hooks, and database results. Refining these type hints allows the analyzer to properly validate data structures passed through core WordPress APIs.

Do I need Composer to manage PHPStan configuration in a WordPress project?

You need a Composer-based PHPStan installation and a phpstan.neon configuration file managed via your repository's workflows to properly set up, run, and fix static analysis in WordPress environments.