Releases: goaop/parser-reflection
Release list
Release 4.0.0
Parser Reflection 4.0.0
This is a major release that brings the library to full PHP 8.4 reflection parity: property hooks, the lazy-object API, native enum reflection, global constant reflection, and dozens of smaller gaps in the reflection API are now implemented on top of the AST — without loading the reflected code into memory.
💥 Breaking changes
- PHP 8.4 or newer is now required (previously
>=8.2). The CI matrix runs PHP 8.4 and 8.5, with 8.6 as experimental. NodeExpressionResolverno longer implicitly autoloads classes while evaluating constant expressions. Reflection stays purely static; only APIs that genuinely need a live object (e.g.invoke()) trigger class loading.- Sources are now parsed with the newest PHP grammar supported by
nikic/php-parserinstead of the grammar of the host PHP version, so files using newer syntax can be reflected from an older runtime.
🚀 New reflection classes
ReflectionEnum,ReflectionEnumUnitCaseandReflectionEnumBackedCase— full static reflection for native enums, wired intoReflectionFile/ReflectionFileNamespace(newgetEnums()method) — #189, #190, #192ReflectionConstant— reflection forconst-declared global constants — #213NodeAwareInterface— every parsed reflection object now exposes its underlying AST node viagetNode()— #200
✨ PHP 8.4 API coverage
- Property hooks:
getHook(),getHooks(),hasHook(),hasHooks(),getSettableType(),isVirtual(),isDynamic(), plus correctgetModifiers()for virtual and abstract properties — #161, #170, #171, #172, #213 - Lazy objects:
newLazyGhost(),newLazyProxy(),resetAsLazyGhost(),resetAsLazyProxy(),isLazy(),isUninitializedLazyObject(),initializeLazyObject(),markLazyObjectAsInitialized(),skipLazyInitialization(),getLazyInitializer()and raw property access (getRawValue()/setRawValue()/setRawValueWithoutLazyInitialization()) — #213 - Abstract properties in interfaces and the
finalmodifier on promoted constructor properties — #173, #213
✨ Other improvements
- Filled PHP 8.1–8.4 function-like reflection gaps:
getTentativeReturnType(),hasTentativeReturnType(),isAnonymous(),getClosureUsedVariables(),getClosureCalledClass(), and#[\Deprecated]attribute support — #213 getAttributes()now supportsReflectionAttribute::IS_INSTANCEOFfiltering — #213- Complete trait support, including
insteadofandasalias adaptations — #177 - First-class callable syntax (
strlen(...)) supported in constant expressions — #193 Enum::CASE->valueexpressions supported in constant expressions (e.g. parameter defaults) — #176- Closures (
static fn() => ...) supported in constant-expression contexts — #213 - Enum case constant introspection via the class-constant API — #213
🐛 Bug fixes
- Fixed infinite recursion in
NodeExpressionResolver::resolveExprClassConstFetch()— #178 isSubclassOf()now compares fully-qualified class names via the resolved AST name — #180__toString()for inherited methods now renders theinherits OriginalClasssection like native reflection — #181- Fixed null handling in
ReflectionParameter::getDeclaringClass()context resolution — #178
🔧 Internal & CI
- Static analysis raised to PHPStan level 10 (
phpstan/phpstan ^2.0),rector/rectorbumped to^2.0— #156 - PHP 8.6 added to the CI matrix as experimental — #201
- GitHub Actions hardened with explicit workflow permissions and kept current via Dependabot — #191, #196, #197, #198, #199
Full Changelog: 3.1.0...4.0.0
Release 3.1.0
What's Changed
- Upgrade to GitHub-native Dependabot by @dependabot-preview[bot] in #116
- [Step 1 Upgrade] Bump requirement to php 7.4 by @samsonasik in #124
- [Step 2 Upgrade] Bump requirement to php 8.0 by @samsonasik in #125
- [Step 3 Upgrade] Enable skipped test: ReflectionClassTest::testGetModifiers() by @samsonasik in #126
- [Step 4 Upgrade] Bump requirement to php 8.1 by @samsonasik in #127
- [Step 5 Upgrade] Bump requirement to php 8.2 by @samsonasik in #128
- [Step 6 Upgrade] Add PHP 8+ Attributes support by @samsonasik in #130
- Fix ReflectionProperty::getValue() to use #[\ReturnTypeWillChange] by @samsonasik in #131
- New version implementation for PHP>=8.2 by @lisachenko in #133
- Update phpunit/phpunit requirement from ^10.5.8 to ^11.0.7 by @dependabot[bot] in #135
- [Feature] AST-preserving node name resolution, implements #136 by @lisachenko in #137
- [Feature] Add support for UnaryMinus and UnaryPlus expressions by @marcovtwout in #141
- Update GitHub Actions to fix CI build failures by @Copilot in #148
- Fix deprecated nullable type declarations for PHP 8.4+ compatibility by @Copilot in #146
- Add comprehensive GitHub Copilot instructions for parser-reflection repository by @Copilot in #150
- Fix PHP 8.4 compatibility for getModifiers() on properties by @Copilot in #152
- Fix: Add support for new expressions in parameter default values by @Copilot in #154
New Contributors
- @dependabot-preview[bot] made their first contribution in #116
- @samsonasik made their first contribution in #124
- @dependabot[bot] made their first contribution in #135
- @marcovtwout made their first contribution in #141
- @Copilot made their first contribution in #148
Full Changelog: 3.0.1...3.1.0
Version 2.1.2
This patch release fixes compatibility with PHP7.3 and PHP7.4 #103
Warning! Please, be aware that this repo is not maintained well and will be abandoned soon. Consider to upgrade your software to the Roave/BetterReflection library.
Version 2.1.0
This minor release contains several fixes and improvements:
- Added support for the
ReflectionClassConstant#93, #97 (by @MaximilianKresse) - PHP7.4
ReflectionMethod->getClosure($object = null)compatibility #88 (by @ddinchev) getNamespaceAliases()logic fix #96 (by @MaximilianKresse)
Version 1.4.1
Version 1.3.0
This release enables usage of token positions during analysis in Go! AOP framework, see #78.
Also contains improvements by @loren-osborn in #76
Version 1.2.1 of ParserReflection
Patch version with small fixes:
- Fixed the signature of ReflectionClass::newInstance to be compatible across all PHP versions, resolves #70
- Fixed namespace names with leading slash, resolves #67
PHP version was also bumped to be >=5.6.0. Pay an attention if you use this library with outdated PHP versions.
Version 1.2.0 of ParserReflection
This release contains a lot of fixes and improvements since 1.1.0:
- Fixed ReflectionParameters with class constant as default value (#44)
- [NodeResolver] allow parsing of scalar expressions (#47)
- Fix NodeExpressionResolver to reflect system classes (#50)
- Parse top level “define” statements in a root namespace (#46)
- Add test-case scenario for resolving self: constants for parameters, #49
- Change logic of collecting constants to have an ability to resolve self constants recursively
- Enable 7.1 for code coverage collecting
- Added tests for parameters in 5.6 and 7.0
- Fixed isOptional() result for variadic parameters, they should be optional
- Fixed bug with accessing default value for variadic optional parameters
- Added support for the pow operator in PHP5.6
- Fixed type handling for PHP7.0
- Enable parsing of files with PHP7.0 classes
- isAbstract() for methods in the interface should return true
- Fix broken compatibility with 5.5
- Added support for displaying return types in the ReflectionMethod->__toString()
- Fixed typehint for the method
- Allow to install latest version of nikic/php-parser
- Fixed ReflectionProperty->isDefault() implementation
- Fixed buggy self::class resolution for old versions of PHP
- Add support for nullable types, related to the #12
- Implement ReflectionFile->isStrictMode check for the strict_types, resolves #59
This release also provides support for parsing PHP7.1 files. However, ReflectionClassConstant and constants with modifiers are not supported yet.
Version 1.1.0 of ParserReflection
Minor release, that contains several features and important bug-fixes:
- Added root namespace normalization, resolves #39
- Resolved all relative paths to be compatibe with original reflection filenames, resolves #31
- Allow limiting number of files, that can be cached at any given moment
- Added resizing of the cache size after changing the maximum limit, resolves #35
- Added support for "self" and "parent" as method parameter type hint
- Allow to use internal interfaces (e.g. "Traversable") as parameter types
- Fixed a notice, when using
ReflectionClass::hasConstantmethod
Version 1.0.2 of ParserReflection
Patch release for #8