ReflectionParameter クラス

はじめに

ReflectionParameter クラスは、 関数またはメソッドのパラメータに関する情報を取得します。

関数パラメータの内部を調べる際には、まず ReflectionFunction クラスまたは ReflectionMethod クラスのインスタンスを作成する必要があります。次に、 ReflectionFunctionAbstract::getParameters メソッドを使ってパラメータの配列を取得します。

クラス概要

ReflectionParameter
implements Reflector
/* プロパティ */
public string $name;
/* メソッド */
public __construct(stringarrayobject $function, intstring $param)
public bool allowsNull()
public bool canBePassedByValue()
private void __clone()
public static string export(string $function, string $parameter, bool $return = ?)
public array getAttributes(stringnull $name = null, int $flags = 0)
#[\Deprecated] public ReflectionClassnull getClass()
public ReflectionClassnull getDeclaringClass()
public ReflectionFunctionAbstract getDeclaringFunction()
public mixed getDefaultValue()
public stringnull getDefaultValueConstantName()
public string getName()
public int getPosition()
public ReflectionTypenull getType()
public bool hasType()
#[\Deprecated] public bool isArray()
#[\Deprecated] public bool isCallable()
public bool isDefaultValueAvailable()
public bool isDefaultValueConstant()
public bool isOptional()
public bool isPassedByReference()
public bool isPromoted()
public bool isVariadic()
public string __toString()

プロパティ

name

パラメータ名。読み込み専用で、書き込もうとすると ReflectionException をスローします。

変更履歴

バージョン 説明
8.0.0 ReflectionParameter::export は、削除されました。
目次