ReflectionProperty::getDocComment
(PHP 5 >= 5.1.0, PHP 7)
ReflectionProperty::getDocComment — プロパティのドキュメントコメントを取得する
説明
public ReflectionProperty::getDocComment
( void
) : string
プロパティのドキュメントコメントを取得します。
パラメータ
この関数にはパラメータはありません。
返り値
プロパティのドキュメントコメントを返します。
例
例1 ReflectionProperty::getDocComment() の例
<?php
class Str
{
/**
* @var int The length of the string
*/
public $length = 5;
}
$prop = new ReflectionProperty('Str', 'length');
var_dump($prop->getDocComment());
?>
上の例の出力は、 たとえば以下のようになります。
string(53) "/**
* @var int The length of the string
*/"
参考
- ReflectionProperty::getModifiers() - Gets the property modifiers
- ReflectionProperty::getName() - プロパティ名を取得する
- ReflectionProperty::getValue() - 値を取得する