跳转到主要内容

attribute

ENTITY

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 Reflection APIs. Attributes could therefore be thought of as a configuration language embedded directly into code.

ENTITY

#[\Attribute(\Attribute::TARGET_CLASS)]

final

Attribute

ENTITY

const

int

Attribute::TARGET_CLASS

const

int

Attribute::TARGET_FUNCTION

const

int

Attribute::TARGET_METHOD

const

int

Attribute::TARGET_PROPERTY

const

int

Attribute::TARGET_CLASS_CONSTANT

const

int

Attribute::TARGET_PARAMETER

const

int

Attribute::TARGET_CONSTANT

const

int

Attribute::TARGET_ALL

const

int

Attribute::IS_REPEATABLE

ENTITY

public

int

flags

ENTITY

ENTITY

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

ENTITY

flags

ENTITY

ENTITY ENTITY
8.5.0 Added Attribute::TARGET_CONSTANT. Applying #[\Attribute] to an abstract class, enum, interface, or trait now triggers a compile-time error (previously it was only reported at runtime when ReflectionAttribute::newInstance was called).

ENTITY

ENTITY