1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/property_hooks/interface_get_by_ref_virtual.phpt
2024-07-14 11:55:03 +02:00

32 lines
396 B
PHP

--TEST--
Virtual prop satisfies interface get hook by-reference
--FILE--
<?php
interface I {
public $prop { &get; }
}
class A implements I {
private $_prop;
public $prop {
&get => $this->_prop;
}
}
function test(I $i) {
$ref = &$i->prop;
$ref = 42;
}
$a = new A();
test($a);
var_dump($a);
?>
--EXPECT--
object(A)#1 (1) {
["_prop":"A":private]=>
int(42)
}