ReflectionProperty::hasType

プロパティが型を持つかをチェックする

説明

public bool ReflectionProperty::hasType()

プロパティが、自身に関連付けられた型を持つかをチェックします。

パラメータ

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

戻り値

型が指定されていれば true そうでなければ false

例1 ReflectionProperty::hasType の例

<?php
class User
{
    public 
string $name;
}

$rp = new ReflectionProperty('User''name');
var_dump($rp->hasType());
?>

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

bool(true)

参考

  • ReflectionProperty::getType
  • ReflectionProperty::isInitialized