PHPLIB-1624 Generate typed value classes for nested operator arguments#1886
Draft
GromNaN wants to merge 3 commits intomongodb:v2.xfrom
Draft
PHPLIB-1624 Generate typed value classes for nested operator arguments#1886GromNaN wants to merge 3 commits intomongodb:v2.xfrom
GromNaN wants to merge 3 commits intomongodb:v2.xfrom
Conversation
Generate dedicated final type classes in MongoDB\Builder\Type\ for operator arguments with sub-fields (e.g., RankFusionInput, RankFusionCombination, ScoreFusionInput, ScoreFusionCombination). - Each type class implements TypeInterface and carries a PROPERTIES constant - TypeEncoder (registered in BuilderEncoder) handles serialization, skipping Optional::Undefined properties - Operator constructors auto-convert plain arrays to the type class via spread (e.g., new RankFusionInput(...$input)) for ergonomic usage - buildPropertyAndParam() helper in OperatorClassGenerator now handles all argument patterns (non-variadic, variadic:object, variadic:array), eliminating duplication between createClass() and createArgumentTypeClass()
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## v2.x #1886 +/- ##
============================================
- Coverage 87.75% 87.33% -0.42%
- Complexity 3308 3342 +34
============================================
Files 447 455 +8
Lines 6607 6682 +75
============================================
+ Hits 5798 5836 +38
- Misses 809 846 +37
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on mongodb/mql-specifications#33
Generates dedicated
finaltype classes inMongoDB\Builder\Type\for operator arguments with nested sub-fields (YAMLarguments:key), replacing ad-hocarray|stdClassparameters with properly-typed value objects (e.g.RankFusionInput,RankFusionCombination,ScoreFusionInput,ScoreFusionCombination).TypeInterface(new marker interface) and exposes aPROPERTIESconstantTypeEncoderregistered inBuilderEncoderto serialize these objects, skippingOptional::Undefinedpropertiesnew RankFusionInput(...$input)) for ergonomic API usagebuildPropertyAndParam()inOperatorClassGeneratorto handle all argument patterns (non-variadic, variadic:object map, variadic:array list), eliminating the duplicated logic betweencreateClass()andcreateArgumentTypeClass()