Description
The following code:
<?php
class Foo
{
public function __construct(
public ?array $meta = null,
) {}
}
class Bar
{
public ?array $meta = null;
public function __construct(?array $meta = null)
{
$this->meta = $meta;
}
}
$foo = new ReflectionClass(new Foo);
$bar = new ReflectionClass(new Bar);
var_dump($foo->getProperty('meta')->hasDefaultValue());
var_dump($bar->getProperty('meta')->hasDefaultValue());
Resulted in this output:
But I expected this output instead:
See https://3v4l.org/7Bndi
PHP Version
PHP 8.4.11 (cli) (built: Jul 29 2025 15:30:21) (NTS)
Copyright (c) The PHP Group
Built by Homebrew
Zend Engine v4.4.11, Copyright (c) Zend Technologies
with Xdebug v3.4.5, Copyright (c) 2002-2025, by Derick Rethans
with Zend OPcache v8.4.11, Copyright (c), by Zend Technologies
Operating System
MacOS