Add support for PHP 8.4 interface properties#739
Merged
jaapio merged 2 commits intophpDocumentor:6.xfrom Apr 12, 2026
Merged
Conversation
lacatoire
added a commit
to lacatoire/phpDocumentor
that referenced
this pull request
Apr 10, 2026
PHP 8.4 allows declaring properties in interfaces using property hooks. Wire the property support through the descriptor layer and templates: - Accept InterfaceInterface in PropertyDescriptor::setParent() - Add property collection to InterfaceInterface and InterfaceDescriptor - Assemble properties in InterfaceAssembler - Display properties in the default interface template Depends on phpDocumentor/Reflection#739. Fixes phpDocumentor#4061
PHP 8.4 allows declaring properties in interfaces using property hooks. Add getProperties() and addProperty() to Interface_, and allow the Property factory to accept Interface_ as a valid container. Fixes phpDocumentor/phpDocumentor#4061
9e301d8 to
b19779a
Compare
- Remove same-namespace import of Property in Interface_Test - Add RequiresPackage constraint for nikic/php-parser >= 5.2 on the integration test, as older versions cannot parse interface property syntax
jaapio
approved these changes
Apr 10, 2026
Member
jaapio
left a comment
There was a problem hiding this comment.
Thanks this looks good, I will merge this later when I'm back at my computer.
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.4 allows declaring properties in interfaces using property hooks:
This was not supported by the reflection library, causing a crash when phpDocumentor encountered interface properties (
Expected an instance of any of Class_, Trait_. Got: Interface_).$propertiesarray,getProperties(), andaddProperty()toInterface_, following the same pattern asTrait_Interface_::classto the assertion inFactory\Property::doCreate()Interface_property accessorsFixes phpDocumentor/phpDocumentor#4061