Declaring Attribute Classes
While not strictly required it is recommended to create an actual class for every attribute.
In the most simple case only an empty class is needed with the Example #1 Simple Attribute Class
To restrict the type of declaration an attribute can be assigned to, a bitmask can be passed as the first
argument to the Example #2 Using target specification to restrict where attributes can be used
Declaring MyAttribute on another type will now throw an exception during the call to ReflectionAttribute::newInstance The following targets can be specified:
By default an attribute can only be used once per declaration. If the attribute should be repeatable on declarations it must
be specified as part of the bitmask to the Example #3 Using IS_REPEATABLE to allow attribute on a declaration multiple times
|