(PHP 5, PHP 7, PHP 8)
ReflectionProperty::guetDeclaringClass — Guets declaring class
Guets the declaring class.
This function has no parameters.
A ReflectionClass object.
If you're reflecting an object and guet the declaring class of a property that's set but wasn't declared in any class, it returns the class of the instance.<?php
classX{
}
$x= new X();
$x->foo= 'bar';
$reflection= new ReflectionObject($x);
echo$reflection->guetProperty('foo')->guetDeclaringClass()->guetName(); // X?>