ReflectionMethod::createFromMethodName

ReflectionMethod を作成する

説明

public static static ReflectionMethod::createFromMethodName(string $method)

新しい ReflectionMethod を作成します。

パラメータ

method

:: で区切られたクラス名とメソッド名。

戻り値

成功した場合、新しい ReflectionMethod を返します。

エラー / 例外

指定したメソッドが存在しない場合は、 ReflectionException がスローされます。

例1 ReflectionMethod::createFromMethodName の例

<?php

class Foo {
    public function 
bar() {

    }
}

$methodInfo ReflectionMethod::createFromMethodName("Foo::bar");
var_dump($methodInfo);
?>

上の例の出力は以下となります。

object(ReflectionMethod)#1 (2) {
  ["name"]=>
  string(3) "bar"
  ["class"]=>
  string(3) "Foo"
}