Skip to content

Adopt PHP 8.3 typed class constants and #[\Override] across src/ #608

Description

@lisachenko

Summary

From the PHP 8.5 support audit (PR #597); user-approved modernization batch.

Typed class constants (8.3)

Exactly one constant in src/ is typed (AbstractMethodInvocation::TRAIT_ALIAS_PREFIX). Add native types to the rest — concentrated targets:

  • src/Core/AspectContainer.php:27-67 (9 string constants)
  • src/Aop/Features.php:24-54 (int constants; see also the dead-flag cleanup in Process/cleanup: dead PARAMETER_WIDENING flag, orphaned test fixtures, lost golden coverage, PHPStan on 8.5 in CI #610)
  • src/Aop/Pointcut.php:45-53 (9 int KIND_* constants)
  • src/Proxy/Generator/MethodGenerator.php:37-39, src/Proxy/Generator/ClassGenerator.php:37-39, src/Proxy/Generator/PropertyGenerator.php:27-34 (FLAG_*)
  • src/Proxy/Generator/TypeGenerator.php:41 (BUILTIN_TYPESconst array), src/Proxy/EnumProxyGenerator.php:56,66
  • src/Instrument/ClassLoading/CachePathManager.php:32,37, src/Instrument/Transformer/WeavingTransformer.php:42

#[\Override] (8.3)

Zero occurrences in src/ despite deep hierarchies. Add it to overriding methods in framework code — transformers implementing transform(), SourceTransformingLoader::filter() (overrides php_user_filter), the AbstractJoinpoint/AbstractInvocation/AbstractInterceptor hierarchies, Pointcut::matches() implementations — and replace bare @inheritDoc docblocks where the attribute is the enforced version.

Caveat: never add #[\Override] to test-project fixture classes that get woven — the weaver strips it from intercepted methods for trait-alias reasons (stripOverrideAttributeFromInterceptedMethods()), and fixtures are meant to exercise that path deliberately, not accidentally.

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