-
Notifications
You must be signed in to change notification settings - Fork 263
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
PHPLIB-1489: Handle CursorId deprecations #1366
Conversation
public function getId(): CursorId | ||
/** @return CursorId|Int64 */ | ||
#[ReturnTypeWillChange] | ||
public function getId(bool $asInt64 = false) |
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.
For BC layer, adding an argument should be virtual (func_get_arg
).
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 thought the argument with a default value would be fine, can you explain why func_get_args
works better?
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.
Although I'm not sure why or how anyone would extend this class.
11890ef
to
162f789
Compare
PHPLIB-1489
This PR complements mongodb/mongo-php-driver#1616 by introducing the same
$asInt64
argument to all classes that implementCursorInterface::getId
or wrap a cursor class. Not providing the argument or providingfalse
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 toInt64
.