Commit 53854b1
committed
Add AssuranceTypeMapper for IDE-readable type narrowing
Generate IDE-readable narrowing PHPDoc from a node's #[Assurance] /
fluent mixins narrow types after assert()/check() without a PHPStan extension.
- New AssuranceTypeMapper maps each assurance shape to a Chain<T> generic:
concrete types, the argument-derived forms (from: Value -> @param T;
from: TypeString -> @param class-string<T>), element forms, Container
subjects, and the Wrap/Container/Elements prefix compositions (with union
de-duplication). #[AssuranceParameter] selects which argument carries the
type (any position, default first) -- it no longer implies class-string;
`from` decides the derivation. Argument-wrapping forms stay Chain<mixed> to
avoid retyping Validator parameters to Chain<T> (which would reject raw,
non-fluent validators).
- New NarrowingDoc and TerminalMethod value objects; InterfaceConfig gains
emitNarrowing / chainType / templateParam / terminalMethods, threaded
through MethodBuilder and MixinGenerator.
- Unit coverage per bucket plus a MixinGenerator narrowing integration test.1 parent 6a90655 commit 53854b1
28 files changed
Lines changed: 1343 additions & 149 deletions
File tree
- src/Fluent
- tests
- Fixtures/Assurance
- Unit/Fluent
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
| |||
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | | - | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
53 | 60 | | |
54 | 61 | | |
0 commit comments