Skip to content

PHPC-1004: Rename CursorId to CursorID #639

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

Merged
merged 2 commits into from
Aug 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ if test "$MONGODB" != "no"; then
src/MongoDB/BulkWrite.c \
src/MongoDB/Command.c \
src/MongoDB/Cursor.c \
src/MongoDB/CursorId.c \
src/MongoDB/CursorID.c \
src/MongoDB/Manager.c \
src/MongoDB/Query.c \
src/MongoDB/ReadConcern.c \
Expand Down
2 changes: 1 addition & 1 deletion config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ if (PHP_MONGODB != "no") {
EXTENSION("mongodb", "php_phongo.c phongo_compat.c", null, PHP_MONGODB_CFLAGS);
ADD_SOURCES(configure_module_dirname + "/src", "bson.c bson-encode.c", "mongodb");
ADD_SOURCES(configure_module_dirname + "/src/BSON", "Binary.c BinaryInterface.c Decimal128.c Decimal128Interface.c Javascript.c JavascriptInterface.c MaxKey.c MaxKeyInterface.c MinKey.c MinKeyInterface.c ObjectID.c ObjectIDInterface.c Persistable.c Regex.c RegexInterface.c Serializable.c Timestamp.c TimestampInterface.c Type.c Unserializable.c UTCDateTime.c UTCDateTimeInterface.c functions.c", "mongodb");
ADD_SOURCES(configure_module_dirname + "/src/MongoDB", "BulkWrite.c Command.c Cursor.c CursorId.c Manager.c Query.c ReadConcern.c ReadPreference.c Server.c WriteConcern.c WriteConcernError.c WriteError.c WriteResult.c", "mongodb");
ADD_SOURCES(configure_module_dirname + "/src/MongoDB", "BulkWrite.c Command.c Cursor.c CursorID.c Manager.c Query.c ReadConcern.c ReadPreference.c Server.c WriteConcern.c WriteConcernError.c WriteError.c WriteResult.c", "mongodb");
ADD_SOURCES(configure_module_dirname + "/src/MongoDB/Exception", "AuthenticationException.c BulkWriteException.c ConnectionException.c ConnectionTimeoutException.c Exception.c ExecutionTimeoutException.c InvalidArgumentException.c LogicException.c RuntimeException.c SSLConnectionException.c UnexpectedValueException.c WriteException.c", "mongodb");
ADD_SOURCES(configure_module_dirname + "/src/MongoDB/Monitoring", "CommandFailedEvent.c CommandStartedEvent.c CommandSubscriber.c CommandSucceededEvent.c Subscriber.c functions.c", "mongodb");
ADD_SOURCES(configure_module_dirname + "/src/libbson/src/bson", PHP_MONGODB_BSON_SOURCES, "mongodb");
Expand Down
2 changes: 1 addition & 1 deletion src/MongoDB/Cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ static PHP_METHOD(Cursor, toArray)
}
} /* }}} */

