Skip to content

Add PHPCS + PHPStan to CI; standardize on strict_types #39

Description

@remyperona

Summary

Code standards are enforced unevenly across the package, and there is no committed static-analysis or coding-standards configuration.

Observations

  • declare(strict_types=1) appears in exactly one of ~20 non-test files (Integration/HttpRequestTrait.php). That file is also the best-documented and most defensively written (fail-closed blocking of unmocked HTTP requests) — a good quality bar for the rest of the package to reach.
  • No PHPCS ruleset or PHPStan config is committed, so style and static analysis are not gated in CI (.github/workflows runs the test suites only).

Proposed direction

  • Add a PHPCS ruleset (e.g. based on the standard WP Media convention) and a PHPStan config, wired into CI as non-blocking first, then blocking.
  • Adopt HttpRequestTrait as the reference style (strict types, full docblocks) and bring files up to it opportunistically as they're touched — not a big-bang rewrite.

This is a maintainability/consistency enhancement, not a bug.


Found during an audit of WP Rocket's integration test suite, which depends on this package.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions