Skip to content

Allow PHP >= 8.1#25

Merged
loevgaard merged 1 commit into
1.xfrom
allow-php81
Jun 18, 2026
Merged

Allow PHP >= 8.1#25
loevgaard merged 1 commit into
1.xfrom
allow-php81

Conversation

@loevgaard

Copy link
Copy Markdown
Member

Summary

Lowers the minimum PHP requirement from >=8.4 back to >=8.1 while keeping cuyz/valinor: ^2.0.

The recent PHP 8.4 upgrade pulled in setono/code-quality-pack ^3.4, which itself requires PHP >= 8.2 and pins phpunit 11 (8.2+) — so the dev toolchain could not install or run on 8.1. To genuinely support and test 8.1, the pack is replaced by its constituent tools at version ranges that span 8.1–8.4:

Tool Constraint On 8.1 On 8.2–8.4
phpunit/phpunit ^10.5 || ^11.5 10.5 11.5
cuyz/valinor ^2.0 2.3.x (2.4 dropped 8.1) 2.4
phpstan/phpstan (+ phpunit/strict-rules ext) ^2.1 / ^2.0
rector/rector ^2.0
infection, ecs, composer-normalize, dep-analyser spanning ranges

Code reverted to 8.1-compatible syntax

The 8.4 upgrade let Rector modernize the code with constructs newer than 8.1. These are reverted (behavior unchanged):

  • final readonly class (8.2) → final class with property-level public readonly (ParserResult, File)
  • typed class constants const string (8.3) → untyped (ListBlock)
  • #[\Override] (8.3) → removed (4 renderers)
  • new X()->method() (8.4) → (new X())->method() (3 renderers, RendererTest)

rector.php now targets php81, and the CI matrix tests 8.1, 8.2, 8.3, 8.4 (lowest + highest deps).

Test plan

Verified locally on real PHP 8.1.34 and 8.4.20:

  • php -l clean across all src/ + tests/ on 8.1 (no 8.2+ syntax remains)
  • 8.1 highest — phpunit (46 tests), phpstan (level max, 0 errors), ecs, rector --dry-run, dependency-analyser all green
  • 8.1 --prefer-lowest — resolves to valinor 2.0.0 / phpunit 10.5.0 / phpstan 2.1.0; phpunit + phpstan green (confirms the valinor 2.0.0 API floor — allowPermissiveTypes(), ->messages()->errors() — is satisfied)
  • 8.4 highest — full suite green; deps resolve to valinor 2.4 / phpunit 11.5
  • composer validate --strict + composer normalize clean

Note: PHP 8.5 (present in the previous matrix) is not included — it isn't installable locally to verify, and phpunit/infection 8.5 support across this 8.1-spanning toolchain is unconfirmed. Easy to add back as a follow-up once verified.
The 3 phpunit "deprecations" on 8.4 are pre-existing implicit-nullable notices from setono/html-element v1.0.0; they don't fail the run.

Lowers the minimum PHP requirement from 8.4 back to 8.1 while keeping
cuyz/valinor ^2.0.

- composer.json: php ">=8.1"; replace setono/code-quality-pack ^3.4 (which
  requires PHP >= 8.2 and pins phpunit 11) with its constituent tools at
  8.1-spanning version ranges so the toolchain installs and runs on 8.1
  through 8.4 (phpunit ^10.5 || ^11.5, phpstan ^2.1, rector ^2.0, etc.)
- Revert PHP 8.2-8.4 syntax that Rector had introduced so the code parses on
  8.1: class-level "readonly class" -> property-level readonly, typed class
  constants -> untyped, drop #[\Override] (8.3+), and re-parenthesize
  "new X()->method()" (8.4) call chains
- rector.php: target php81 instead of php84
- CI: test matrix back to 8.1, 8.2, 8.3, 8.4 (lowest + highest deps)
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.91%. Comparing base (f1ad562) to head (9513016).

Additional details and impacted files
@@            Coverage Diff            @@
##                1.x      #25   +/-   ##
=========================================
  Coverage     81.91%   81.91%           
  Complexity       86       86           
=========================================
  Files            29       29           
  Lines           293      293           
=========================================
  Hits            240      240           
  Misses           53       53           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@loevgaard loevgaard merged commit 549f82f into 1.x Jun 18, 2026
29 checks passed
@loevgaard loevgaard deleted the allow-php81 branch June 18, 2026 12:13
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.

1 participant