/* {{{ proto MongoDB\Driver\CursorId MongoDB\Driver\Cursor::getId()
/* {{{ proto MongoDB\Driver\CursorID MongoDB\Driver\Cursor::getId()
Returns the CursorId for this cursor */
static PHP_METHOD(Cursor, getId)
{
Expand Down
20 changes: 10 additions & 10 deletions src/MongoDB/CursorId.c → src/MongoDB/CursorID.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

zend_class_entry *php_phongo_cursorid_ce;

/* {{{ proto string MongoDB\Driver\CursorId::__toString()
Returns the string representation of the CursorId */
static PHP_METHOD(CursorId, __toString)
/* {{{ proto string MongoDB\Driver\CursorID::__toString()
Returns the string representation of the CursorID */
static PHP_METHOD(CursorID, __toString)
{
php_phongo_cursorid_t *intern;
char *tmp;
Expand All @@ -46,19 +46,19 @@ static PHP_METHOD(CursorId, __toString)
efree(tmp);
} /* }}} */

/* {{{ MongoDB\Driver\CursorId function entries */
ZEND_BEGIN_ARG_INFO_EX(ai_CursorId_void, 0, 0, 0)
/* {{{ MongoDB\Driver\CursorID function entries */
ZEND_BEGIN_ARG_INFO_EX(ai_CursorID_void, 0, 0, 0)
ZEND_END_ARG_INFO()

static zend_function_entry php_phongo_cursorid_me[] = {
PHP_ME(CursorId, __toString, ai_CursorId_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_CursorId_void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_CursorId_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_ME(CursorID, __toString, ai_CursorID_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_CursorID_void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_CursorID_void, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
PHP_FE_END
};
/* }}} */

/* {{{ MongoDB\Driver\CursorId object handlers */
/* {{{ MongoDB\Driver\CursorID object handlers */
static zend_object_handlers php_phongo_handler_cursorid;

static void php_phongo_cursorid_free_object(phongo_free_object_arg *object TSRMLS_DC) /* {{{ */
Expand Down Expand Up @@ -131,7 +131,7 @@ void php_phongo_cursorid_init_ce(INIT_FUNC_ARGS) /* {{{ */
{
zend_class_entry ce;

INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "CursorId", php_phongo_cursorid_me);
INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "CursorID", php_phongo_cursorid_me);
php_phongo_cursorid_ce = zend_register_internal_class(&ce TSRMLS_CC);
php_phongo_cursorid_ce->create_object = php_phongo_cursorid_create_object;
PHONGO_CE_FINAL(php_phongo_cursorid_ce);
Expand Down
2 changes: 1 addition & 1 deletion src/bson-encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ static void php_phongo_bson_append_object(bson_t *bson, php_phongo_bson_flags_t
bson_oid_t oid;
php_phongo_objectid_t *intern = Z_OBJECTID_OBJ_P(object);

mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding ObjectId");
mongoc_log(MONGOC_LOG_LEVEL_TRACE, MONGOC_LOG_DOMAIN, "encoding ObjectID");
bson_oid_init_from_string(&oid, intern->oid);
bson_append_oid(bson, key, key_len, &oid);
return;
Expand Down
2 changes: 1 addition & 1 deletion tests/bson-corpus/oid-decodeError-001.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
ObjectId: OID truncated
ObjectID: OID truncated
--DESCRIPTION--
Generated by scripts/convert-bson-corpus-tests.php

Expand Down
2 changes: 1 addition & 1 deletion tests/bson-corpus/oid-valid-001.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
ObjectId: All zeroes
ObjectID: All zeroes
--DESCRIPTION--
Generated by scripts/convert-bson-corpus-tests.php

Expand Down
2 changes: 1 addition & 1 deletion tests/bson-corpus/oid-valid-002.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
ObjectId: All ones
ObjectID: All ones
--DESCRIPTION--
Generated by scripts/convert-bson-corpus-tests.php

Expand Down
2 changes: 1 addition & 1 deletion tests/bson-corpus/oid-valid-003.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
ObjectId: Random
ObjectID: Random
--DESCRIPTION--
Generated by scripts/convert-bson-corpus-tests.php

Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-fromPHP_error-003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $tests = array(
new MongoDB\BSON\Javascript('function foo(bar) {var baz = bar; var bar = foo; return bar; }'),
new MongoDB\BSON\MinKey,
new MongoDB\BSON\MaxKey,
new MongoDB\BSON\ObjectId,
new MongoDB\BSON\ObjectID,
new MongoDB\BSON\Regex('regexp', 'i'),
new MongoDB\BSON\Timestamp(1234, 5678),
new MongoDB\BSON\UTCDateTime('1416445411987'),
Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-javascript-getCode-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $tests = [
['function foo(bar) { return bar; }', null],
['function foo(bar) { return bar; }', []],
['function foo() { return foo; }', ['foo' => 42]],
['function foo() { return id; }', ['id' => new MongoDB\BSON\ObjectId('53e2a1c40640fd72175d4603')]],
['function foo() { return id; }', ['id' => new MongoDB\BSON\ObjectID('53e2a1c40640fd72175d4603')]],
];

foreach ($tests as $test) {
Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-javascript-getScope-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $tests = [
['function foo(bar) { return bar; }', null],
['function foo(bar) { return bar; }', []],
['function foo() { return foo; }', ['foo' => 42]],
['function foo() { return id; }', ['id' => new MongoDB\BSON\ObjectId('53e2a1c40640fd72175d4603')]],
['function foo() { return id; }', ['id' => new MongoDB\BSON\ObjectID('53e2a1c40640fd72175d4603')]],
];

foreach ($tests as $test) {
Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-javascript-serialization-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $tests = [
['function foo(bar) { return bar; }', null],
['function foo(bar) { return bar; }', []],
['function foo() { return foo; }', ['foo' => 42]],
['function foo() { return id; }', ['id' => new MongoDB\BSON\ObjectId('53e2a1c40640fd72175d4603')]],
['function foo() { return id; }', ['id' => new MongoDB\BSON\ObjectID('53e2a1c40640fd72175d4603')]],
];

foreach ($tests as $test) {
Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-javascript-set_state-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $tests = [
['function foo(bar) { return bar; }', null],
['function foo(bar) { return bar; }', []],
['function foo() { return foo; }', ['foo' => 42]],
['function foo() { return id; }', ['id' => new MongoDB\BSON\ObjectId('53e2a1c40640fd72175d4603')]],
['function foo() { return id; }', ['id' => new MongoDB\BSON\ObjectID('53e2a1c40640fd72175d4603')]],
];

foreach ($tests as $test) {
Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-toCanonicalJSON-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MongoDB\BSON\toCanonicalExtendedJSON(): Encoding extended JSON types
require_once __DIR__ . '/../utils/tools.php';

$tests = [
[ '_id' => new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
[ '_id' => new MongoDB\BSON\ObjectID('56315a7c6118fd1b920270b1') ],
[ 'binary' => new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
[ 'date' => new MongoDB\BSON\UTCDateTime(1445990400000) ],
[ 'timestamp' => new MongoDB\BSON\Timestamp(1234, 5678) ],
Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-toJSON-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MongoDB\BSON\toJSON(): Encoding extended JSON types
require_once __DIR__ . '/../utils/tools.php';

$tests = [
[ '_id' => new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
[ '_id' => new MongoDB\BSON\ObjectID('56315a7c6118fd1b920270b1') ],
[ 'binary' => new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
[ 'date' => new MongoDB\BSON\UTCDateTime(1445990400000) ],
[ 'timestamp' => new MongoDB\BSON\Timestamp(1234, 5678) ],
Expand Down
2 changes: 1 addition & 1 deletion tests/bson/bson-toRelaxedJSON-002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MongoDB\BSON\toRelaxedExtendedJSON(): Encoding extended JSON types
require_once __DIR__ . '/../utils/tools.php';

$tests = [
[ '_id' => new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ],
[ '_id' => new MongoDB\BSON\ObjectID('56315a7c6118fd1b920270b1') ],
[ 'binary' => new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ],
[ 'date' => new MongoDB\BSON\UTCDateTime(1445990400000) ],
[ 'timestamp' => new MongoDB\BSON\Timestamp(1234, 5678) ],
Expand Down
6 changes: 3 additions & 3 deletions tests/cursorid/cursorid_error-001.phpt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
--TEST--
MongoDB\Driver\CursorId cannot be extended
MongoDB\Driver\CursorID cannot be extended
--FILE--
<?php

class MyCursorId extends MongoDB\Driver\CursorId {}
class MyCursorID extends MongoDB\Driver\CursorID {}

?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
Fatal error: Class MyCursorId may not inherit from final class (MongoDB\Driver\CursorId) in %s on line %d
Fatal error: Class MyCursorID may not inherit from final class (MongoDB\Driver\CursorID) in %s on line %d
2 changes: 1 addition & 1 deletion tests/functional/cursorid-001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var_dump($s1 > 0);
===DONE===
<?php exit(0); ?>
--EXPECTF--
object(MongoDB\Driver\CursorId)#%d (%d) {
object(MongoDB\Driver\CursorID)#%d (%d) {
["id"]=>
%rint\(\d+\)|string\(\d+\) "\d+"%r
}
Expand Down