-
Notifications
You must be signed in to change notification settings - Fork 265
Merge v1.x into v2.x #1614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge v1.x into v2.x #1614
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
@@ -32,7 +34,7 @@ public function encode(mixed $value): array | |||
|
|||
$encoded = []; | |||
foreach ($value->getIterator() as $stage) { | |||
$encoded[] = $this->encoder->encodeIfSupported($stage); | |||
$encoded[] = $this->recursiveEncode($stage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.