PHPLIB-1715: Support string to array conversion#1915
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds builder support and corresponding test fixtures for MongoDB 8.3’s $toArray (including string→array conversion) and $toObject (string→object conversion) aggregation expression operators, aligning the fluent Expression::* API with newly documented server features.
Changes:
- Introduces new auto-generated expression operator classes:
ToArrayOperatorandToObjectOperator. - Adds
Expression::toArray()andExpression::toObject()factory methods (viaFactoryTrait). - Adds pipeline fixture JSON and PHPUnit tests covering string conversion examples for both operators.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Builder/Expression/ToObjectOperatorTest.php | Adds a pipeline test for $toObject string→object conversion. |
| tests/Builder/Expression/ToArrayOperatorTest.php | Adds pipeline tests for $toArray (BinData→array and string→array). |
| tests/Builder/Expression/Pipelines.php | Adds expected JSON fixtures for $toArray string conversion and $toObject string conversion. |
| src/Builder/Expression/ToObjectOperator.php | Adds the $toObject operator class (auto-generated). |
| src/Builder/Expression/ToArrayOperator.php | Adds the $toArray operator class (auto-generated). |
| src/Builder/Expression/FactoryTrait.php | Exposes toArray() and toObject() factory methods on Expression. |
| psalm-baseline.xml | Removes an unused baseline suppression for NoDiscard attributes. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
kevinAlbs
approved these changes
Jun 3, 2026
bbccc71 to
24023c3
Compare
GromNaN
reviewed
Jun 8, 2026
GromNaN
approved these changes
Jun 8, 2026
GromNaN
approved these changes
Jun 9, 2026
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.
Part of DRIVERS-3273
Fix PHPLIB-1715