Skip to content

Commit

Permalink
Move Finalizing section.
Browse files Browse the repository at this point in the history
  • Loading branch information
Crell committed Oct 30, 2023
1 parent d1a1aa9 commit 22cf48e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,10 @@ Note that if a multi-value sub-attribute is `Inheritable`, ancestor classes will

Note: In order to make use of multi-value sub-attributes, the attribute class itself must be marked as "repeatable" as in the example above or PHP will generate an error. However, that is not sufficient for the Analyzer to parse it as multi-value. That's because attributes may also be multi-value when implementing scopes, but still only single-value from the Analzyer's point of view. See the section on Scopes below.

### Finalizing an attribute

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."

### Caching

The main `Analyzer` class does no caching whatsoever. However, it implements a `ClassAnalyzer` interface which allows it to be easily wrapped in other implementations that provide a caching layer.
Expand All @@ -342,10 +346,6 @@ Wrappers may also compose each other, so the following would be an entirely vali
$analyzer = new MemoryCacheAnalyzer(new Psr6CacheAnalyzer(new Analyzer(), $psr6CachePool));
```

## Finalizing an attribute

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."

## Advanced features

There are a couple of other advanced features also available. These are less frequently used, but in the right circumstances they can be very helpful.
Expand Down

0 comments on commit 22cf48e

Please sign in to comment.