« ReflectionMethod::getPrototype
ReflectionMethod::invoke »

ReflectionMethod::hasPrototype

(PHP 8 >= 8.2.0)

ReflectionMethod::hasPrototype — メソッドがプロトタイプを持つかを調べる

説明

public function ReflectionMethod::hasPrototype(): bool

メソッドがプロトタイプを持つかを返します。

パラメータ

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

戻り値

メソッドがプロトタイプを持つ場合、true を返します。そうでない場合、false を返します。

例

例1 ReflectionMethod::hasPrototype() の例

<?php

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

class HelloWorld extends Hello
{
    public function sayHelloTo($name)
    {
        return 'Hello world: '.$name;
    }
}
$reflectionMethod = new ReflectionMethod('HelloWorld', 'sayHelloTo');
var_dump($reflectionMethod->hasPrototype());
?>

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

bool(true)

参考

関連キーワード:
ReflectionMethod   プロトタイプ   hasPrototype   Hello   sayHelloTo   getPrototype   return   HelloWorld   reflectionMethod   invoke   extends   world   dump   参考
関連する関数・ページ:
reflectionmethod.getprototype   reflectionmethod.tostring   reflectionmethod.invoke   reflectionmethod.getdeclaringclass   reflectionmethod.ispublic   reflectionmethod.invokeargs