ReflectionAttribute::getArguments

(PHP 8)

ReflectionAttribute::getArguments — Gets the arguments passed to the attribute

Description

public function ReflectionAttribute::getArguments(): array

Gets the arguments passed to the attribute.

The arguments are constant expressions and are evaluated when this method is called. Evaluating an argument may autoload a class referenced by the expression, for example through a class constant, an enum case, or an object created with new. Reading the arguments does not require the attribute class to exist or validate them against the constructor.

Parameters

This function has no parameters.

Return Values

The arguments passed to the attribute, with integer keys for positional arguments and string keys for named arguments.

Errors/Exceptions

If evaluating an argument throws an error or exception, it is propagated. This can happen when the argument references a class that cannot be loaded, or a constant that is not defined.