1--TEST-- 2ReflectionClass::getHook() inheritance 3--FILE-- 4<?php 5 6class A { 7 public $foo { 8 get { 9 return 'A::$foo::get'; 10 } 11 set { 12 echo "A::\$foo::set\n"; 13 } 14 } 15} 16 17class B extends A { 18 public $foo { 19 get { 20 return 'B::$foo'; 21 } 22 } 23} 24 25$a = new A(); 26$b = new B(); 27 28echo ((new ReflectionProperty(A::class, 'foo'))->getHook(PropertyHookType::Get)->invoke($a)), "\n"; 29echo ((new ReflectionProperty(A::class, 'foo'))->getHook(PropertyHookType::Get)->invoke($b)), "\n"; 30echo ((new ReflectionProperty(B::class, 'foo'))->getHook(PropertyHookType::Get)->invoke($b)), "\n"; 31 32((new ReflectionProperty(A::class, 'foo'))->getHook(PropertyHookType::Set)->invoke($a, null)); 33((new ReflectionProperty(A::class, 'foo'))->getHook(PropertyHookType::Set)->invoke($b, null)); 34((new ReflectionProperty(B::class, 'foo'))->getHook(PropertyHookType::Set)->invoke($b, null)); 35 36?> 37--EXPECT-- 38A::$foo::get 39A::$foo::get 40B::$foo 41A::$foo::set 42A::$foo::set 43A::$foo::set 44