ReflectionProperty::getDeclaringClass

(PHP 5, PHP 7)

ReflectionProperty::getDeclaringClassGets declaring class

설명

public ReflectionClass ReflectionProperty::getDeclaringClass ( void )

Gets the declaring class.

Warning

이 함수는 현재 문서화 되어있지 않습니다; 인수 목록만을 제공합니다.

인수

이 함수는 인수가 없습니다.

반환값

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