Skip to content

Commit acc3683

Browse files
committed
Directly implement Stringable interface
1 parent f04c58e commit acc3683

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+70
-126
lines changed

src/BSON/Binary.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,9 @@ static HashTable* php_phongo_binary_get_properties(zend_object* object)
339339

340340
void php_phongo_binary_init_ce(INIT_FUNC_ARGS)
341341
{
342-
php_phongo_binary_ce = register_class_MongoDB_BSON_Binary(php_phongo_binary_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable);
342+
php_phongo_binary_ce = register_class_MongoDB_BSON_Binary(php_phongo_binary_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable);
343343
php_phongo_binary_ce->create_object = php_phongo_binary_create_object;
344344

345-
#if PHP_VERSION_ID >= 80000
346-
zend_class_implements(php_phongo_binary_ce, 1, zend_ce_stringable);
347-
#endif
348-
349345
memcpy(&php_phongo_handler_binary, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
350346
php_phongo_handler_binary.compare = php_phongo_binary_compare_objects;
351347
php_phongo_handler_binary.clone_obj = php_phongo_binary_clone_object;

src/BSON/Binary.stub.php

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

88
namespace MongoDB\BSON;
99

10-
final class Binary implements BinaryInterface, \JsonSerializable, Type, \Serializable
10+
final class Binary implements BinaryInterface, \JsonSerializable, Type, \Serializable, \Stringable
1111
{
1212
/**
1313
* @var int

src/BSON/Binary_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/BSON/DBPointer.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,13 +299,9 @@ static HashTable* php_phongo_dbpointer_get_properties(zend_object* object)
299299

300300
void php_phongo_dbpointer_init_ce(INIT_FUNC_ARGS)
301301
{
302-
php_phongo_dbpointer_ce = register_class_MongoDB_BSON_DBPointer(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable);
302+
php_phongo_dbpointer_ce = register_class_MongoDB_BSON_DBPointer(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable);
303303
php_phongo_dbpointer_ce->create_object = php_phongo_dbpointer_create_object;
304304

305-
#if PHP_VERSION_ID >= 80000
306-
zend_class_implements(php_phongo_dbpointer_ce, 1, zend_ce_stringable);
307-
#endif
308-
309305
memcpy(&php_phongo_handler_dbpointer, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
310306
php_phongo_handler_dbpointer.compare = php_phongo_dbpointer_compare_objects;
311307
php_phongo_handler_dbpointer.clone_obj = php_phongo_dbpointer_clone_object;

src/BSON/DBPointer.stub.php

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

88
namespace MongoDB\BSON;
9-
final class DBPointer implements \JsonSerializable, Type, \Serializable
9+
final class DBPointer implements \JsonSerializable, Type, \Serializable, \Stringable
1010
{
1111
final private function __construct() {}
1212

src/BSON/DBPointer_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/BSON/Decimal128.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,13 +275,9 @@ static HashTable* php_phongo_decimal128_get_properties(zend_object* object)
275275

276276
void php_phongo_decimal128_init_ce(INIT_FUNC_ARGS)
277277
{
278-
php_phongo_decimal128_ce = register_class_MongoDB_BSON_Decimal128(php_phongo_decimal128_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable);
278+
php_phongo_decimal128_ce = register_class_MongoDB_BSON_Decimal128(php_phongo_decimal128_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable);
279279
php_phongo_decimal128_ce->create_object = php_phongo_decimal128_create_object;
280280

281-
#if PHP_VERSION_ID >= 80000
282-
zend_class_implements(php_phongo_decimal128_ce, 1, zend_ce_stringable);
283-
#endif
284-
285281
memcpy(&php_phongo_handler_decimal128, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
286282
php_phongo_handler_decimal128.clone_obj = php_phongo_decimal128_clone_object;
287283
php_phongo_handler_decimal128.get_debug_info = php_phongo_decimal128_get_debug_info;

src/BSON/Decimal128.stub.php

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

88
namespace MongoDB\BSON;
99

10-
final class Decimal128 implements Decimal128Interface, \JsonSerializable, Type, \Serializable
10+
final class Decimal128 implements Decimal128Interface, \JsonSerializable, Type, \Serializable, \Stringable
1111
{
1212
final public function __construct(string $value) {}
1313

src/BSON/Decimal128_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/BSON/Document.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -635,13 +635,9 @@ void php_phongo_document_unset_dimension(zend_object* object, zval* offset)
635635

636636
void php_phongo_document_init_ce(INIT_FUNC_ARGS)
637637
{
638-
php_phongo_document_ce = register_class_MongoDB_BSON_Document(zend_ce_aggregate, zend_ce_serializable, zend_ce_arrayaccess, php_phongo_type_ce);
638+
php_phongo_document_ce = register_class_MongoDB_BSON_Document(zend_ce_aggregate, zend_ce_serializable, zend_ce_arrayaccess, php_phongo_type_ce, zend_ce_stringable);
639639
php_phongo_document_ce->create_object = php_phongo_document_create_object;
640640

641-
#if PHP_VERSION_ID >= 80000
642-
zend_class_implements(php_phongo_document_ce, 1, zend_ce_stringable);
643-
#endif
644-
645641
memcpy(&php_phongo_handler_document, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
646642
php_phongo_handler_document.compare = php_phongo_document_compare_objects;
647643
php_phongo_handler_document.clone_obj = php_phongo_document_clone_object;

src/BSON/Document.stub.php

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

88
namespace MongoDB\BSON;
99

10-
final class Document implements \IteratorAggregate, \Serializable, \ArrayAccess, Type
10+
final class Document implements \IteratorAggregate, \Serializable, \ArrayAccess, Type, \Stringable
1111
{
1212
private function __construct() {}
1313

src/BSON/Document_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/BSON/Int64.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -611,13 +611,9 @@ static HashTable* php_phongo_int64_get_properties(zend_object* object)
611611

612612
void php_phongo_int64_init_ce(INIT_FUNC_ARGS)
613613
{
614-
php_phongo_int64_ce = register_class_MongoDB_BSON_Int64(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable);
614+
php_phongo_int64_ce = register_class_MongoDB_BSON_Int64(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable);
615615
php_phongo_int64_ce->create_object = php_phongo_int64_create_object;
616616

617-
#if PHP_VERSION_ID >= 80000
618-
zend_class_implements(php_phongo_int64_ce, 1, zend_ce_stringable);
619-
#endif
620-
621617
memcpy(&php_phongo_handler_int64, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
622618
php_phongo_handler_int64.compare = php_phongo_int64_compare_objects;
623619
php_phongo_handler_int64.clone_obj = php_phongo_int64_clone_object;

src/BSON/Int64.stub.php

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

88
namespace MongoDB\BSON;
99

10-
final class Int64 implements \JsonSerializable, Type, \Serializable
10+
final class Int64 implements \JsonSerializable, Type, \Serializable, \Stringable
1111
{
1212
final public function __construct(int|string $value) {}
1313

src/BSON/Int64_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/BSON/Javascript.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,9 @@ static HashTable* php_phongo_javascript_get_properties(zend_object* object)
392392

393393
void php_phongo_javascript_init_ce(INIT_FUNC_ARGS)
394394
{
395-
php_phongo_javascript_ce = register_class_MongoDB_BSON_Javascript(php_phongo_javascript_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable);
395+
php_phongo_javascript_ce = register_class_MongoDB_BSON_Javascript(php_phongo_javascript_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable);
396396
php_phongo_javascript_ce->create_object = php_phongo_javascript_create_object;
397397

398-
#if PHP_VERSION_ID >= 80000
399-
zend_class_implements(php_phongo_javascript_ce, 1, zend_ce_stringable);
400-
#endif
401-
402398
memcpy(&php_phongo_handler_javascript, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
403399
php_phongo_handler_javascript.compare = php_phongo_javascript_compare_objects;
404400
php_phongo_handler_javascript.clone_obj = php_phongo_javascript_clone_object;

src/BSON/Javascript.stub.php

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

88
namespace MongoDB\BSON;
99

10-
final class Javascript implements JavascriptInterface, \JsonSerializable, Type, \Serializable
10+
final class Javascript implements JavascriptInterface, \JsonSerializable, Type, \Serializable, \Stringable
1111
{
1212
final public function __construct(string $code, array|object|null $scope = null) {}
1313

src/BSON/Javascript_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/BSON/ObjectId.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,9 @@ static HashTable* php_phongo_objectid_get_properties(zend_object* object)
320320

321321
void php_phongo_objectid_init_ce(INIT_FUNC_ARGS)
322322
{
323-
php_phongo_objectid_ce = register_class_MongoDB_BSON_ObjectId(php_phongo_objectid_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable);
323+
php_phongo_objectid_ce = register_class_MongoDB_BSON_ObjectId(php_phongo_objectid_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable);
324324
php_phongo_objectid_ce->create_object = php_phongo_objectid_create_object;
325325

326-
#if PHP_VERSION_ID >= 80000
327-
zend_class_implements(php_phongo_objectid_ce, 1, zend_ce_stringable);
328-
#endif
329-
330326
memcpy(&php_phongo_handler_objectid, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
331327
php_phongo_handler_objectid.compare = php_phongo_objectid_compare_objects;
332328
php_phongo_handler_objectid.clone_obj = php_phongo_objectid_clone_object;

src/BSON/ObjectId.stub.php

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

88
namespace MongoDB\BSON;
99

10-
final class ObjectId implements ObjectIdInterface, \JsonSerializable, Type, \Serializable
10+
final class ObjectId implements ObjectIdInterface, \JsonSerializable, Type, \Serializable, \Stringable
1111
{
1212
final public function __construct(?string $id = null) {}
1313

src/BSON/ObjectId_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.

0 commit comments

Comments
 (0)