(PHP 5, PHP 7)
Gets declaring class for the reflected method.
public ReflectionClass ReflectionMethod::getDeclaringClass ( void )
Gets the declaring class for the reflected method.
Returns:
A ReflectionClass object of the class that the reflected method is part of.
Examples:
ReflectionMethod::getDeclaringClass() example
1 2 3 4 5 6 7 8 9 10 11 12 | <?php class HelloWorld { protected function sayHelloTo( $name ) { return 'Hello ' . $name ; } } $reflectionMethod = new ReflectionMethod( new HelloWorld(), 'sayHelloTo' ); var_dump( $reflectionMethod ->getDeclaringClass()); ?> |
The above example will output:
object(ReflectionClass)#2 (1) { ["name"]=> string(10) "HelloWorld" }
See also:
Please login to continue.