On Fri, Jul 4, 2025 at 3:17 PM Ilija Tovilo <tovilo.il...@gmail.com> wrote:

> Hi everyone
>
> On Wed, Jul 2, 2025 at 9:58 PM Gina P. Banyard <intern...@gpb.moe> wrote:
> >
> > It is this time of year again where we proposed a list of deprecations
> to add in PHP 8.5:
> >
> > https://wiki.php.net/rfc/deprecations_php_8_5
>
> > Deprecate ReflectionClass::getConstant() for missing constants
>
> I don't have strong opinions on this change. However,
> ReflectionProperty::getDefaultValue() suffers from a very similar
> issue, except that it returns null rather than false
> (https://3v4l.org/G2R3l). It would make sense to avoid more
> inconsistencies. For example, ReflectionParameter::getDefaultValue()
> does throw if the parameter has no default value.
>
>

Good catch, I wasn't aware of this behavior for
`ReflectionProperty::getDefaultValue()`. I agree that we should avoid such
inconsistencies, and thus have proposed deprecating
ReflectionProperty::getDefaultValue() for properties that have no default
value. See
https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_reflectionpropertygetdefaultvalue_for_properties_without_default_values

-Daniel

Reply via email to