<?php /** * @method &foo() */ class Test { public $values = []; public function &__call($name, $args) { $this->values[$name] ??= null; return $this->values[$name]; } } $test = new Test(); $foo =& $test->foo(); $foo = 42; var_dump($test->values);
You have javascript disabled. You will not be able to edit any code.