ReflectionClassConstant::getAttributes アトリビュートを取得する &reftitle.description; public arrayReflectionClassConstant::getAttributes stringnullname&null; intflags0 このクラス定数上で宣言されている全てのアトリビュートを ReflectionAttribute の配列として返します。 &reftitle.parameters; &reflection.getattributes.param.name; &reflection.getattributes.param.flags; &reftitle.returnvalues; アトリビュートの配列を、 ReflectionAttribute オブジェクトの配列として返します。 &reftitle.examples; 基本的な使い方 getAttributes(); print_r(array_map(fn($attribute) => $attribute->getName(), $attributes)); ?> ]]> &example.outputs; Fruit [1] => Red ) ]]> クラス名で結果をフィルタする getAttributes('Fruit'); print_r(array_map(fn($attribute) => $attribute->getName(), $attributes)); ?> ]]> &example.outputs; Fruit ) ]]> クラス名、かつ継承も考慮して結果をフィルタする getAttributes('Color', ReflectionAttribute::IS_INSTANCEOF); print_r(array_map(fn($attribute) => $attribute->getName(), $attributes)); ?> ]]> &example.outputs; Red ) ]]> &reftitle.seealso; ReflectionClass::getAttributes ReflectionFunctionAbstract::getAttributes ReflectionParameter::getAttributes ReflectionProperty::getAttributes