(PHP 5)
ReflectionProperty::getDeclaringClass — Gets declaring class
Gets the declaring class.
本函数还未编写文档,仅有参数列表。
此函数没有参数。
A ReflectionClass object.
metamarkers at gmail dot com (2013-05-17 06:30:47)
If you're reflecting an object and get the declaring class of a property that's set but wasn't declared in any class, it returns the class of the instance.
<?php
class X {
}
$x = new X();
$x->foo = 'bar';
$reflection = new ReflectionObject($x);
echo $reflection->getProperty('foo')->getDeclaringClass()->getName(); // X
?>