2 <<file
:__EnableUnstableFeatures('readonly')>>
5 public (function(): void
) $fprop;
6 public function __construct() {
8 $this->fprop
= () ==> {};
10 public function set(int $y) : void
{
14 public readonly
function get() : int {
20 function test(): void
{
21 $x = readonly
new Foo();
23 $x->set(6); // error, can't call mutable function on readonly
26 // TODO: error against the $g typehint in nastcheck
27 function test_closure(readonly (readonly
function() : void
) $f, readonly (function(): void
) $g) : void
{
29 $g(); // error $g can't be called
30 $x = readonly
new Foo();