superpowers-sage:wp-phpstan

Configure PHPStan static analysis for Sage and Acorn WordPress themes.

13|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/hekivo/superpowers-sage --skill superpowers-sage-wp-phpstan-hekivo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: superpowers-sage:wp-phpstan
Source: https://github.com/hekivo/superpowers-sage/tree/main/skills/wp-phpstan
Command: npx skills add https://github.com/hekivo/superpowers-sage --skill superpowers-sage-wp-phpstan-hekivo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PHPStan can surface bugs and type issues in Sage/Acorn WordPress code early, but WordPress’s dynamic functions and hooks often require careful stubbing, ignore rules, and baseline management to make results actionable.

Core Features & Use Cases

  • Sets up PHPStan for Sage/Acorn: Installs phpstan/phpstan, larastan/larastan, and szepeviktor/phpstan-wordpress for WordPress and Acorn compatibility.
  • Creates and maintains a phpstan.neon configuration: Supports level selection (0–9), scanning paths, hook ignore patterns, and WordPress bootstrap scanning.
  • Enables incremental adoption with baselines: Generates phpstan-baseline.neon so CI can fail on new errors while existing issues are handled gradually.
  • Supports CI enforcement: Runs PHPStan with GitHub-style annotations and includes a baseline-growth prevention check.

Quick Start

Run the lando PHPStan analysis at level 0 by installing phpstan/larastan/WordPress stubs, writing a phpstan.neon that includes them, and then executing the initial analyze command to confirm you have a clean or manageable starting state.

Frequently Asked Questions about superpowers-sage:wp-phpstan

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

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

Configuring PHPStan for a Sage theme involves installing phpstan, larastan, and WordPress stubs, then generating a phpstan.neon file with WordPress stubs and Larastan support to analyze theme code.

Why does PHPStan report type errors for WordPress hooks and dynamic functions in Acorn?

PHPStan reports type errors for WordPress hooks and dynamic functions because it lacks native stubs. Generating a phpstan.neon configuration with WordPress stubs, defining ignoreErrors, and scanning hook directories resolves these issues.

What is a PHPStan baseline and how do I use it for incremental static analysis in WordPress?

A PHPStan baseline captures existing static analysis errors so CI checks fail only on new issues. Generating a phpstan-baseline.neon file enables incremental adoption by letting you gradually fix existing issues and increase strictness.

Can I run PHPStan in CI to prevent baseline growth for my Sage theme?

Yes, you can run PHPStan in CI to prevent baseline growth. CI runs enforce baseline stability by failing when new static analysis errors are introduced, using GitHub-style annotations for reporting.

Do I need Larastan to run static analysis on an Acorn WordPress theme?

Yes, you need Larastan to run static analysis on an Acorn theme. Installing larastan/larastan provides the necessary support for Acorn's Laravel-based architecture alongside WordPress stubs.

What's the best way to gradually increase PHPStan strictness levels in an existing WordPress theme?

The best way to increase PHPStan strictness is by starting at level 0, generating an initial baseline, and using the phpstan.neon configuration to select higher levels (0-9) while gradually resolving existing errors.