Wp Phpstan

🏢Official
by automattic · vlatest · Repository

Wp Phpstan analyzes WordPress code for potential errors and style issues, boosting code quality and preventing bugs during development.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add automattic-wp-phpstan npx -- -y @trustedskills/automattic-wp-phpstan
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "automattic-wp-phpstan": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/automattic-wp-phpstan"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

The Wp Phpstan skill analyzes WordPress codebases for potential errors and style issues using PHPStan, a static analysis tool. It helps developers improve code quality, prevent bugs, and maintain a consistent coding standard within WordPress projects. The skill assists with configuring PHPStan specifically for WordPress development, including handling core functions and third-party plugin/theme integrations.

When to use it

  • Setting up or updating the phpstan.neon or phpstan.neon.dist configuration files.
  • Generating or updating the phpstan-baseline.neon file.
  • Fixing PHPStan errors by improving PHPDoc comments, especially for REST requests, hooks, and database query results.
  • Safely handling code from third-party plugins and themes using stubs or targeted ignores.
  • Managing baseline files to address legacy code issues over time.

Key capabilities

  • Discovers PHPStan entrypoints automatically.
  • Ensures WordPress core stubs (like szepeviktor/phpstan-wordpress or php-stubs/wordpress-stubs) are loaded for accurate analysis.
  • Helps configure a suitable phpstan.neon file, focusing on first-party code and excluding unnecessary files like vendor directories.
  • Provides guidance on correcting types in WordPress-specific code patterns (REST endpoints, hook callbacks, database results).
  • Offers strategies for handling third-party plugin/theme classes through stubs or targeted error ignores.

Example prompts

  • "Analyze this WordPress plugin's code with PHPStan and update the phpstan.neon file."
  • "Generate a baseline file for my WordPress theme to address existing errors."
  • "Help me fix the PHPStan errors related to REST API request parameters in this function."

Tips & gotchas

  • The skill requires a "wp-project-triage" output as initial input.
  • Ensure WordPress core stubs are installed and properly configured within the phpstan.neon file for accurate results; otherwise, expect numerous errors related to unknown functions.
  • Prioritize correcting code types over simply ignoring PHPStan errors whenever possible.

Tags

🛡️

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
automattic
Installs
76

🏢 Official

Published by the company or team that built the technology.