- Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
<?php
class Foo
{
public ?string $prop = null;
public function __construct(?string $prop = null)
{
$this->prop = $prop;
}
}
class Bar extends Foo
{
public function __construct(
public ?string $bar = null,
) {}
}
// Echoes nothing, but it works as expected.
echo (new Bar())->prop;