GoLang ReflectionMethod::getDeclaringClass

request it (263)
GoLang replacement for PHP's ReflectionMethod::getDeclaringClass [edit | history]



Do you know a GoLang replacement for PHP's ReflectionMethod::getDeclaringClass? Write it!

PHP ReflectionMethod::getDeclaringClass

PHP original manual for ReflectionMethod::getDeclaringClass [ show | php.net ]

ReflectionMethod::getDeclaringClass

(PHP 5, PHP 7)

ReflectionMethod::getDeclaringClassGets declaring class for the reflected method

Description

public ReflectionClass ReflectionMethod::getDeclaringClass ( void )

Gets the declaring class for the reflected method.

Parameters

This function has no parameters.

Return Values

A ReflectionClass object of the class that the reflected method is part of.

Examples

Example #1 ReflectionMethod::getDeclaringClass() example

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