Add support for PHP 8.3 typed class constants#736
Merged
jaapio merged 11 commits intophpDocumentor:6.xfrom Apr 10, 2026
Merged
Conversation
Files without namespace did not get a type context, this resulted in unknown scope of the types to be resolved. The other fix in this commit is to make sure the FQSN coming from the php-parser is correctly translated to a FQSEN object, this was not the case for some situations.
…onstant Files did not get any context when processed
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.4.0 to 2.5.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](dependabot/fetch-metadata@v2.4.0...v2.5.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-version: 2.5.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
…thub_actions/dependabot/fetch-metadata-2.5.0 Bump dependabot/fetch-metadata from 2.4.0 to 2.5.0
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 10.5.58 to 10.5.62. - [Release notes](https://github.com/sebastianbergmann/phpunit/releases) - [Changelog](https://github.com/sebastianbergmann/phpunit/blob/10.5.62/ChangeLog-10.5.md) - [Commits](sebastianbergmann/phpunit@10.5.58...10.5.62) --- updated-dependencies: - dependency-name: phpunit/phpunit dependency-version: 10.5.62 dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com>
…mposer/phpunit/phpunit-10.5.62 Bump phpunit/phpunit from 10.5.58 to 10.5.62
Bumps [phpspec/prophecy-phpunit](https://github.com/phpspec/prophecy-phpunit) from 2.4.0 to 2.5.0. - [Release notes](https://github.com/phpspec/prophecy-phpunit/releases) - [Changelog](https://github.com/phpspec/prophecy-phpunit/blob/master/CHANGES.md) - [Commits](phpspec/prophecy-phpunit@v2.4.0...v2.5.0) --- updated-dependencies: - dependency-name: phpspec/prophecy-phpunit dependency-version: 2.5.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
…mposer/phpspec/prophecy-phpunit-2.5.0 Bump phpspec/prophecy-phpunit from 2.4.0 to 2.5.0
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 7. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@v5...v7) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
…thub_actions/actions/upload-artifact-7 Bump actions/upload-artifact from 5 to 7
The Constant class now accepts and exposes a Type parameter, following the same pattern used by Property. The ClassConstantIterator reads the type from the AST node, and the ClassConstant factory converts it via the Type helper before passing it to the Constant constructor.
04cbae2 to
5d8c68c
Compare
jaapio
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PHP 8.3 introduced native type declarations for class constants:
This PR adds support for reading and exposing these types through the reflection API, following the same pattern already used by
Property:Type|null $typeparameter toConstantclass constructor andgetType()accessorgetType()toClassConstantIteratorto read the type from theClassConstAST nodeClassConstantfactory via the existingTypehelperGlobal constants are not affected (PHP does not support typed global constants).