php-src/Zend/tests/property_hooks/hooked_with_magic_method.phpt
Ilija Tovilo 780a8280d2
[RFC] Property hooks (#13455)
RFC: https://wiki.php.net/rfc/property-hooks

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2024-07-14 11:55:03 +02:00

28 lines
451 B
PHP

--TEST--
Access hooked property from magic method
--FILE--
<?php
class Test {
private $prop {
get { echo __METHOD__, "\n"; return 42; }
set { echo __METHOD__, "\n"; }
}
public function __get($name) {
return $this->{$name};
}
public function __set($name, $value) {
$this->{$name} = $value;
}
}
$test = new Test;
$test->prop;
$test->prop = 42;
?>
--EXPECT--
Test::$prop::get
Test::$prop::set