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

PHPLIB-1489: Handle CursorId deprecations #1366

Merged

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Jul 25, 2024

PHPLIB-1489

This PR complements mongodb/mongo-php-driver#1616 by introducing the same $asInt64 argument to all classes that implement CursorInterface::getId or wrap a cursor class. Not providing the argument or providing false as a value will trigger a deprecation warning to inform the user they need to update. In 2.0, we can deprecate the parameter and change the return type of the methods to Int64.

@alcaeus alcaeus self-assigned this Jul 25, 2024
@alcaeus alcaeus requested a review from a team as a code owner July 25, 2024 10:28
@alcaeus alcaeus requested a review from GromNaN July 25, 2024 10:28
public function getId(): CursorId
/** @return CursorId|Int64 */
#[ReturnTypeWillChange]
public function getId(bool $asInt64 = false)
Copy link
Member

Choose a reason for hiding this comment

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

For BC layer, adding an argument should be virtual (func_get_arg).

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought the argument with a default value would be fine, can you explain why func_get_args works better?

Copy link
Member

Choose a reason for hiding this comment

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

Although I'm not sure why or how anyone would extend this class.

GromNaN
GromNaN previously approved these changes Jul 25, 2024
@alcaeus alcaeus changed the base branch from master to v1.20 September 4, 2024 12:53
@alcaeus alcaeus marked this pull request as draft September 4, 2024 12:59
@alcaeus alcaeus force-pushed the phplib-1489-handle-cursorid-deprecation branch from 11890ef to 162f789 Compare September 6, 2024 12:31
src/ChangeStream.php Dismissed Show dismissed Hide dismissed
src/Model/CodecCursor.php Dismissed Show dismissed Hide dismissed
src/Model/CodecCursor.php Dismissed Show dismissed Hide dismissed
@alcaeus alcaeus marked this pull request as ready for review September 6, 2024 12:37
@alcaeus alcaeus requested a review from GromNaN September 6, 2024 12:37
@alcaeus alcaeus merged commit ccc732e into mongodb:v1.20 Sep 6, 2024
36 checks passed
@alcaeus alcaeus deleted the phplib-1489-handle-cursorid-deprecation branch September 6, 2024 13:13
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