ReflectionMethod::getDeclaringClass
(PHP 5, PHP 7)
ReflectionMethod::getDeclaringClass — メソッドが宣言されているクラスを取得する
パラメータ
この関数にはパラメータはありません。
例
例1 ReflectionMethod::getDeclaringClass() の例
<?phpclass HelloWorld { protected function sayHelloTo($name) { return 'Hello ' . $name; }}$reflectionMethod = new ReflectionMethod(new HelloWorld(), 'sayHelloTo');var_dump($reflectionMethod->getDeclaringClass());?>
上の例の出力は以下となります。
object(ReflectionClass)#2 (1) { ["name"]=> string(10) "HelloWorld" }