1--TEST-- 2ReflectionMethod::getDeclaringClass() 3--FILE-- 4<?php 5 6class A { 7 function foo() {} 8} 9 10class B extends A { 11 function bar() {} 12} 13 14$methodInfo = new ReflectionMethod('B', 'foo'); 15var_dump($methodInfo->getDeclaringClass()); 16 17$methodInfo = new ReflectionMethod('B', 'bar'); 18var_dump($methodInfo->getDeclaringClass()); 19 20?> 21--EXPECTF-- 22object(ReflectionClass)#%d (1) { 23 ["name"]=> 24 string(1) "A" 25} 26object(ReflectionClass)#%d (1) { 27 ["name"]=> 28 string(1) "B" 29} 30