Skip to content

Commit 2c91356

Browse files
authored
PHPC-2447: Extend Iterator interface in CustorInterface (#1654)
1 parent 04c29be commit 2c91356

8 files changed

+12
-23
lines changed

src/MongoDB/Cursor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ static HashTable* php_phongo_cursor_get_debug_info(zend_object* object, int* is_
438438

439439
void php_phongo_cursor_init_ce(INIT_FUNC_ARGS)
440440
{
441-
php_phongo_cursor_ce = register_class_MongoDB_Driver_Cursor(zend_ce_iterator, php_phongo_cursor_interface_ce);
441+
php_phongo_cursor_ce = register_class_MongoDB_Driver_Cursor(php_phongo_cursor_interface_ce);
442442
php_phongo_cursor_ce->create_object = php_phongo_cursor_create_object;
443443

444444
memcpy(&php_phongo_handler_cursor, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));

src/MongoDB/Cursor.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace MongoDB\Driver;
99

1010
/** @not-serializable */
11-
final class Cursor implements \Iterator, CursorInterface
11+
final class Cursor implements CursorInterface
1212
{
1313
final private function __construct() {}
1414

src/MongoDB/CursorInterface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ zend_class_entry* php_phongo_cursor_interface_ce;
2424

2525
void php_phongo_cursor_interface_init_ce(INIT_FUNC_ARGS)
2626
{
27-
php_phongo_cursor_interface_ce = register_class_MongoDB_Driver_CursorInterface(zend_ce_traversable);
27+
php_phongo_cursor_interface_ce = register_class_MongoDB_Driver_CursorInterface(zend_ce_iterator);
2828
}

src/MongoDB/CursorInterface.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace MongoDB\Driver;
99

10-
interface CursorInterface extends \Traversable
10+
interface CursorInterface extends \Iterator
1111
{
1212
/** @tentative-return-type */
1313
public function getId(): CursorId|\MongoDB\BSON\Int64;

src/MongoDB/CursorInterface_arginfo.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/MongoDB/Cursor_arginfo.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/cursor/cursorinterface-002.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
--TEST--
2-
MongoDB\Driver\CursorInterface extends Traversable
2+
MongoDB\Driver\CursorInterface extends Iterator
33
--FILE--
44
<?php
5-
var_dump(in_array('Traversable', class_implements('MongoDB\Driver\CursorInterface')));
5+
var_dump(in_array('Iterator', class_implements('MongoDB\Driver\CursorInterface')));
66
?>
77
===DONE===
88
<?php exit(0); ?>

tests/cursor/cursorinterface-003.phpt

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)