プロパティの型を取得する
プロパティに関連付けられた型を取得する
この関数にはパラメータはありません。
プロパティが型を持っていれば、ReflectionType を返します。そうでなければ、 null を返します。
null
例1 ReflectionProperty::getType の例
<?phpclass User{ public string $name;}$rp = new ReflectionProperty('User', 'name');echo $rp->getType()->getName();?>
上の例の出力は以下となります。
string