1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
--TEST--
ReflectionProperty::getHooks()
--FILE--
<?php
class Test {
public $prop1;
public $prop2 { get {} set {} }
public $prop3 { get {} }
public $prop4 { set {} }
}
for ($i = 1; $i <= 4; $i++) {
$rp = new ReflectionProperty(Test::class, 'prop' . $i);
var_dump($rp->hasHooks());
var_dump($rp->getHooks());
}
?>
--EXPECT--
bool(false)
array(0) {
}
bool(true)
array(2) {
["get"]=>
object(ReflectionMethod)#1 (2) {
["name"]=>
string(11) "$prop2::get"
["class"]=>
string(4) "Test"
}
["set"]=>
object(ReflectionMethod)#3 (2) {
["name"]=>
string(11) "$prop2::set"
["class"]=>
string(4) "Test"
}
}
bool(true)
array(1) {
["get"]=>
object(ReflectionMethod)#2 (2) {
["name"]=>
string(11) "$prop3::get"
["class"]=>
string(4) "Test"
}
}
bool(true)
array(1) {
["set"]=>
object(ReflectionMethod)#3 (2) {
["name"]=>
string(11) "$prop4::set"
["class"]=>
string(4) "Test"
}
}
|