PHP 8.3.4 Released!

ReflectionProperty::getDeclaringClass

(PHP 5, PHP 7, PHP 8)

ReflectionProperty::getDeclaringClassBildiren sınıfı döndürür

Açıklama

public ReflectionProperty::getDeclaringClass(): ReflectionClass

Bildiren sınıfı döndürür.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

Bir ReflectionClass nesnesi.

Ayrıca Bakınız

add a note

User Contributed Notes 1 note

up
7
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