Skip to content

Support PHP 7.4 as minimum version - #338

Merged
TomasVotruba merged 2 commits into
mainfrom
support-php-74
Oct 5, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
support-php-74

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Lowers the minimum PHP requirement to 7.4 so the ruleset can run on legacy projects (PHPStan itself supports 7.4+).

  • composer.json: php constraint ^8.4 -> >=7.4
  • Downgraded src/ syntax to 7.4 via Rector downgrade sets:
    • readonly classes/properties -> @readonly docblocks
    • constructor property promotion -> explicit properties + assignment
    • typed class constants -> plain constants with @var
    • native union param types -> @param docblocks
    • first-class callable syntax and trailing commas in signatures
    • ReflectionMethod::getAttributes() guarded with method_exists() (8.0+ only)
  • phpstan.neon: constant/param type-coverage thresholds set to 0 (typed constants and union types do not exist on 7.4), plus a scoped ignore for the getAttributes compat shim
  • CI: new PHP 7.4 Compatibility job that lints every src/ file on PHP 7.4

Dev tooling (PHPUnit, Rector, type-coverage, illuminate) stays on 8.x and runs on the existing 8.4 matrix; only the runtime source is downgraded.

Stacked on #337 (entropy/native replacement); retarget to main once that merges.

@TomasVotruba
TomasVotruba force-pushed the support-php-74 branch 2 times, most recently from a4782c9 to 217b675 Compare October 5, 2026 20:37
Base automatically changed from entropy-replace-nette-utils to main October 5, 2026 20:55
Downgrade src syntax to 7.4 (readonly, promotion, typed constants,
union types), lower php constraint to >=7.4, widen union node params
to native Node for param type coverage, add PHP 7.4 syntax-lint CI job.
@TomasVotruba
TomasVotruba merged commit 05782bb into main Oct 5, 2026
8 of 9 checks passed
@TomasVotruba
TomasVotruba deleted the support-php-74 branch October 5, 2026 21:17
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