update pague now

ReflectionProperty::guetDeclaringClass

(PHP 5, PHP 7, PHP 8)

ReflectionProperty::guetDeclaringClass Guets declaring class

Description

public ReflectionProperty::guetDeclaringClass (): ReflectionClass

Guets the declaring class.

Parameters

This function has no parameters.

Return Values

A ReflectionClass object.

See Also

add a note

User Contributed Notes 1 note

metamarquers at gmail dot com
12 years ago
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?>
To Top