Skip to content

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

Merged
merged 6 commits into from
Feb 27, 2025
Merged

Conversation

mongodb-php-bot
Copy link
Collaborator

Merge new changes from v1.x into v2.x.

Commits

Resolving conflicts

To resolve any conflicts, check out the temporary branch and run the following command:
git merge v2.x

Ignoring changes

To ignore from the remote branch, first reset the temporary branch to v2.x and manually merge using the `ours` merge strategy:
git reset --hard v2.x
git merge --strategy=ours v1.x

Then, push the temporary branch to upate the pull request.

jmikola and others added 4 commits February 25, 2025 15:50
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
@mongodb-php-bot mongodb-php-bot requested a review from a team as a code owner February 26, 2025 14:48
@jmikola jmikola mentioned this pull request Feb 26, 2025
@@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GromNaN: Any idea why a MixedAssignment error wasn't detected here? It was in #1612

Copy link
Member

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.

@@ -32,7 +34,7 @@

$encoded = [];
foreach ($value->getIterator() as $stage) {
$encoded[] = $this->encoder->encodeIfSupported($stage);
$encoded[] = $this->recursiveEncode($stage);

Check notice

Code scanning / Psalm

MixedAssignment Note

Unable to determine the type of this assignment
This was not applicable to the commit in v1.x (36fca42), but is necessary in v2.x since 5dda098 added return types to all methods.
return $value instanceof FieldPathInterface;
}

public function encode(mixed $value): mixed
Copy link
Member

@jmikola jmikola Feb 27, 2025

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.

Copy link
Member

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.

Copy link
Member

@jmikola jmikola Feb 27, 2025

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.

@mongodb-php-bot mongodb-php-bot merged commit abc36b1 into v2.x Feb 27, 2025
30 checks passed
@mongodb-php-bot mongodb-php-bot deleted the merge-v1.x-into-v2.x-1740581311540 branch February 27, 2025 14:53
GromNaN pushed a commit that referenced this pull request Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants