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