« ReflectionMethod::setAccessible
ReflectionNamedType »

ReflectionMethod::__toString

(PHP 5, PHP 7, PHP 8)

ReflectionMethod::__toString — ReflectionMethod オブジェクトの文字列表現を返す

説明

public function ReflectionMethod::__toString(): string

ReflectionMethod オブジェクトの文字列表現を返します。

パラメータ

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

戻り値

ReflectionMethod のインスタンスの文字列表現を返します。

例

例1 ReflectionMethod::__toString() の例

<?php
class HelloWorld {

    public function sayHelloTo($name) {
        return 'Hello ' . $name;
    }

}

$reflectionMethod = new ReflectionMethod(new HelloWorld(), 'sayHelloTo');
echo $reflectionMethod;
?>

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

Method [ <user> public method sayHelloTo ] {
  @@ /var/www/examples/reflection.php 16 - 18

  - Parameters [1] {
    Parameter #0 [ <required> $name ]
  }
}

参考

関連キーワード:
ReflectionMethod   表現   toString   sayHelloTo   HelloWorld   reflectionMethod   setAccessible   ReflectionNamedType   インスタンス   return   Hello   Method   user   method   examples   reflection   Parameters   Parameter   required   参考   export   エクスポート
関連する関数・ページ:
reflectionmethod.export   reflectionmethod.getdeclaringclass   reflectionmethod.ispublic   reflectionmethod.invoke   reflectionmethod.hasprototype   reflectionmethod.getprototype