Conversation
Addresses both single-statement updates and bulk writes. * Require PHPC 1.21-dev for CI builds
…ion builder (#1610) * PHPLIB-1634: Support encoding DateTimeInterface instances in aggregation builder * Sort types correctly * Accept DateTimeInterface for query objects * Add missing psalm annotation * Use BSON Type class instead of UTCDateTime * Update psalm baseline
…a class string (#1608) BuilderEncoder accepts an instance of encoder instead of a class string Remove AbstractExpressionEncoder and ExpressionEncoder interface
Use weak reference to prevent circular reference Avoid having the same encoder initialized multiple times
| $encoded = []; | ||
| foreach ($value->getIterator() as $stage) { | ||
| $encoded[] = $this->encoder->encodeIfSupported($stage); | ||
| $encoded[] = $this->recursiveEncode($stage); |
There was a problem hiding this comment.
I can't explain. I think this is a GitHub behavior that show the error only the first time it appears.
| return $value instanceof FieldPathInterface; | ||
| } | ||
|
|
||
| public function encode(mixed $value): mixed |
There was a problem hiding this comment.
Adding a mixed return type seems necessary to address the following error in some CI builds:
Fatal error: Declaration of MongoDB\Codec\Encoder@anonymous::encode(mixed $value) must be compatible with MongoDB\Codec\EncodeIfSupported::encode(mixed $value): mixed in .../src/tests/Builder/BuilderEncoderTest.php on line 396
It's not clear to me why this didn't show up in all builds.
There was a problem hiding this comment.
That's right that The error report should be constant. We will have to backport this fix to v1.x of the error occurs.
We could also have used the @template-implements Encoder<string, FieldPathInterface> from FieldPathEncoder. But mixed is an acceptable solution in the test.
There was a problem hiding this comment.
We will have to backport this fix to v1.x of the error occurs.
I don't follow. It looks like this wasn't an issue in v1.x because the return type was only added in the v2.x branch by 5dda098.
Merge new changes from v1.x into v2.x.
Commits
To resolve any conflicts, check out the temporary branch and run the following command:Resolving conflicts
To ignore from the remote branch, first reset the temporary branch to v2.x and manually merge using the `ours` merge strategy:Ignoring changes
Then, push the temporary branch to upate the pull request.