ReflectionProperty::getDeclaringClass

(PHP 5)

ReflectionProperty::getDeclaringClassGets declaring class

Опис

public ReflectionClass ReflectionProperty::getDeclaringClass ( void )

Gets the declaring class.

Увага

This function is currently not documented; only its argument list is available.

Параметри

В цієї функції немає параметрів.

Значення, що повертаються

A ReflectionClass object.

Прогляньте Також

add a note add a note

User Contributed Notes 1 note

up
5
metamarkers at gmail dot com
10 years ago
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

?>
To Top