Skip to content
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

Update method signatures for ext-mongodb 1.20 #11109

Open
wants to merge 2 commits into
base: 5.x
Choose a base branch
from

Conversation

alcaeus
Copy link
Contributor

@alcaeus alcaeus commented Oct 1, 2024

This includes a tiny fix for the template annotation in MongoDB\BSON\Iterator, as well as updates to the stubs for MongoDB\Driver\CursorInterface and MongoDB\Driver\Cursor to prepare for the upcoming 2.0 release.

{
}

public function getId(bool $asInt64 = false): Int64|CursorId
Copy link
Contributor

@GromNaN GromNaN Oct 1, 2024

Choose a reason for hiding this comment

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

You can improve the return type. The default return type change in 2.0. If we could specify the return type depending on the ext-mongodb version, that would be nice.

Suggested change
public function getId(bool $asInt64 = false): Int64|CursorId
/** @return ($asInt64 is true ? Int64 : CursorId) */
public function getId(bool $asInt64 = false): Int64|CursorId

https://psalm.dev/r/a064e6428e

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought I already had this in, but I didn't add it in our own stubs. It's added now 👍

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.

2 participants