ReflectionFunctionAbstract::getAttributes Gets Attributes &reftitle.description; public arrayReflectionFunctionAbstract::getAttributes stringnullname&null; intflags0 Returns all attributes declared on this function or method as an array of ReflectionAttribute. &reftitle.parameters; &reflection.getattributes.param.name; &reflection.getattributes.param.flags; &reftitle.returnvalues; Array of attributes, as a ReflectionAttribute object. &reftitle.examples; Basic usage with a class method getAttributes(); print_r(array_map(fn($attribute) => $attribute->getName(), $attributes)); ?> ]]> &example.outputs; Fruit [1] => Red ) ]]> Basic usage with a function getAttributes(); print_r(array_map(fn($attribute) => $attribute->getName(), $attributes)); ?> ]]> &example.outputs; Fruit [1] => Red ) ]]> Filtering results by class name getAttributes('Fruit'); print_r(array_map(fn($attribute) => $attribute->getName(), $attributes)); ?> ]]> &example.outputs; Fruit ) ]]> Filtering results by class name, with inheritance getAttributes('Color', ReflectionAttribute::IS_INSTANCEOF); print_r(array_map(fn($attribute) => $attribute->getName(), $attributes)); ?> ]]> &example.outputs; Red ) ]]> &reftitle.seealso; ReflectionClass::getAttributes ReflectionClassConstant::getAttributes ReflectionParameter::getAttributes ReflectionProperty::getAttributes