Since: 8.0

class ReflectionAttribute implements Reflector (View source)

The ReflectionAttribute class provides information about an Attribute.

Constants

IS_INSTANCEOF Since: 8.0

Indicates that the search for a suitable attribute should not be by strict comparison, but by the inheritance chain.

Used for the argument of flags of the "getAttribute" method.

Properties

string $name

Methods

string
getName()

Gets attribute name

int
getTarget()

Returns the target of the attribute as a bit mask format.

string
getNamespaceName()

Gets the namespace name of the attribute

string
getShortName()

Gets the short name of the attribute, without the namespace part

bool
inNamespace()

Checks if the attribute is defined in a namespace

bool
isRepeated()

Returns {true} if the attribute is repeated.

array
getArguments()

Gets list of passed attribute's arguments.

object
newInstance()

Creates a new instance of the attribute with passed arguments

string
__toString()

No description

Details

string getName()

Since: 8.0

Gets attribute name

Return Value

string

The name of the attribute parameter.

int getTarget()

Since: 8.0

Returns the target of the attribute as a bit mask format.

Return Value

int

Gets target of the attribute as bitmask of Attribute::TARGET_* constants.

string getNamespaceName()

Since: 8.6

Gets the namespace name of the attribute

Return Value

string

The namespace name.

string getShortName()

Since: 8.6

Gets the short name of the attribute, without the namespace part

Return Value

string

The short name.

bool inNamespace()

Since: 8.6

Checks if the attribute is defined in a namespace

Return Value

bool

Returns true if the attribute name contains a namespace, false otherwise.

bool isRepeated()

Since: 8.0

Returns {true} if the attribute is repeated.

Return Value

bool

Returns true when attribute is used repeatedly, otherwise false.

array getArguments()

Since: 8.0

Gets list of passed attribute's arguments.

Return Value

array

The arguments passed to attribute.

object newInstance()

Since: 8.0

Creates a new instance of the attribute with passed arguments

Return Value

object

New instance of the attribute.

string __toString()

Since: 8.1

No description

Return Value

string

Returns string representation of the object that implements this interface (and/or "__toString" magic method).