[doc-en] master: ReflectionProperty::getDefaultValue(): note about promoted properties (#5967)

From: Date: Mon, 19 Oct 2026 07:54:44 +0000
Subject: [doc-en] master: ReflectionProperty::getDefaultValue(): note about promoted properties (#5967)
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-23851@lists.php.net to get a copy of this message
Author: qodelicious (qodelicious) Committer: GitHub (web-flow) Pusher: lacatoire Date: 2026-10-19T09:54:41+02:00 Commit: https://github.com/php/doc-en/commit/38a3e5bd089cd0cd79fa2c4887c1a9177b4bf2ec Raw diff: https://github.com/php/doc-en/commit/38a3e5bd089cd0cd79fa2c4887c1a9177b4bf2ec.diff ReflectionProperty::getDefaultValue(): note about promoted properties (#5967) * ReflectionProperty::getDefaultValue(): note about promoted properties Fixes #3386 * Apply suggestion from @lacatoire --------- Co-authored-by: Louis-Arnaud <la.catoire@gmail.com> Changed paths: M reference/reflection/reflectionproperty/getdefaultvalue.xml Diff: diff --git a/reference/reflection/reflectionproperty/getdefaultvalue.xml b/reference/reflection/reflectionproperty/getdefaultvalue.xml index 887944dc073b..f144016244fc 100644 --- a/reference/reflection/reflectionproperty/getdefaultvalue.xml +++ b/reference/reflection/reflectionproperty/getdefaultvalue.xml @@ -30,6 +30,15 @@ between a &null; default value and an uninitialized typed property. Use <methodname>ReflectionProperty::hasDefaultValue</methodname> to detect the difference. </simpara> + <note> + <simpara> + For <link linkend="language.oop5.decon.constructor.promotion">promoted properties</link>, + the default value is only applied to the constructor parameter, not to the property itself, + so this method returns &null; and <methodname>ReflectionProperty::hasDefaultValue</methodname> + returns &false;. Use <methodname>ReflectionParameter::getDefaultValue</methodname> + on the matching constructor parameter to get it. + </simpara> + </note> </refsect1> <refsect1 role="changelog">

« previous php.doc.cvs (#23851) next »