-
Notifications
You must be signed in to change notification settings - Fork 264
Remove compatibility layer for CursorId deprecation #1425
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace MongoDB\Driver; | ||
|
||
/** | ||
* @template-covariant TValue of array|object | ||
* | ||
* @template-implements CursorInterface<TValue> | ||
*/ | ||
final class Cursor implements CursorInterface | ||
{ | ||
/** | ||
* @return TValue|null | ||
* @psalm-ignore-nullable-return | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIUC, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was blatantly copied over from psalm's iterator stubs. The way I see it, this is a shortcoming of the original interface. The interface doesn't specify whether For immutable classes, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the explanation. I imagine throwing would be incredibly annoying, as manual iteration is already a complicated subject. I reckon the average PHP developer isn't familiar with the sequence of method calls to mimic a Not so much the case with our write result getters relying on |
||
*/ | ||
public function current(): array|object|null | ||
{ | ||
} | ||
|
||
public function next(): void | ||
{ | ||
} | ||
|
||
/** @psalm-ignore-nullable-return */ | ||
public function key(): ?int | ||
{ | ||
} | ||
|
||
public function valid(): bool | ||
{ | ||
} | ||
|
||
public function rewind(): void | ||
{ | ||
} | ||
|
||
/** @return array<TValue> */ | ||
public function toArray(): array | ||
{ | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace MongoDB\Driver; | ||
|
||
use Iterator; | ||
|
||
/** | ||
* @template TValue of array|object | ||
* @template-implements Iterator<int, TValue> | ||
*/ | ||
interface CursorInterface extends Iterator | ||
{ | ||
/** | ||
* @return TValue|null | ||
* @psalm-ignore-nullable-return | ||
*/ | ||
public function current(): array|object|null; | ||
|
||
public function getId(): \MongoDB\BSON\Int64; | ||
jmikola marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
public function getServer(): Server; | ||
|
||
public function isDead(): bool; | ||
|
||
/** @psalm-ignore-nullable-return */ | ||
public function key(): ?int; | ||
|
||
public function setTypeMap(array $typemap): void; | ||
|
||
/** @return array<TValue> */ | ||
public function toArray(): array; | ||
} |
Uh oh!
There was an error while loading. Please reload this page.