The Attribute attribute
The Attribute attribute
Attributes offer the ability to add structured, machine-readable metadata
information on declarations in code: Classes, methods, functions,
parameters, properties and class constants can be the target of an attribute.
The metadata defined by attributes can then be inspected at runtime using the
.
Attributes could therefore be thought of as a configuration language
embedded directly into code.
Reflection APIs
Attribute``int``Attribute::TARGET_CLASS``int``Attribute::TARGET_FUNCTION``int``Attribute::TARGET_METHOD``int``Attribute::TARGET_PROPERTY``int``Attribute::TARGET_CLASS_CONSTANT``int``Attribute::TARGET_PARAMETER``int``Attribute::TARGET_CONSTANT``int``Attribute::TARGET_ALL``int``Attribute::IS_REPEATABLE``int``flags``Attribute::TARGET_CLASS
Attribute::TARGET_FUNCTION
Attribute::TARGET_METHOD
Attribute::TARGET_PROPERTY
Attribute::TARGET_CLASS_CONSTANT
Attribute::TARGET_PARAMETER
Attribute::TARGET_CONSTANT
Attribute::TARGET_ALL
Attribute::IS_REPEATABLE
flags
Attributes overview