Skip to content

Add PHPStan support for static analysis #198

@claytoncollie

Description

@claytoncollie

Is your enhancement related to a problem? Please describe.

This plugin currently lacks static analysis tooling. P

HPStan can catch type errors, undefined variables, and other bugs before runtime—improving code quality and reducing debugging time.

This should include:

  1. PHPStan configuration file (phpstan.neon) with WordPress stubs
  2. Baseline file to allow incremental adoption without blocking on existing issues
  3. GitHub Action to run PHPStan on PRs
  4. Composer scripts for local analysis (composer phpstan)
  5. README documentation on running analysis locally and understanding output

We should follow how he wp-framework and wp-scaffold are using this tool

Designs

No response

Describe alternatives you've considered

  • Psalm (similar tool, but PHPStan has better WordPress ecosystem support via szepeviktor/phpstan-wordpress)
  • Running analysis only in CI vs also providing local tooling (both would be ideal)
  • Strict vs relaxed rule levels (recommend starting at level 5-6 with a baseline, then increasing over time)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions