Skip to content

Commit 53854b1

Browse files
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

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* export-ignore
2+
3+
# Project files
4+
/README.md -export-ignore
5+
/composer.json -export-ignore
6+
/src -export-ignore
7+
8+
# SBOM information
9+
/LICENSE -export-ignore
10+
/LICENSES -export-ignore
11+
/REUSE.toml -export-ignore

composer.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"keywords": ["respect", "fluentgen", "mixin", "fluent"],
55
"type": "library",
66
"license": "ISC",
7+
"minimum-stability": "dev",
8+
"prefer-stable": true,
79
"authors": [
810
{
911
"name": "Respect/FluentGen Contributors",
@@ -20,7 +22,7 @@
2022
"phpstan/phpstan-strict-rules": "^2.0",
2123
"phpunit/phpunit": "^12.5",
2224
"respect/coding-standard": "^5.0",
23-
"respect/fluent": "^2.0"
25+
"respect/fluent": "3.0.x-dev"
2426
},
2527
"suggest": {
2628
"respect/fluent": "Enables #[Composable] prefix composition support"
@@ -50,5 +52,10 @@
5052
"allow-plugins": {
5153
"dealerdirect/phpcodesniffer-composer-installer": true
5254
}
55+
},
56+
"extra": {
57+
"branch-alias": {
58+
"dev-ide-narrowing": "2.1.x-dev"
59+
}
5360
}
5461
}

0 commit comments

Comments
 (0)