Skip to content

Allow PHP 8.4 (CI + Composer constraint) - #17

Merged
Chrico merged 4 commits into
inpsyde:mainfrom
kaelansmith:feat/php-8.4-compat
Aug 12, 2026
Merged

Allow PHP 8.4 (CI + Composer constraint)#17
Chrico merged 4 commits into
inpsyde:mainfrom
kaelansmith:feat/php-8.4-compat

Conversation

@kaelansmith

Copy link
Copy Markdown
Contributor

Summary

Removes the hard php: < 8.4 Composer ceiling so the library can be installed on PHP 8.4. No runtime API changes.

This package currently blocks Composer installs on PHP 8.4 even though the code itself is fine there. We hit that while upgrading a WordPress stack and kept the change intentionally small for upstream.

What changed

  • composer.json: php requirement is now >=7.4 (still covers 7.4+).
  • Dev tooling: allow PHPUnit 10/11 and Psalm 6 so Composer can resolve on 8.4.
  • CI (qa.yml):
    • Lint + unit tests: add PHP 8.4.
    • Psalm matrix: run on PHP 8.1–8.4 only (Psalm 6 needs ≥8.1). Runtime support for 7.4/8.0 remains covered by lint/unit.
  • psalm.xml: suppress Psalm 6-only findings that would otherwise force BC breaks (MissingOverrideAttribute, ClassMustBeFinal). #[\Override] and sealing WpContext were deliberately not applied so PHP 7.4 and existing subclasses stay supported.

Why reviewers can trust this

Notes for maintainers

  • Prefer keeping WpContext non-final; factory methods are already final.
  • If you want a hard upper PHP bound again later, prefer documenting supported versions in README/CI rather than a Composer <x.y ceiling that blocks early adopters.
  • Happy to adjust the Psalm matrix (e.g. keep Psalm 5 on 7.4/8.0) if you’d rather cover static analysis on those versions too.

Test plan

  • CI green on this PR (lint/unit on 7.4–8.4; Psalm on 8.1–8.4)
  • composer update succeeds on PHP 8.4
  • Existing unit tests still pass on 7.4 / 8.3 / 8.4

Remove the hard upper bound on the PHP constraint and include 8.4 in the
QA matrix so this package can be installed and tested on modern runtimes.
Widen require-dev constraints so Composer can resolve on PHP 8.4
(Psalm 6 / PHPUnit 11) while still supporting older runtimes via
Psalm 5 / PHPUnit 9. Suppress Psalm 6 rules that would force BC breaks
or PHP 8.3-only attributes.
Keep runtime support for PHP 7.4+, but make Composer installable on
8.4 by allowing Psalm 6 / PHPUnit 11. Run Psalm only on PHP 8.1+
(where Psalm 6 resolves), mark WpContext final for Psalm 6, and
suppress MissingOverrideAttribute until the package can require 8.3+.
Psalm 6 wants ClassMustBeFinal; suppress that instead of sealing the class so existing subclasses keep working.
@kaelansmith
kaelansmith requested a review from a team as a code owner August 11, 2026 19:29

@Chrico Chrico left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for putting effort into this 👍🏻 Psalm can stay as you changed it. We need to move this library to PHPStan at some point, but this is a different issue. ;-)

@Chrico
Chrico merged commit 3d2196b into inpsyde:main Aug 12, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants