Skip to content
Prev Previous commit
Next Next commit
Directly implement Stringable interface
  • Loading branch information
alcaeus committed Sep 6, 2024
commit acc3683e349d44aa874ba8b35d8dfe3a5a5bfadb
6 changes: 1 addition & 5 deletions src/BSON/Binary.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,9 @@ static HashTable* php_phongo_binary_get_properties(zend_object* object)

void php_phongo_binary_init_ce(INIT_FUNC_ARGS)
{
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);
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);
php_phongo_binary_ce->create_object = php_phongo_binary_create_object;

#if PHP_VERSION_ID >= 80000
zend_class_implements(php_phongo_binary_ce, 1, zend_ce_stringable);
#endif

memcpy(&php_phongo_handler_binary, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_binary.compare = php_phongo_binary_compare_objects;
php_phongo_handler_binary.clone_obj = php_phongo_binary_clone_object;
Expand Down
2 changes: 1 addition & 1 deletion src/BSON/Binary.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace MongoDB\BSON;

final class Binary implements BinaryInterface, \JsonSerializable, Type, \Serializable
final class Binary implements BinaryInterface, \JsonSerializable, Type, \Serializable, \Stringable
{
/**
* @var int
Expand Down
6 changes: 3 additions & 3 deletions src/BSON/Binary_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions src/BSON/DBPointer.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,9 @@ static HashTable* php_phongo_dbpointer_get_properties(zend_object* object)

void php_phongo_dbpointer_init_ce(INIT_FUNC_ARGS)
{
php_phongo_dbpointer_ce = register_class_MongoDB_BSON_DBPointer(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable);
php_phongo_dbpointer_ce = register_class_MongoDB_BSON_DBPointer(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable);
php_phongo_dbpointer_ce->create_object = php_phongo_dbpointer_create_object;

#if PHP_VERSION_ID >= 80000
zend_class_implements(php_phongo_dbpointer_ce, 1, zend_ce_stringable);
#endif

memcpy(&php_phongo_handler_dbpointer, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_dbpointer.compare = php_phongo_dbpointer_compare_objects;
php_phongo_handler_dbpointer.clone_obj = php_phongo_dbpointer_clone_object;
Expand Down
2 changes: 1 addition & 1 deletion src/BSON/DBPointer.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

namespace MongoDB\BSON;
final class DBPointer implements \JsonSerializable, Type, \Serializable
final class DBPointer implements \JsonSerializable, Type, \Serializable, \Stringable
{
final private function __construct() {}

Expand Down
6 changes: 3 additions & 3 deletions src/BSON/DBPointer_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions src/BSON/Decimal128.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,9 @@ static HashTable* php_phongo_decimal128_get_properties(zend_object* object)

void php_phongo_decimal128_init_ce(INIT_FUNC_ARGS)
{
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);
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);
php_phongo_decimal128_ce->create_object = php_phongo_decimal128_create_object;

#if PHP_VERSION_ID >= 80000
zend_class_implements(php_phongo_decimal128_ce, 1, zend_ce_stringable);
#endif

memcpy(&php_phongo_handler_decimal128, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_decimal128.clone_obj = php_phongo_decimal128_clone_object;
php_phongo_handler_decimal128.get_debug_info = php_phongo_decimal128_get_debug_info;
Expand Down
2 changes: 1 addition & 1 deletion src/BSON/Decimal128.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace MongoDB\BSON;

final class Decimal128 implements Decimal128Interface, \JsonSerializable, Type, \Serializable
final class Decimal128 implements Decimal128Interface, \JsonSerializable, Type, \Serializable, \Stringable
{
final public function __construct(string $value) {}

Expand Down
6 changes: 3 additions & 3 deletions src/BSON/Decimal128_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions src/BSON/Document.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,13 +635,9 @@ void php_phongo_document_unset_dimension(zend_object* object, zval* offset)

void php_phongo_document_init_ce(INIT_FUNC_ARGS)
{
php_phongo_document_ce = register_class_MongoDB_BSON_Document(zend_ce_aggregate, zend_ce_serializable, zend_ce_arrayaccess, php_phongo_type_ce);
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);
php_phongo_document_ce->create_object = php_phongo_document_create_object;

#if PHP_VERSION_ID >= 80000
zend_class_implements(php_phongo_document_ce, 1, zend_ce_stringable);
#endif

memcpy(&php_phongo_handler_document, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_document.compare = php_phongo_document_compare_objects;
php_phongo_handler_document.clone_obj = php_phongo_document_clone_object;
Expand Down
2 changes: 1 addition & 1 deletion src/BSON/Document.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace MongoDB\BSON;

final class Document implements \IteratorAggregate, \Serializable, \ArrayAccess, Type
final class Document implements \IteratorAggregate, \Serializable, \ArrayAccess, Type, \Stringable
{
private function __construct() {}

Expand Down
6 changes: 3 additions & 3 deletions src/BSON/Document_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions src/BSON/Int64.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,13 +611,9 @@ static HashTable* php_phongo_int64_get_properties(zend_object* object)

void php_phongo_int64_init_ce(INIT_FUNC_ARGS)
{
php_phongo_int64_ce = register_class_MongoDB_BSON_Int64(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable);
php_phongo_int64_ce = register_class_MongoDB_BSON_Int64(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable, zend_ce_stringable);
php_phongo_int64_ce->create_object = php_phongo_int64_create_object;

#if PHP_VERSION_ID >= 80000
zend_class_implements(php_phongo_int64_ce, 1, zend_ce_stringable);
#endif

memcpy(&php_phongo_handler_int64, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_int64.compare = php_phongo_int64_compare_objects;
php_phongo_handler_int64.clone_obj = php_phongo_int64_clone_object;
Expand Down
2 changes: 1 addition & 1 deletion src/BSON/Int64.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace MongoDB\BSON;

final class Int64 implements \JsonSerializable, Type, \Serializable
final class Int64 implements \JsonSerializable, Type, \Serializable, \Stringable
{
final public function __construct(int|string $value) {}

Expand Down
6 changes: 3 additions & 3 deletions src/BSON/Int64_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions src/BSON/Javascript.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,9 @@ static HashTable* php_phongo_javascript_get_properties(zend_object* object)

void php_phongo_javascript_init_ce(INIT_FUNC_ARGS)
{
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);
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);
php_phongo_javascript_ce->create_object = php_phongo_javascript_create_object;

#if PHP_VERSION_ID >= 80000
zend_class_implements(php_phongo_javascript_ce, 1, zend_ce_stringable);
#endif

memcpy(&php_phongo_handler_javascript, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_javascript.compare = php_phongo_javascript_compare_objects;
php_phongo_handler_javascript.clone_obj = php_phongo_javascript_clone_object;
Expand Down
2 changes: 1 addition & 1 deletion src/BSON/Javascript.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace MongoDB\BSON;

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

Expand Down
6 changes: 3 additions & 3 deletions src/BSON/Javascript_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions src/BSON/ObjectId.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,9 @@ static HashTable* php_phongo_objectid_get_properties(zend_object* object)

void php_phongo_objectid_init_ce(INIT_FUNC_ARGS)
{
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);
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);
php_phongo_objectid_ce->create_object = php_phongo_objectid_create_object;

#if PHP_VERSION_ID >= 80000
zend_class_implements(php_phongo_objectid_ce, 1, zend_ce_stringable);
#endif

memcpy(&php_phongo_handler_objectid, phongo_get_std_object_handlers(), sizeof(zend_object_handlers));
php_phongo_handler_objectid.compare = php_phongo_objectid_compare_objects;
php_phongo_handler_objectid.clone_obj = php_phongo_objectid_clone_object;
Expand Down
2 changes: 1 addition & 1 deletion src/BSON/ObjectId.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace MongoDB\BSON;

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

Expand Down
6 changes: 3 additions & 3 deletions src/BSON/ObjectId_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading