2 <<file
:__EnableUnstableFeatures("readonly")>>
6 function foo(readonly Foo
$x): readonly Foo
{
7 $y = HH\Readonly\as_mut
(readonly
$x->prop
);
13 public function __construct(
14 public readonly Foo
$prop
17 public readonly
function get(): readonly Foo
{
18 return readonly
$this->prop
;
23 class ReadonlyBox
<T
> {
24 public function __construct(
25 private readonly T
$contents
28 public readonly
function get(): readonly T
{
29 return readonly
$this->contents
;
32 public function set(readonly T
$x): void
{
38 function main(): void
{
39 $y = new Test(new Foo());
40 $a = readonly
$y->prop
;
41 $y = new ReadonlyBox($a);
42 $z = readonly
$y->get();