Repository navigation
Release 5.0.0
Parser Reflection 5.0.0
This release brings the library to full PHP 8.6 reflection parity ahead of the PHP 8.6 GA (planned 2026-11-19): parameter doc comments, scope-aware property accessibility, readonly property defaults, partial function application, and the 8.6 attribute-API additions are all reflected statically from the AST — without loading the reflected code into memory. All 8.6 behavior is validated against PHP 8.6.0RC2 and guarded by runtime version checks, so the library runs identically on PHP 8.5. Tracked in epic #219.
💥 Breaking changes
- PHP 8.5 or newer is now required (previously
>=8.4) — #218. The CI matrix runs PHP 8.5 (lowest + highest deps) with PHP 8.6 as experimental. nikic/php-parser: ^5.9is now required — the first release parsing PHP 8.6 partial-application placeholders (ArgPlaceholder) — #224- Named attribute arguments are now keyed by name in
ReflectionAttribute::getArguments(), matching native reflection (previously they were collapsed into a positional list) — #225 ReflectionClassConstant::__toString()now prints the constant's doc comment like native reflection, and renders boolean values astrue/falseon PHP 8.6+ (following the native rendering change) — #225, #223
✨ PHP 8.6 API coverage
ReflectionParameter::getDocComment()— doc comments on parameters (plain, promoted, variadic, by-ref, combined with attributes), byte-for-byte native parity; available on every supported runtime. Known limitation: a doc comment written after a parameter is dropped by PHP-Parser — #221ReflectionProperty::isReadable()/isWritable()— scope-aware accessibility emulation covering visibility, asymmetric(set)visibility,readonly(incl. the implicitprotected(set)), property hooks, virtual properties, and object initialization state; validated against native 8.6 across ~12,800 combinations. Deliberate divergence: scope classes are resolved statically, never autoloaded — #222- Readonly property defaults —
hasDefaultValue()/getDefaultValue()/getDefaultProperties()forreadonlyproperties with defaults, verified against PHP 8.6.0RC2 across scalar, const-expression, class-constant, enum-case and array defaults — #223 - Partial Function Application — sources using
f(?),f(name: ?)andf(1, ...)reflect cleanly on every host runtime; placeholder arguments in constant-expression positions degrade into a catchableReflectionException(the same contract as first-class callables) — #224 - Attribute API additions:
ReflectionAttribute::getShortName(),getNamespaceName(),inNamespace()andReflectionConstant::inNamespace()implemented (the inherited native implementations fatal on parsed attributes) — #225 #[\Override]on class constants (incl. interface and enum constants) and__debugInfo()on enums are fully reflected — #225- Internal functions newly deprecated in 8.6 (
strcoll()et al.) reportisDeprecated()and their#[\Deprecated]payload correctly through the native fallback — #215
🐛 Bug fixes
- Fixed a latent fatal in
getDefaultValueExpression()on typed properties/parameters without a default value — #223 isVirtual()no longer misreports a property whose short-formgethook references its own backing store — #222
🔧 Internal & CI
- PHP 8.6 test scaffolding (
FileWith*86.phpstub convention withPHP_VERSION_ID >= 80600guards) and a deprecation-clean audit against the "Deprecations for PHP 8.6" RFC (no hits) — #220 - The experimental PHP 8.6 CI rows are clearly labeled and their real outcome is written to the run summary — #220
- Dev dependencies:
phpunit/phpunit ^13.3,rector/rector ^2.6.7(required: Rector preloads its bundled php-parser under PHPUnit ≥ 12, so the bundle must also be ≥ 5.9)
Full Changelog: 4.0.0...5.0.0
Known follow-ups (out of this release's scope): #233, #234, #235, and possibly mirroring the new 8.6 getDefaultValue() deprecation in the parsed implementation.