|
6 | 6 |
|
7 | 7 | AttributeUtils provides utilities to simplify working with and reading Attributes in PHP 8.1 and later. |
8 | 8 |
|
9 | | -Its primary tool is the Class Analyzer, which allows you to analyze a given class or enum with respect to some attribute class. Attribute classes may implement various interfaces in order to opt-in to additional behavior, as described below. The overall intent is to provide a simple but powerful framework for reading metadata off of a class, including with reflection data. |
| 9 | +Its primary tool is the Class Analyzer, which allows you to analyze a given class or enum with respect to some attribute class. Attribute classes may implement various interfaces in order to opt in to additional behavior, as described below. The overall intent is to provide a simple but powerful framework for reading metadata off of a class, including with reflection data. |
10 | 10 |
|
11 | 11 | ## Install |
12 | 12 |
|
@@ -83,7 +83,7 @@ There are similarly [`FromReflectionProperty`](src/FromReflectionProperty.php), |
83 | 83 |
|
84 | 84 | ### Additional class components |
85 | 85 |
|
86 | | -The class attribute may also opt-in to analyzing various portions of the class, such as its properties, methods, and constants. It does so by implementing the [`ParseProperties`](src/ParseProperties.php), [`ParseStaticProperties`](src/ParseStaticProperties.php), [`ParseMethods`](src/ParseMethods.php), [`ParseStaticMethods`](src/ParseStaticMethods.php), or [`ParseClassConstants`](src/ParseClassConstants.php) interfaces, respectively. They all work the same way, so we'll look at properties in particular. |
| 86 | +The class attribute may also opt in to analyzing various portions of the class, such as its properties, methods, and constants. It does so by implementing the [`ParseProperties`](src/ParseProperties.php), [`ParseStaticProperties`](src/ParseStaticProperties.php), [`ParseMethods`](src/ParseMethods.php), [`ParseStaticMethods`](src/ParseStaticMethods.php), or [`ParseClassConstants`](src/ParseClassConstants.php) interfaces, respectively. They all work the same way, so we'll look at properties in particular. |
87 | 87 |
|
88 | 88 | An example is the easiest way to explain it: |
89 | 89 |
|
@@ -299,7 +299,7 @@ An attribute may have any number of sub-attributes it wishes. |
299 | 299 |
|
300 | 300 | Note that if the sub-attribute is missing, `null` will be passed to the method. That is to allow a sub-attribute to have required parameters if and only if it is specified, while keeping the sub-attribute itself optional. You therefore *must* make the callback method's argument nullable. |
301 | 301 |
|
302 | | -Sub-attributes may also be `Inheritable`. |
| 302 | +Sub-attributes may also be `Inheritable`, and may also implement the various `FromReflection*` interfaces. |
303 | 303 |
|
304 | 304 | ### Multi-value sub-attributes |
305 | 305 |
|
@@ -352,7 +352,7 @@ Note: In order to make use of multi-value sub-attributes, the attribute class it |
352 | 352 |
|
353 | 353 | ### Finalizing an attribute |
354 | 354 |
|
355 | | -Attributes that opt-in to several functional interfaces may not always have an easy time of knowing when to do default handling. It may not be obvious when the attribute setup is "done." Attribute classes may therefore opt-in to the [`Finalizable`](src/Finalizable.php) interface. If specified, it is guaranteed to be the last method called on the attribute. The attribute may then do whatever final preparation is appropriate to consider the object "ready." |
| 355 | +Attributes that opt-in to several functional interfaces may not always have an easy time of knowing when to do default handling. It may not be obvious when the attribute setup is "done." Attribute classes may therefore opt in to the [`Finalizable`](src/Finalizable.php) interface. If specified, it is guaranteed to be the last method called on the attribute. The attribute may then do whatever final preparation is appropriate to consider the object "ready." |
356 | 356 |
|
357 | 357 | ### Caching |
358 | 358 |
|
|
0 commit comments