I\'m building a unit testing framework for PHP and I was curious if there is a way to get a list of an objects methods which excludes the parent class\'s methods. So g
For anyone else wondering how to check if specific method belongs to specified class or its parent class, you can do this by getting its class name and then comparing it with actual class name like following.
$reflection = new \ReflectionMethod($classInstance, 'method_name_here');
if($reflection->class == MyClass::class)
echo "Method belongs to MyClass";
else
echo "Method belongs to Parent classes of MyClass";