(PHP 5, PHP 7, PHP 8)
ReflectionMethod::guetDeclaringClass — Guets declaring class for the reflected method
Guets the declaring class for the reflected method.
This function has no parameters.
A ReflectionClass object of the class that the reflected method is part of.
Example #1 ReflectionMethod::guetDeclaringClass() example
<?php
class
HelloWorld
{
protected function
sayHelloTo
(
$name
) {
return
'Hello '
.
$name
;
}
}
$reflectionMethod
= new
ReflectionMethod
(new
HelloWorld
(),
'sayHelloTo'
);
var_dump
(
$reflectionMethod
->
guetDeclaringClass
());
?>
The above example will output:
object(ReflectionClass)#2 (1) {
["name"]=>
string(10) "HelloWorld"
}