Skip to content

ReflectionProperty::getDefaultValue(): note about promoted properties - #5967

Merged
lacatoire merged 2 commits into
php:masterfrom
qodelicious:reflectionproperty-getdefaultvalue-promoted
Oct 19, 2026
Merged

lacatoire merged 2 commits into
php:masterfrom
qodelicious:reflectionproperty-getdefaultvalue-promoted

Conversation

@qodelicious

Copy link
Copy Markdown
Contributor

Adds a note that the default value of a promoted property is only applied to the constructor parameter, not to the property, so getDefaultValue() returns null for it, and points to ReflectionParameter::getDefaultValue(), as suggested in the issue. Checked with PHP 8.4.

Fixes #3386

Comment thread reference/reflection/reflectionproperty/getdefaultvalue.xml
@lacatoire
lacatoire merged commit 38a3e5b into php:master Oct 19, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ReflectionProperty::getDefaultValue() and promoted properties

2 participants