Skip to content

Commit 10d894a

Browse files
committed
Integrate Fluent, FluentGen and FluentAnalysis
Replace the internal code generation and builder infrastructure with Respect/Fluent for runtime method resolution, Respect/FluentGen for mixin interface generation, and Respect/FluentAnalysis for PHPStan type narrowing. ValidatorBuilder now extends Fluent's Append builder with ComposableMap for prefix composition at runtime. Each validator is annotated with: - #[Assurance] declaring the type it narrows to (100+ validators) - #[AssuranceParameter] on constructor params used for dynamic type resolution (Instance) - #[Composable] with class-string references for prefix composition constraints (Not, All, Key, Property, NullOr, UndefOr, Min, Max, Length, and 29 validators with with/without constraints) - #[ComposableParameter] on promoted prefix parameters (Key, Property) Removes the internal CodeGen infrastructure (MethodBuilder, MixinGenerator, PrefixMapGenerator, etc.) in favor of FluentGen. Adds type inference tests validating PHPStan narrowing for type validators, val variants, composites (allOf, anyOf, oneOf, noneOf, when), modifiers (not, nullOr, undefOr), element narrowing (each, all), value/member narrowing (identical, in), parameter narrowing (instance), and chain intersection.
1 parent ab992b4 commit 10d894a

179 files changed

Lines changed: 3423 additions & 1013 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@
1414

1515
# Simplify diffs
1616
src/Mixins/** linguist-generated=true
17+
fluent.neon linguist-generated=true

REUSE.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version = 1
22

33
[[annotations]]
4-
path = [ "*.yml", "*.yaml", ".git*", "*.dist", "docs/.pages", "docs/validators/.pages", "composer.json", "composer.lock", "tests/fixtures/*", ".github/*.yml", ".github/actions/**.yml", ".github/workflows/**.yml", ".github/PULL_REQUEST_TEMPLATE.md", ".github/ISSUE_TEMPLATE/**" ]
4+
path = [ "fluent.neon", "*.yml", "*.yaml", ".git*", "*.dist", "docs/.pages", "docs/validators/.pages", "composer.json", "composer.lock", "tests/fixtures/*", ".github/*.yml", ".github/actions/**.yml", ".github/workflows/**.yml", ".github/PULL_REQUEST_TEMPLATE.md", ".github/ISSUE_TEMPLATE/**" ]
55
SPDX-FileCopyrightText = "Respect Project Contributors"
66
SPDX-License-Identifier = "MIT"

composer.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"php": ">=8.5",
2424
"php-di/php-di": "^7.1",
2525
"psr/container": "^2.0",
26+
"respect/fluent": "^2.0",
2627
"respect/string-formatter": "^1.7",
2728
"respect/stringifier": "^3.0",
2829
"symfony/polyfill-intl-idn": "^1.33",
@@ -36,13 +37,15 @@
3637
"pestphp/pest": "^4.2",
3738
"phpbench/phpbench": "^1.4",
3839
"phpstan/extension-installer": "^1.4",
39-
"phpstan/phpstan": "^2.0",
40+
"phpstan/phpstan": "^2.1",
4041
"phpstan/phpstan-deprecation-rules": "^2.0",
4142
"phpstan/phpstan-phpunit": "^2.0",
4243
"phpunit/phpunit": "^12.5",
4344
"psr/http-message": "^1.0 || ^2.0",
4445
"ramsey/uuid": "^4",
4546
"respect/coding-standard": "^5.0",
47+
"respect/fluent-analysis": "^1.0",
48+
"respect/fluentgen": "^2.0",
4649
"sebastian/diff": "^7.0",
4750
"sokil/php-isocodes": "^4.2.1",
4851
"sokil/php-isocodes-db-only": "^4.0",
@@ -71,7 +74,8 @@
7174
"psr-4": {
7275
"Respect\\Dev\\": "src-dev/",
7376
"Respect\\Validation\\": "tests/unit/",
74-
"Respect\\Validation\\Test\\": "tests/src/"
77+
"Respect\\Validation\\Test\\": "tests/src/",
78+
"Respect\\Validation\\Test\\Inference\\": "tests/inference/"
7579
}
7680
},
7781
"scripts": {
@@ -84,6 +88,7 @@
8488
"phpcs": "vendor/bin/phpcs",
8589
"phpstan": "vendor/bin/phpstan analyze",
8690
"phpunit": "vendor/bin/phpunit --testsuite=unit",
91+
"inference": "vendor/bin/phpunit --testsuite=inference",
8792
"smoke-complete": "bin/console smoke-tests:check-complete",
8893
"spdx-lint": "bin/console lint:spdx",
8994
"qa": [
@@ -92,6 +97,7 @@
9297
"@phpstan",
9398
"@phpunit",
9499
"@pest",
100+
"@inference",
95101
"@docs",
96102
"@smoke-complete"
97103
]

0 commit comments

Comments
 (0)