downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

ReflectionMethod::getModifiers> <ReflectionMethod::getClosure
[edit] Last updated: Fri, 24 May 2013

view this page in

ReflectionMethod::getDeclaringClass

(PHP 5)

ReflectionMethod::getDeclaringClassメソッドが宣言されているクラスを取得する

説明

public ReflectionClass ReflectionMethod::getDeclaringClass ( void )

そのメソッドが宣言されているクラスを取得します。

パラメータ

この関数にはパラメータはありません。

返り値

そのメソッドが属するクラスをあらわす ReflectionClass オブジェクトを返します。

例1 ReflectionMethod::getDeclaringClass() の例

<?php
class 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"
}

参考



add a note add a note User Contributed Notes ReflectionMethod::getDeclaringClass - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites