Skip to content

Process/cleanup: dead PARAMETER_WIDENING flag, orphaned test fixtures, lost golden coverage, PHPStan on 8.5 in CI #610

Description

@lisachenko

Summary

Process and hygiene items from the PHP 8.5 support audit (PR #597); user-approved batch.

1. Dead feature flag PARAMETER_WIDENING

src/Aop/Features.php:49-54 gates "parameter widening for PHP>=7.2.0" — unconditional engine behavior for eight years and dead configuration on a ^8.4 floor. The $useParameterWidening/$useTypeWidening plumbing threads through WeavingTransformer, all four proxy generators, InterceptedConstructorGenerator, and MethodGenerator::fromReflection. Remove flag + plumbing (BC note for 4.0 changelog; Features bitmask already has holes at 8/16/32).

2. Orphaned golden fixtures — and lost version coverage

14 of 40 files in tests/Instrument/Transformer/_files/ are referenced by no test (leftovers of the removed SelfValueTransformer and CachingTransformer):

anonymous-class{,-transformed}.php
file-with-self{,-transformed}.php, file-with-self-no-namespace{,-transformed}.php
php80-file{,-transformed}.php
php81-file{,-transformed}.php
php82-file{,-transformed}.php   (input and expected output byte-identical)
yii_style{,_output}.php

Deleting them is not enough: their removal from the test flow silently dropped all golden-file coverage of general PHP 8.0–8.2 syntax through the weaver (only enums, readonly classes, #[\Override], and property hooks survive). Replace with current-pipeline fixtures covering 8.0–8.2 syntax, 8.3 typed constants, and the audited 8.5 constructs (the audit fixtures in tests/Fixtures/audit/src/ are the seed).

3. PHPStan CI runs only on PHP 8.4

.github/workflows/phpstan.yml pins 8.4 while phpunit runs 8.4/8.5(/8.6 experimental). Reflection signatures/semantics differ per version (the 8.5 self/parent resolution change proved it). Add an 8.5 job.

4. Minor

  • tests/functions.php glob-hijack helper: add parameter/return types.
  • Three hand-rolled "static singleton configured on demand" patterns (FilterInjectorTransformer extract() at :105-109, MagicConstantTransformer statics, SourceTransformingLoader statics) — at minimum replace the extract() with typed reads.
  • Constructor property promotion in Instrument/, Core/, Proxy/Generator/ constructors (the Aop/ layer is already promoted) — mechanical, large-diff; fine to defer or do per-file while touching for other reasons.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions