Skip to content

ReflectionProperty::hasDefault return false on promoted property #22860

Description

@Norbytus

Description

The following code:

<?php
class A {
    function __construct(
        public string $value = '',
    ) {
    }
}
$propInfo = new ReflectionProperty('A', 'value');
var_dump($propInfo->hasDefaultValue());
bool(false)
bool(true)

PHP Version

PHP 8.4.20 (cli) (built: May 25 2026 09:46:41) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.4.20, Copyright (c) Zend Technologies

Operating System

archlinux 2026.07.01

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions