From 553d9c5b1efcefe1622ab868e7d45c3862315084 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Fri, 22 Jul 2022 10:50:41 +0200 Subject: [PATCH 01/26] Add missing macros for declaring arguments --- src/phongo_compat.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/phongo_compat.h b/src/phongo_compat.h index ddf9e5422..410edbbd3 100644 --- a/src/phongo_compat.h +++ b/src/phongo_compat.h @@ -273,6 +273,23 @@ static inline zend_bool zend_ini_parse_bool(zend_string* str) ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) #endif +/* ZEND_ABSTRACT_ME_WITH_FLAGS was introduced in PHP 8.0. */ +#ifndef ZEND_ABSTRACT_ME_WITH_FLAGS +#define ZEND_ABSTRACT_ME_WITH_FLAGS(classname, name, arg_info, flags) ZEND_RAW_FENTRY(#name, NULL, arg_info, flags) +#endif + +/* ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE was introduced in PHP 8.0. */ +#ifndef ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE +#define ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(pass_by_ref, name, type_hint, allow_null, default_value) \ + ZEND_ARG_TYPE_INFO(pass_by_ref, name, type_hint, allow_null) +#endif + +/* ZEND_ARG_INFO_WITH_DEFAULT_VALUE was introduced in PHP 8.0. */ +#ifndef ZEND_ARG_INFO_WITH_DEFAULT_VALUE +#define ZEND_ARG_INFO_WITH_DEFAULT_VALUE(pass_by_ref, name, default_value) \ + ZEND_ARG_INFO(pass_by_ref, name) +#endif + zend_bool php_phongo_zend_hash_apply_protection_begin(HashTable* ht); zend_bool php_phongo_zend_hash_apply_protection_end(HashTable* ht); From 8414fb154084c5edf3e0a1b6dded6575face82e5 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Fri, 22 Jul 2022 10:50:56 +0200 Subject: [PATCH 02/26] Add macros to define disabled constructor and __wakeup --- php_phongo.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/php_phongo.h b/php_phongo.h index 29dceef46..ecb74acdd 100644 --- a/php_phongo.h +++ b/php_phongo.h @@ -109,6 +109,18 @@ zend_object_handlers* phongo_get_std_object_handlers(void); (intern)->created_by_pid = (int) getpid(); \ } while (0) +#define PHONGO_DISABLED_CONSTRUCTOR(classname) \ + PHP_METHOD(classname, __construct) \ + { \ + phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Accessing private constructor"); \ + } + +#define PHONGO_DISABLED_WAKEUP(classname) \ + PHP_METHOD(classname, __wakeup) \ + { \ + phongo_throw_exception(PHONGO_ERROR_RUNTIME, "MongoDB\\Driver objects cannot be serialized"); \ + } + /* Shared function entries for disabling constructors and unserialize() */ PHP_FUNCTION(MongoDB_disabled___construct); PHP_FUNCTION(MongoDB_disabled___wakeup); From b1a67c80ebedffd747420d471fd0bb0a2dd62364 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Fri, 22 Jul 2022 10:51:44 +0200 Subject: [PATCH 03/26] Define arginfo via stubs for BSON classes --- .gitignore | 1 + scripts/clang-format.sh | 8 +- src/BSON/Binary.c | 67 +++------------- src/BSON/Binary.stub.php | 35 ++++++++ src/BSON/BinaryInterface.c | 20 +---- src/BSON/BinaryInterface.stub.php | 18 +++++ src/BSON/BinaryInterface_arginfo.h | 19 +++++ src/BSON/Binary_arginfo.h | 79 ++++++++++++++++++ src/BSON/DBPointer.c | 50 +++--------- src/BSON/DBPointer.stub.php | 29 +++++++ src/BSON/DBPointer_arginfo.h | 62 ++++++++++++++ src/BSON/Decimal128.c | 60 +++----------- src/BSON/Decimal128.stub.php | 31 +++++++ src/BSON/Decimal128Interface.c | 15 +--- src/BSON/Decimal128Interface.stub.php | 12 +++ src/BSON/Decimal128Interface_arginfo.h | 13 +++ src/BSON/Decimal128_arginfo.h | 69 ++++++++++++++++ src/BSON/Int64.c | 50 +++--------- src/BSON/Int64.stub.php | 29 +++++++ src/BSON/Int64_arginfo.h | 62 ++++++++++++++ src/BSON/Javascript.c | 67 +++------------- src/BSON/Javascript.stub.php | 40 +++++++++ src/BSON/JavascriptInterface.c | 20 +---- src/BSON/JavascriptInterface.stub.php | 18 +++++ src/BSON/JavascriptInterface_arginfo.h | 19 +++++ src/BSON/Javascript_arginfo.h | 98 +++++++++++++++++++++++ src/BSON/MaxKey.c | 47 ++--------- src/BSON/MaxKey.stub.php | 27 +++++++ src/BSON/MaxKey_arginfo.h | 59 ++++++++++++++ src/BSON/MinKey.c | 47 ++--------- src/BSON/MinKey.stub.php | 27 +++++++ src/BSON/MinKey_arginfo.h | 59 ++++++++++++++ src/BSON/ObjectId.c | 63 +++------------ src/BSON/ObjectId.stub.php | 33 ++++++++ src/BSON/ObjectIdInterface.c | 19 +---- src/BSON/ObjectIdInterface.stub.php | 15 ++++ src/BSON/ObjectIdInterface_arginfo.h | 16 ++++ src/BSON/ObjectId_arginfo.h | 74 +++++++++++++++++ src/BSON/Persistable.c | 9 +-- src/BSON/Persistable.stub.php | 10 +++ src/BSON/Persistable_arginfo.h | 9 +++ src/BSON/Regex.c | 67 +++------------- src/BSON/Regex.stub.php | 35 ++++++++ src/BSON/RegexInterface.c | 20 +---- src/BSON/RegexInterface.stub.php | 18 +++++ src/BSON/RegexInterface_arginfo.h | 19 +++++ src/BSON/Regex_arginfo.h | 78 ++++++++++++++++++ src/BSON/Serializable.c | 15 +--- src/BSON/Serializable.stub.php | 12 +++ src/BSON/Serializable_arginfo.h | 13 +++ src/BSON/Symbol.c | 50 +++--------- src/BSON/Symbol.stub.php | 29 +++++++ src/BSON/Symbol_arginfo.h | 62 ++++++++++++++ src/BSON/Timestamp.c | 67 +++------------- src/BSON/Timestamp.stub.php | 43 ++++++++++ src/BSON/TimestampInterface.c | 20 +---- src/BSON/TimestampInterface.stub.php | 18 +++++ src/BSON/TimestampInterface_arginfo.h | 19 +++++ src/BSON/Timestamp_arginfo.h | 98 +++++++++++++++++++++++ src/BSON/UTCDateTime.c | 63 +++------------ src/BSON/UTCDateTime.stub.php | 38 +++++++++ src/BSON/UTCDateTimeInterface.c | 19 +---- src/BSON/UTCDateTimeInterface.stub.php | 15 ++++ src/BSON/UTCDateTimeInterface_arginfo.h | 16 ++++ src/BSON/UTCDateTime_arginfo.h | 92 +++++++++++++++++++++ src/BSON/Undefined.c | 50 +++--------- src/BSON/Undefined.stub.php | 29 +++++++ src/BSON/Undefined_arginfo.h | 62 ++++++++++++++ src/BSON/Unserializable.c | 16 +--- src/BSON/Unserializable.stub.php | 12 +++ src/BSON/Unserializable_arginfo.h | 14 ++++ tests/bson/bson-decimal128_error-001.phpt | 4 +- tests/bson/bson-objectid_error-001.phpt | 6 +- 73 files changed, 1850 insertions(+), 774 deletions(-) create mode 100644 src/BSON/Binary.stub.php create mode 100644 src/BSON/BinaryInterface.stub.php create mode 100644 src/BSON/BinaryInterface_arginfo.h create mode 100644 src/BSON/Binary_arginfo.h create mode 100644 src/BSON/DBPointer.stub.php create mode 100644 src/BSON/DBPointer_arginfo.h create mode 100644 src/BSON/Decimal128.stub.php create mode 100644 src/BSON/Decimal128Interface.stub.php create mode 100644 src/BSON/Decimal128Interface_arginfo.h create mode 100644 src/BSON/Decimal128_arginfo.h create mode 100644 src/BSON/Int64.stub.php create mode 100644 src/BSON/Int64_arginfo.h create mode 100644 src/BSON/Javascript.stub.php create mode 100644 src/BSON/JavascriptInterface.stub.php create mode 100644 src/BSON/JavascriptInterface_arginfo.h create mode 100644 src/BSON/Javascript_arginfo.h create mode 100644 src/BSON/MaxKey.stub.php create mode 100644 src/BSON/MaxKey_arginfo.h create mode 100644 src/BSON/MinKey.stub.php create mode 100644 src/BSON/MinKey_arginfo.h create mode 100644 src/BSON/ObjectId.stub.php create mode 100644 src/BSON/ObjectIdInterface.stub.php create mode 100644 src/BSON/ObjectIdInterface_arginfo.h create mode 100644 src/BSON/ObjectId_arginfo.h create mode 100644 src/BSON/Persistable.stub.php create mode 100644 src/BSON/Persistable_arginfo.h create mode 100644 src/BSON/Regex.stub.php create mode 100644 src/BSON/RegexInterface.stub.php create mode 100644 src/BSON/RegexInterface_arginfo.h create mode 100644 src/BSON/Regex_arginfo.h create mode 100644 src/BSON/Serializable.stub.php create mode 100644 src/BSON/Serializable_arginfo.h create mode 100644 src/BSON/Symbol.stub.php create mode 100644 src/BSON/Symbol_arginfo.h create mode 100644 src/BSON/Timestamp.stub.php create mode 100644 src/BSON/TimestampInterface.stub.php create mode 100644 src/BSON/TimestampInterface_arginfo.h create mode 100644 src/BSON/Timestamp_arginfo.h create mode 100644 src/BSON/UTCDateTime.stub.php create mode 100644 src/BSON/UTCDateTimeInterface.stub.php create mode 100644 src/BSON/UTCDateTimeInterface_arginfo.h create mode 100644 src/BSON/UTCDateTime_arginfo.h create mode 100644 src/BSON/Undefined.stub.php create mode 100644 src/BSON/Undefined_arginfo.h create mode 100644 src/BSON/Unserializable.stub.php create mode 100644 src/BSON/Unserializable_arginfo.h diff --git a/.gitignore b/.gitignore index 8695a1183..4f8e0bf72 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ mongocryptd.pid *.out *.mem *.php +!*.stub.php tests/*/*.sh tests/*/*/*/*.sh tests/*/*/*/*/*.sh diff --git a/scripts/clang-format.sh b/scripts/clang-format.sh index e414869db..d454b485a 100755 --- a/scripts/clang-format.sh +++ b/scripts/clang-format.sh @@ -3,12 +3,12 @@ CLANG_ARGS="-Werror" if test x"$1" = xchanged; then - FILES1=`git ls-files | grep -v "src/contrib" | grep '\.[ch]$'` - FILES2=`git ls-files --others --exclude-standard | grep -v "src/contrib" | grep '\.[ch]$'` + FILES1=`git ls-files | grep -v "src/contrib" | grep -v "_arginfo.h" | grep '\.[ch]$'` + FILES2=`git ls-files --others --exclude-standard | grep -v "src/contrib" | grep -v "_arginfo.h" | grep '\.[ch]$'` FILES="$FILES1 $FILES2" else - FILES1=`git ls-files | grep -v "src/contrib" | grep '\.[ch]$'` - FILES2=`git ls-files --others --exclude-standard | grep -v "src/contrib" | grep '\.[ch]$'` + FILES1=`git ls-files | grep -v "src/contrib" | grep -v "_arginfo.h" | grep '\.[ch]$'` + FILES2=`git ls-files --others --exclude-standard | grep -v "src/contrib" | grep -v "_arginfo.h" | grep '\.[ch]$'` FILES="$FILES1 $FILES2" fi diff --git a/src/BSON/Binary.c b/src/BSON/Binary.c index 3f993d7bf..c190bab7b 100644 --- a/src/BSON/Binary.c +++ b/src/BSON/Binary.c @@ -22,6 +22,7 @@ #include "php_phongo.h" #include "phongo_error.h" +#include "Binary_arginfo.h" #define PHONGO_BINARY_UUID_SIZE 16 @@ -92,7 +93,7 @@ static HashTable* php_phongo_binary_get_properties_hash(phongo_compat_object_han /* {{{ proto void MongoDB\BSON\Binary::__construct(string $data, int $type) Construct a new BSON binary type */ -static PHP_METHOD(Binary, __construct) +PHP_METHOD(MongoDB_BSON_Binary, __construct) { php_phongo_binary_t* intern; char* data; @@ -111,7 +112,7 @@ static PHP_METHOD(Binary, __construct) /* {{{ proto MongoDB\BSON\Binary MongoDB\BSON\Binary::__set_state(array $properties) */ -static PHP_METHOD(Binary, __set_state) +PHP_METHOD(MongoDB_BSON_Binary, __set_state) { php_phongo_binary_t* intern; HashTable* props; @@ -131,7 +132,7 @@ static PHP_METHOD(Binary, __set_state) /* {{{ proto string MongoDB\BSON\Binary::__toString() Return the Binary's data string. */ -static PHP_METHOD(Binary, __toString) +PHP_METHOD(MongoDB_BSON_Binary, __toString) { php_phongo_binary_t* intern; @@ -144,7 +145,7 @@ static PHP_METHOD(Binary, __toString) /* {{{ proto string MongoDB\BSON\Binary::getData() */ -static PHP_METHOD(Binary, getData) +PHP_METHOD(MongoDB_BSON_Binary, getData) { php_phongo_binary_t* intern; @@ -157,7 +158,7 @@ static PHP_METHOD(Binary, getData) /* {{{ proto integer MongoDB\BSON\Binary::getType() */ -static PHP_METHOD(Binary, getType) +PHP_METHOD(MongoDB_BSON_Binary, getType) { php_phongo_binary_t* intern; @@ -170,7 +171,7 @@ static PHP_METHOD(Binary, getType) /* {{{ proto array MongoDB\BSON\Binary::jsonSerialize() */ -static PHP_METHOD(Binary, jsonSerialize) +PHP_METHOD(MongoDB_BSON_Binary, jsonSerialize) { php_phongo_binary_t* intern; char type[3]; @@ -194,7 +195,7 @@ static PHP_METHOD(Binary, jsonSerialize) /* {{{ proto string MongoDB\BSON\Binary::serialize() */ -static PHP_METHOD(Binary, serialize) +PHP_METHOD(MongoDB_BSON_Binary, serialize) { php_phongo_binary_t* intern; zval retval; @@ -222,7 +223,7 @@ static PHP_METHOD(Binary, serialize) /* {{{ proto void MongoDB\BSON\Binary::unserialize(string $serialized) */ -static PHP_METHOD(Binary, unserialize) +PHP_METHOD(MongoDB_BSON_Binary, unserialize) { php_phongo_binary_t* intern; char* serialized; @@ -252,7 +253,7 @@ static PHP_METHOD(Binary, unserialize) /* {{{ proto array MongoDB\Driver\Binary::__serialize() */ -static PHP_METHOD(Binary, __serialize) +PHP_METHOD(MongoDB_BSON_Binary, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -261,7 +262,7 @@ static PHP_METHOD(Binary, __serialize) /* {{{ proto void MongoDB\Driver\Binary::__unserialize(array $data) */ -static PHP_METHOD(Binary, __unserialize) +PHP_METHOD(MongoDB_BSON_Binary, __unserialize) { zval* data; @@ -272,50 +273,6 @@ static PHP_METHOD(Binary, __unserialize) php_phongo_binary_init_from_hash(Z_BINARY_OBJ_P(getThis()), Z_ARRVAL_P(data)); } /* }}} */ -/* {{{ MongoDB\BSON\Binary function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_INFO_EX(ai_Binary___construct, 0, 0, 2) - ZEND_ARG_INFO(0, data) - ZEND_ARG_INFO(0, type) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Binary___set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, properties, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_Binary___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Binary___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_Binary_jsonSerialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Binary_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Binary_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_binary_me[] = { - PHP_ME(Binary, __construct, ai_Binary___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Binary, __serialize, ai_Binary_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Binary, __set_state, ai_Binary___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Binary, __toString, ai_Binary___toString, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Binary, __unserialize, ai_Binary___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Binary, jsonSerialize, ai_Binary_jsonSerialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Binary, serialize, ai_Binary_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Binary, unserialize, ai_Binary_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Binary, getData, ai_Binary_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Binary, getType, ai_Binary_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - /* {{{ MongoDB\BSON\Binary object handlers */ static zend_object_handlers php_phongo_handler_binary; @@ -402,7 +359,7 @@ void php_phongo_binary_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Binary", php_phongo_binary_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Binary", class_MongoDB_BSON_Binary_methods); php_phongo_binary_ce = zend_register_internal_class(&ce); php_phongo_binary_ce->create_object = php_phongo_binary_create_object; PHONGO_CE_FINAL(php_phongo_binary_ce); diff --git a/src/BSON/Binary.stub.php b/src/BSON/Binary.stub.php new file mode 100644 index 000000000..148a1e0fc --- /dev/null +++ b/src/BSON/Binary.stub.php @@ -0,0 +1,35 @@ += 80000 + final public function jsonSerialize(): mixed {} +#else + /** @return mixed */ + final public function jsonSerialize() {} +#endif + } +} diff --git a/src/BSON/BinaryInterface.c b/src/BSON/BinaryInterface.c index 2d02e7d97..2bd4b7838 100644 --- a/src/BSON/BinaryInterface.c +++ b/src/BSON/BinaryInterface.c @@ -17,30 +17,14 @@ #include #include "php_phongo.h" +#include "BinaryInterface_arginfo.h" zend_class_entry* php_phongo_binary_interface_ce; -/* {{{ MongoDB\BSON\BinaryInterface function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_BinaryInterface___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_BinaryInterface_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_binary_interface_me[] = { - ZEND_ABSTRACT_ME(BinaryInterface, getData, ai_BinaryInterface_void) - ZEND_ABSTRACT_ME(BinaryInterface, getType, ai_BinaryInterface_void) - ZEND_ABSTRACT_ME(BinaryInterface, __toString, ai_BinaryInterface___toString) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - void php_phongo_binary_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "BinaryInterface", php_phongo_binary_interface_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "BinaryInterface", class_MongoDB_BSON_BinaryInterface_methods); php_phongo_binary_interface_ce = zend_register_internal_interface(&ce); } /* }}} */ diff --git a/src/BSON/BinaryInterface.stub.php b/src/BSON/BinaryInterface.stub.php new file mode 100644 index 000000000..fd16f3b09 --- /dev/null +++ b/src/BSON/BinaryInterface.stub.php @@ -0,0 +1,18 @@ += 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Binary_jsonSerialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Binary_jsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + + +ZEND_METHOD(MongoDB_BSON_Binary, __construct); +ZEND_METHOD(MongoDB_BSON_Binary, getData); +ZEND_METHOD(MongoDB_BSON_Binary, getType); +ZEND_METHOD(MongoDB_BSON_Binary, __set_state); +ZEND_METHOD(MongoDB_BSON_Binary, __toString); +ZEND_METHOD(MongoDB_BSON_Binary, serialize); +ZEND_METHOD(MongoDB_BSON_Binary, unserialize); +ZEND_METHOD(MongoDB_BSON_Binary, __unserialize); +ZEND_METHOD(MongoDB_BSON_Binary, __serialize); +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_Binary, jsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_Binary, jsonSerialize); +#endif + + +static const zend_function_entry class_MongoDB_BSON_Binary_methods[] = { + ZEND_ME(MongoDB_BSON_Binary, __construct, arginfo_class_MongoDB_BSON_Binary___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Binary, getData, arginfo_class_MongoDB_BSON_Binary_getData, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Binary, getType, arginfo_class_MongoDB_BSON_Binary_getType, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Binary, __set_state, arginfo_class_MongoDB_BSON_Binary___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(MongoDB_BSON_Binary, __toString, arginfo_class_MongoDB_BSON_Binary___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Binary, serialize, arginfo_class_MongoDB_BSON_Binary_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Binary, unserialize, arginfo_class_MongoDB_BSON_Binary_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Binary, __unserialize, arginfo_class_MongoDB_BSON_Binary___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Binary, __serialize, arginfo_class_MongoDB_BSON_Binary___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_Binary, jsonSerialize, arginfo_class_MongoDB_BSON_Binary_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_Binary, jsonSerialize, arginfo_class_MongoDB_BSON_Binary_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; diff --git a/src/BSON/DBPointer.c b/src/BSON/DBPointer.c index e1d954876..0c651e41c 100644 --- a/src/BSON/DBPointer.c +++ b/src/BSON/DBPointer.c @@ -23,6 +23,7 @@ #include "php_phongo.h" #include "phongo_error.h" +#include "DBPointer_arginfo.h" zend_class_entry* php_phongo_dbpointer_ce; @@ -90,9 +91,11 @@ HashTable* php_phongo_dbpointer_get_properties_hash(phongo_compat_object_handler return props; } /* }}} */ +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_BSON_DBPointer) + /* {{{ proto string MongoDB\BSON\DBPointer::__toString() Return the DBPointer's namespace string and ObjectId. */ -static PHP_METHOD(DBPointer, __toString) +PHP_METHOD(MongoDB_BSON_DBPointer, __toString) { php_phongo_dbpointer_t* intern; char* retval; @@ -109,7 +112,7 @@ static PHP_METHOD(DBPointer, __toString) /* {{{ proto array MongoDB\BSON\Symbol::jsonSerialize() */ -static PHP_METHOD(DBPointer, jsonSerialize) +PHP_METHOD(MongoDB_BSON_DBPointer, jsonSerialize) { php_phongo_dbpointer_t* intern; zval zdb_pointer; @@ -131,7 +134,7 @@ static PHP_METHOD(DBPointer, jsonSerialize) /* {{{ proto string MongoDB\BSON\DBPointer::serialize() */ -static PHP_METHOD(DBPointer, serialize) +PHP_METHOD(MongoDB_BSON_DBPointer, serialize) { php_phongo_dbpointer_t* intern; zval retval; @@ -159,7 +162,7 @@ static PHP_METHOD(DBPointer, serialize) /* {{{ proto void MongoDB\BSON\DBPointer::unserialize(string $serialized) */ -static PHP_METHOD(DBPointer, unserialize) +PHP_METHOD(MongoDB_BSON_DBPointer, unserialize) { php_phongo_dbpointer_t* intern; char* serialized; @@ -189,7 +192,7 @@ static PHP_METHOD(DBPointer, unserialize) /* {{{ proto array MongoDB\Driver\DBPointer::__serialize() */ -static PHP_METHOD(DBPointer, __serialize) +PHP_METHOD(MongoDB_BSON_DBPointer, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -198,7 +201,7 @@ static PHP_METHOD(DBPointer, __serialize) /* {{{ proto void MongoDB\Driver\DBPointer::__unserialize(array $data) */ -static PHP_METHOD(DBPointer, __unserialize) +PHP_METHOD(MongoDB_BSON_DBPointer, __unserialize) { zval* data; @@ -209,39 +212,6 @@ static PHP_METHOD(DBPointer, __unserialize) php_phongo_dbpointer_init_from_hash(Z_DBPOINTER_OBJ_P(getThis()), Z_ARRVAL_P(data)); } /* }}} */ -/* {{{ MongoDB\BSON\DBPointer function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_DBPointer___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_DBPointer___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_DBPointer_jsonSerialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_DBPointer_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_DBPointer_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_dbpointer_me[] = { - /* __set_state intentionally missing */ - PHP_ME(DBPointer, __serialize, ai_DBPointer_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(DBPointer, __toString, ai_DBPointer___toString, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(DBPointer, __unserialize, ai_DBPointer___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(DBPointer, jsonSerialize, ai_DBPointer_jsonSerialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(DBPointer, serialize, ai_DBPointer_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(DBPointer, unserialize, ai_DBPointer_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_DBPointer_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - /* {{{ MongoDB\BSON\DBPointer object handlers */ static zend_object_handlers php_phongo_handler_dbpointer; @@ -325,7 +295,7 @@ void php_phongo_dbpointer_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "DBPointer", php_phongo_dbpointer_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "DBPointer", class_MongoDB_BSON_DBPointer_methods); php_phongo_dbpointer_ce = zend_register_internal_class(&ce); php_phongo_dbpointer_ce->create_object = php_phongo_dbpointer_create_object; PHONGO_CE_FINAL(php_phongo_dbpointer_ce); diff --git a/src/BSON/DBPointer.stub.php b/src/BSON/DBPointer.stub.php new file mode 100644 index 000000000..9e29007ab --- /dev/null +++ b/src/BSON/DBPointer.stub.php @@ -0,0 +1,29 @@ += 80000 + final public function jsonSerialize(): mixed {} +#else + /** @return mixed */ + final public function jsonSerialize() {} +#endif + } +} diff --git a/src/BSON/DBPointer_arginfo.h b/src/BSON/DBPointer_arginfo.h new file mode 100644 index 000000000..f29c7fcbb --- /dev/null +++ b/src/BSON/DBPointer_arginfo.h @@ -0,0 +1,62 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: cb2b4641c0a3de9a938b4515667a976e9f21ec50 */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer___construct, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer___toString, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_BSON_DBPointer_serialize arginfo_class_MongoDB_BSON_DBPointer___toString + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer___unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer___serialize, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer_jsonSerialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer_jsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + + +ZEND_METHOD(MongoDB_BSON_DBPointer, __construct); +ZEND_METHOD(MongoDB_BSON_DBPointer, __toString); +ZEND_METHOD(MongoDB_BSON_DBPointer, serialize); +ZEND_METHOD(MongoDB_BSON_DBPointer, unserialize); +ZEND_METHOD(MongoDB_BSON_DBPointer, __unserialize); +ZEND_METHOD(MongoDB_BSON_DBPointer, __serialize); +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_DBPointer, jsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_DBPointer, jsonSerialize); +#endif + + +static const zend_function_entry class_MongoDB_BSON_DBPointer_methods[] = { + ZEND_ME(MongoDB_BSON_DBPointer, __construct, arginfo_class_MongoDB_BSON_DBPointer___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_DBPointer, __toString, arginfo_class_MongoDB_BSON_DBPointer___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_DBPointer, serialize, arginfo_class_MongoDB_BSON_DBPointer_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_DBPointer, unserialize, arginfo_class_MongoDB_BSON_DBPointer_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_DBPointer, __unserialize, arginfo_class_MongoDB_BSON_DBPointer___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_DBPointer, __serialize, arginfo_class_MongoDB_BSON_DBPointer___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_DBPointer, jsonSerialize, arginfo_class_MongoDB_BSON_DBPointer_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_DBPointer, jsonSerialize, arginfo_class_MongoDB_BSON_DBPointer_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; diff --git a/src/BSON/Decimal128.c b/src/BSON/Decimal128.c index 21c5a9d1c..ffd34bb8f 100644 --- a/src/BSON/Decimal128.c +++ b/src/BSON/Decimal128.c @@ -23,6 +23,7 @@ #include "php_phongo.h" #include "phongo_error.h" +#include "Decimal128_arginfo.h" zend_class_entry* php_phongo_decimal128_ce; @@ -82,7 +83,7 @@ static HashTable* php_phongo_decimal128_get_properties_hash(phongo_compat_object /* {{{ proto void MongoDB\BSON\Decimal128::__construct(string $value) Construct a new BSON Decimal128 type */ -static PHP_METHOD(Decimal128, __construct) +PHP_METHOD(MongoDB_BSON_Decimal128, __construct) { php_phongo_decimal128_t* intern; char* value; @@ -99,7 +100,7 @@ static PHP_METHOD(Decimal128, __construct) /* {{{ proto MongoDB\BSON\Decimal128 MongoDB\BSON\Decimal128::__set_state(array $properties) */ -static PHP_METHOD(Decimal128, __set_state) +PHP_METHOD(MongoDB_BSON_Decimal128, __set_state) { php_phongo_decimal128_t* intern; HashTable* props; @@ -119,7 +120,7 @@ static PHP_METHOD(Decimal128, __set_state) /* {{{ proto string MongoDB\BSON\Decimal128::__toString() */ -static PHP_METHOD(Decimal128, __toString) +PHP_METHOD(MongoDB_BSON_Decimal128, __toString) { php_phongo_decimal128_t* intern; char outbuf[BSON_DECIMAL128_STRING]; @@ -135,7 +136,7 @@ static PHP_METHOD(Decimal128, __toString) /* {{{ proto array MongoDB\BSON\Decimal128::jsonSerialize() */ -static PHP_METHOD(Decimal128, jsonSerialize) +PHP_METHOD(MongoDB_BSON_Decimal128, jsonSerialize) { php_phongo_decimal128_t* intern; char outbuf[BSON_DECIMAL128_STRING] = ""; @@ -151,7 +152,7 @@ static PHP_METHOD(Decimal128, jsonSerialize) /* {{{ proto string MongoDB\BSON\Decimal128::serialize() */ -static PHP_METHOD(Decimal128, serialize) +PHP_METHOD(MongoDB_BSON_Decimal128, serialize) { php_phongo_decimal128_t* intern; zval retval; @@ -180,7 +181,7 @@ static PHP_METHOD(Decimal128, serialize) /* {{{ proto void MongoDB\BSON\Decimal128::unserialize(string $serialized) */ -static PHP_METHOD(Decimal128, unserialize) +PHP_METHOD(MongoDB_BSON_Decimal128, unserialize) { php_phongo_decimal128_t* intern; char* serialized; @@ -210,7 +211,7 @@ static PHP_METHOD(Decimal128, unserialize) /* {{{ proto array MongoDB\Driver\Decimal128::__serialize() */ -static PHP_METHOD(Decimal128, __serialize) +PHP_METHOD(MongoDB_BSON_Decimal128, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -219,7 +220,7 @@ static PHP_METHOD(Decimal128, __serialize) /* {{{ proto void MongoDB\Driver\Decimal128::__unserialize(array $data) */ -static PHP_METHOD(Decimal128, __unserialize) +PHP_METHOD(MongoDB_BSON_Decimal128, __unserialize) { zval* data; @@ -230,47 +231,6 @@ static PHP_METHOD(Decimal128, __unserialize) php_phongo_decimal128_init_from_hash(Z_DECIMAL128_OBJ_P(getThis()), Z_ARRVAL_P(data)); } /* }}} */ -/* {{{ MongoDB\BSON\Decimal128 function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_INFO_EX(ai_Decimal128___construct, 0, 0, 1) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Decimal128___set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, properties, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_Decimal128___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Decimal128___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_Decimal128_jsonSerialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Decimal128_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Decimal128_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_decimal128_me[] = { - PHP_ME(Decimal128, __construct, ai_Decimal128___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Decimal128, __serialize, ai_Decimal128_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Decimal128, __set_state, ai_Decimal128___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Decimal128, __toString, ai_Decimal128___toString, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Decimal128, __unserialize, ai_Decimal128___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Decimal128, jsonSerialize, ai_Decimal128_jsonSerialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Decimal128, serialize, ai_Decimal128_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Decimal128, unserialize, ai_Decimal128_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - /* {{{ MongoDB\BSON\Decimal128 object handlers */ static zend_object_handlers php_phongo_handler_decimal128; @@ -333,7 +293,7 @@ void php_phongo_decimal128_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Decimal128", php_phongo_decimal128_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Decimal128", class_MongoDB_BSON_Decimal128_methods); php_phongo_decimal128_ce = zend_register_internal_class(&ce); php_phongo_decimal128_ce->create_object = php_phongo_decimal128_create_object; PHONGO_CE_FINAL(php_phongo_decimal128_ce); diff --git a/src/BSON/Decimal128.stub.php b/src/BSON/Decimal128.stub.php new file mode 100644 index 000000000..ddc53b232 --- /dev/null +++ b/src/BSON/Decimal128.stub.php @@ -0,0 +1,31 @@ += 80000 + final public function jsonSerialize(): mixed {} +#else + /** @return mixed */ + final public function jsonSerialize() {} +#endif + } +} diff --git a/src/BSON/Decimal128Interface.c b/src/BSON/Decimal128Interface.c index f4d559611..ed87a2d94 100644 --- a/src/BSON/Decimal128Interface.c +++ b/src/BSON/Decimal128Interface.c @@ -17,25 +17,14 @@ #include #include "php_phongo.h" +#include "Decimal128Interface_arginfo.h" zend_class_entry* php_phongo_decimal128_interface_ce; -/* {{{ MongoDB\BSON\Decimal128Interface function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_Decimal128Interface___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_decimal128_interface_me[] = { - ZEND_ABSTRACT_ME(Decimal128Interface, __toString, ai_Decimal128Interface___toString) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - void php_phongo_decimal128_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Decimal128Interface", php_phongo_decimal128_interface_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Decimal128Interface", class_MongoDB_BSON_Decimal128Interface_methods); php_phongo_decimal128_interface_ce = zend_register_internal_interface(&ce); } /* }}} */ diff --git a/src/BSON/Decimal128Interface.stub.php b/src/BSON/Decimal128Interface.stub.php new file mode 100644 index 000000000..c20e359f1 --- /dev/null +++ b/src/BSON/Decimal128Interface.stub.php @@ -0,0 +1,12 @@ += 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128_jsonSerialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128_jsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + + +ZEND_METHOD(MongoDB_BSON_Decimal128, __construct); +ZEND_METHOD(MongoDB_BSON_Decimal128, __toString); +ZEND_METHOD(MongoDB_BSON_Decimal128, __set_state); +ZEND_METHOD(MongoDB_BSON_Decimal128, serialize); +ZEND_METHOD(MongoDB_BSON_Decimal128, unserialize); +ZEND_METHOD(MongoDB_BSON_Decimal128, __unserialize); +ZEND_METHOD(MongoDB_BSON_Decimal128, __serialize); +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_Decimal128, jsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_Decimal128, jsonSerialize); +#endif + + +static const zend_function_entry class_MongoDB_BSON_Decimal128_methods[] = { + ZEND_ME(MongoDB_BSON_Decimal128, __construct, arginfo_class_MongoDB_BSON_Decimal128___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Decimal128, __toString, arginfo_class_MongoDB_BSON_Decimal128___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Decimal128, __set_state, arginfo_class_MongoDB_BSON_Decimal128___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(MongoDB_BSON_Decimal128, serialize, arginfo_class_MongoDB_BSON_Decimal128_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Decimal128, unserialize, arginfo_class_MongoDB_BSON_Decimal128_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Decimal128, __unserialize, arginfo_class_MongoDB_BSON_Decimal128___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Decimal128, __serialize, arginfo_class_MongoDB_BSON_Decimal128___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_Decimal128, jsonSerialize, arginfo_class_MongoDB_BSON_Decimal128_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_Decimal128, jsonSerialize, arginfo_class_MongoDB_BSON_Decimal128_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; diff --git a/src/BSON/Int64.c b/src/BSON/Int64.c index f570a3cec..cca087579 100644 --- a/src/BSON/Int64.c +++ b/src/BSON/Int64.c @@ -22,6 +22,7 @@ #include "php_phongo.h" #include "phongo_error.h" #include "phongo_util.h" +#include "Int64_arginfo.h" zend_class_entry* php_phongo_int64_ce; @@ -85,9 +86,11 @@ HashTable* php_phongo_int64_get_properties_hash(phongo_compat_object_handler_typ return props; } /* }}} */ +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_BSON_Int64) + /* {{{ proto string MongoDB\BSON\Int64::__toString() Return the Int64's value as a string. */ -static PHP_METHOD(Int64, __toString) +PHP_METHOD(MongoDB_BSON_Int64, __toString) { php_phongo_int64_t* intern; @@ -100,7 +103,7 @@ static PHP_METHOD(Int64, __toString) /* {{{ proto array MongoDB\BSON\Int64::jsonSerialize() */ -static PHP_METHOD(Int64, jsonSerialize) +PHP_METHOD(MongoDB_BSON_Int64, jsonSerialize) { php_phongo_int64_t* intern; @@ -115,7 +118,7 @@ static PHP_METHOD(Int64, jsonSerialize) /* {{{ proto string MongoDB\BSON\Int64::serialize() */ -static PHP_METHOD(Int64, serialize) +PHP_METHOD(MongoDB_BSON_Int64, serialize) { php_phongo_int64_t* intern; zval retval; @@ -142,7 +145,7 @@ static PHP_METHOD(Int64, serialize) /* {{{ proto void MongoDB\BSON\Int64::unserialize(string $serialized) */ -static PHP_METHOD(Int64, unserialize) +PHP_METHOD(MongoDB_BSON_Int64, unserialize) { php_phongo_int64_t* intern; char* serialized; @@ -172,7 +175,7 @@ static PHP_METHOD(Int64, unserialize) /* {{{ proto array MongoDB\Driver\Int64::__serialize() */ -static PHP_METHOD(Int64, __serialize) +PHP_METHOD(MongoDB_BSON_Int64, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -181,7 +184,7 @@ static PHP_METHOD(Int64, __serialize) /* {{{ proto void MongoDB\Driver\Int64::__unserialize(array $data) */ -static PHP_METHOD(Int64, __unserialize) +PHP_METHOD(MongoDB_BSON_Int64, __unserialize) { zval* data; @@ -192,39 +195,6 @@ static PHP_METHOD(Int64, __unserialize) php_phongo_int64_init_from_hash(Z_INT64_OBJ_P(getThis()), Z_ARRVAL_P(data)); } /* }}} */ -/* {{{ MongoDB\BSON\Int64 function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_Int64___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Int64___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_Int64_jsonSerialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Int64_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Int64_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_int64_me[] = { - /* __set_state intentionally missing */ - PHP_ME(Int64, __serialize, ai_Int64_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Int64, __toString, ai_Int64___toString, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Int64, __unserialize, ai_Int64___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Int64, jsonSerialize, ai_Int64_jsonSerialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Int64, serialize, ai_Int64_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Int64, unserialize, ai_Int64_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Int64_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - /* {{{ MongoDB\BSON\Int64 object handlers */ static zend_object_handlers php_phongo_handler_int64; @@ -301,7 +271,7 @@ void php_phongo_int64_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Int64", php_phongo_int64_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Int64", class_MongoDB_BSON_Int64_methods); php_phongo_int64_ce = zend_register_internal_class(&ce); php_phongo_int64_ce->create_object = php_phongo_int64_create_object; PHONGO_CE_FINAL(php_phongo_int64_ce); diff --git a/src/BSON/Int64.stub.php b/src/BSON/Int64.stub.php new file mode 100644 index 000000000..be13d990a --- /dev/null +++ b/src/BSON/Int64.stub.php @@ -0,0 +1,29 @@ += 80000 + final public function jsonSerialize(): mixed {} +#else + /** @return mixed */ + final public function jsonSerialize() {} +#endif + } +} diff --git a/src/BSON/Int64_arginfo.h b/src/BSON/Int64_arginfo.h new file mode 100644 index 000000000..f769d51bb --- /dev/null +++ b/src/BSON/Int64_arginfo.h @@ -0,0 +1,62 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 23a49399030aec0b31a2a2136032866c40962842 */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Int64___construct, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Int64___toString, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_BSON_Int64_serialize arginfo_class_MongoDB_BSON_Int64___toString + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Int64_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Int64___unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Int64___serialize, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Int64_jsonSerialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Int64_jsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + + +ZEND_METHOD(MongoDB_BSON_Int64, __construct); +ZEND_METHOD(MongoDB_BSON_Int64, __toString); +ZEND_METHOD(MongoDB_BSON_Int64, serialize); +ZEND_METHOD(MongoDB_BSON_Int64, unserialize); +ZEND_METHOD(MongoDB_BSON_Int64, __unserialize); +ZEND_METHOD(MongoDB_BSON_Int64, __serialize); +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_Int64, jsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_Int64, jsonSerialize); +#endif + + +static const zend_function_entry class_MongoDB_BSON_Int64_methods[] = { + ZEND_ME(MongoDB_BSON_Int64, __construct, arginfo_class_MongoDB_BSON_Int64___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Int64, __toString, arginfo_class_MongoDB_BSON_Int64___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Int64, serialize, arginfo_class_MongoDB_BSON_Int64_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Int64, unserialize, arginfo_class_MongoDB_BSON_Int64_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Int64, __unserialize, arginfo_class_MongoDB_BSON_Int64___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Int64, __serialize, arginfo_class_MongoDB_BSON_Int64___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_Int64, jsonSerialize, arginfo_class_MongoDB_BSON_Int64_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_Int64, jsonSerialize, arginfo_class_MongoDB_BSON_Int64_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; diff --git a/src/BSON/Javascript.c b/src/BSON/Javascript.c index d157b1d85..8a1f0c3da 100644 --- a/src/BSON/Javascript.c +++ b/src/BSON/Javascript.c @@ -24,6 +24,7 @@ #include "php_phongo.h" #include "phongo_bson_encode.h" #include "phongo_error.h" +#include "Javascript_arginfo.h" zend_class_entry* php_phongo_javascript_ce; @@ -118,7 +119,7 @@ HashTable* php_phongo_javascript_get_properties_hash(phongo_compat_object_handle Construct a new BSON Javascript type. The scope is a document mapping identifiers and values, representing the scope in which the code string will be evaluated. Note that this type cannot be represented as Extended JSON. */ -static PHP_METHOD(Javascript, __construct) +PHP_METHOD(MongoDB_BSON_Javascript, __construct) { php_phongo_javascript_t* intern; char* code; @@ -138,7 +139,7 @@ static PHP_METHOD(Javascript, __construct) /* {{{ proto MongoDB\BSON\Javascript MongoDB\BSON\Javascript::__set_state(array $properties) */ -static PHP_METHOD(Javascript, __set_state) +PHP_METHOD(MongoDB_BSON_Javascript, __set_state) { php_phongo_javascript_t* intern; HashTable* props; @@ -158,7 +159,7 @@ static PHP_METHOD(Javascript, __set_state) /* {{{ proto string MongoDB\BSON\Javascript::__toString() Return the Javascript's code string. */ -static PHP_METHOD(Javascript, __toString) +PHP_METHOD(MongoDB_BSON_Javascript, __toString) { php_phongo_javascript_t* intern; @@ -171,7 +172,7 @@ static PHP_METHOD(Javascript, __toString) /* {{{ proto string MongoDB\BSON\Javascript::getCode() */ -static PHP_METHOD(Javascript, getCode) +PHP_METHOD(MongoDB_BSON_Javascript, getCode) { php_phongo_javascript_t* intern; @@ -184,7 +185,7 @@ static PHP_METHOD(Javascript, getCode) /* {{{ proto object|null MongoDB\BSON\Javascript::getScope() */ -static PHP_METHOD(Javascript, getScope) +PHP_METHOD(MongoDB_BSON_Javascript, getScope) { php_phongo_javascript_t* intern; @@ -214,7 +215,7 @@ static PHP_METHOD(Javascript, getScope) /* {{{ proto array MongoDB\BSON\Javascript::jsonSerialize() */ -static PHP_METHOD(Javascript, jsonSerialize) +PHP_METHOD(MongoDB_BSON_Javascript, jsonSerialize) { php_phongo_javascript_t* intern; @@ -240,7 +241,7 @@ static PHP_METHOD(Javascript, jsonSerialize) /* {{{ proto string MongoDB\BSON\Javascript::serialize() */ -static PHP_METHOD(Javascript, serialize) +PHP_METHOD(MongoDB_BSON_Javascript, serialize) { php_phongo_javascript_t* intern; zval retval; @@ -280,7 +281,7 @@ static PHP_METHOD(Javascript, serialize) /* {{{ proto void MongoDB\BSON\Javascript::unserialize(string $serialized) */ -static PHP_METHOD(Javascript, unserialize) +PHP_METHOD(MongoDB_BSON_Javascript, unserialize) { php_phongo_javascript_t* intern; char* serialized; @@ -310,7 +311,7 @@ static PHP_METHOD(Javascript, unserialize) /* {{{ proto array MongoDB\Driver\Javascript::__serialize() */ -static PHP_METHOD(Javascript, __serialize) +PHP_METHOD(MongoDB_BSON_Javascript, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -319,7 +320,7 @@ static PHP_METHOD(Javascript, __serialize) /* {{{ proto void MongoDB\Driver\Javascript::__unserialize(array $data) */ -static PHP_METHOD(Javascript, __unserialize) +PHP_METHOD(MongoDB_BSON_Javascript, __unserialize) { zval* data; @@ -330,50 +331,6 @@ static PHP_METHOD(Javascript, __unserialize) php_phongo_javascript_init_from_hash(Z_JAVASCRIPT_OBJ_P(getThis()), Z_ARRVAL_P(data)); } /* }}} */ -/* {{{ MongoDB\BSON\Javascript function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_INFO_EX(ai_Javascript___construct, 0, 0, 1) - ZEND_ARG_INFO(0, javascript) - ZEND_ARG_INFO(0, scope) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Javascript___set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, properties, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_Javascript___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Javascript___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_Javascript_jsonSerialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Javascript_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Javascript_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_javascript_me[] = { - PHP_ME(Javascript, __construct, ai_Javascript___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Javascript, __serialize, ai_Javascript_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Javascript, __set_state, ai_Javascript___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Javascript, __toString, ai_Javascript___toString, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Javascript, __unserialize, ai_Javascript___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Javascript, jsonSerialize, ai_Javascript_jsonSerialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Javascript, serialize, ai_Javascript_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Javascript, unserialize, ai_Javascript_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Javascript, getCode, ai_Javascript_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Javascript, getScope, ai_Javascript_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - /* {{{ MongoDB\BSON\Javascript object handlers */ static zend_object_handlers php_phongo_handler_javascript; @@ -456,7 +413,7 @@ void php_phongo_javascript_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Javascript", php_phongo_javascript_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Javascript", class_MongoDB_BSON_Javascript_methods); php_phongo_javascript_ce = zend_register_internal_class(&ce); php_phongo_javascript_ce->create_object = php_phongo_javascript_create_object; PHONGO_CE_FINAL(php_phongo_javascript_ce); diff --git a/src/BSON/Javascript.stub.php b/src/BSON/Javascript.stub.php new file mode 100644 index 000000000..b472bf395 --- /dev/null +++ b/src/BSON/Javascript.stub.php @@ -0,0 +1,40 @@ += 80000 + final public function __construct(string $code, array|object|null $scope = null) {} +#else + /** @param array|object|null $scope */ + final public function __construct(string $code, $scope = null) {} +#endif + + public static function __set_state(array $properties): object {} + + final public function getCode(): string {} + + final public function getScope(): ?object {} + + final public function __toString(): string {} + + final public function serialize(): string {} + + /** @param string $serialized */ + final public function unserialize($serialized): void {} + + final public function __unserialize(array $data): void {} + + final public function __serialize(): array {} + +#if PHP_VERSION_ID >= 80000 + final public function jsonSerialize(): mixed {} +#else + /** @return mixed */ + final public function jsonSerialize() {} +#endif + } +} diff --git a/src/BSON/JavascriptInterface.c b/src/BSON/JavascriptInterface.c index a7f41476b..6dd1cfaac 100644 --- a/src/BSON/JavascriptInterface.c +++ b/src/BSON/JavascriptInterface.c @@ -17,30 +17,14 @@ #include #include "php_phongo.h" +#include "JavascriptInterface_arginfo.h" zend_class_entry* php_phongo_javascript_interface_ce; -/* {{{ MongoDB\BSON\JavascriptInterface function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_JavascriptInterface___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_JavascriptInterface_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_javascript_interface_me[] = { - ZEND_ABSTRACT_ME(JavascriptInterface, getCode, ai_JavascriptInterface_void) - ZEND_ABSTRACT_ME(JavascriptInterface, getScope, ai_JavascriptInterface_void) - ZEND_ABSTRACT_ME(JavascriptInterface, __toString, ai_JavascriptInterface___toString) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - void php_phongo_javascript_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "JavascriptInterface", php_phongo_javascript_interface_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "JavascriptInterface", class_MongoDB_BSON_JavascriptInterface_methods); php_phongo_javascript_interface_ce = zend_register_internal_interface(&ce); } /* }}} */ diff --git a/src/BSON/JavascriptInterface.stub.php b/src/BSON/JavascriptInterface.stub.php new file mode 100644 index 000000000..82162ac39 --- /dev/null +++ b/src/BSON/JavascriptInterface.stub.php @@ -0,0 +1,18 @@ += 80000 +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___construct, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, code, IS_STRING, 0) + ZEND_ARG_TYPE_MASK(0, scope, MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_NULL, "null") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___construct, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, code, IS_STRING, 0) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, scope, "null") +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___set_state, 0, 1, IS_OBJECT, 0) + ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Javascript_getCode, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Javascript_getScope, 0, 0, IS_OBJECT, 1) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_BSON_Javascript___toString arginfo_class_MongoDB_BSON_Javascript_getCode + +#define arginfo_class_MongoDB_BSON_Javascript_serialize arginfo_class_MongoDB_BSON_Javascript_getCode + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Javascript_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___serialize, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Javascript_jsonSerialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Javascript_jsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + + +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_Javascript, __construct); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_Javascript, __construct); +#endif +ZEND_METHOD(MongoDB_BSON_Javascript, __set_state); +ZEND_METHOD(MongoDB_BSON_Javascript, getCode); +ZEND_METHOD(MongoDB_BSON_Javascript, getScope); +ZEND_METHOD(MongoDB_BSON_Javascript, __toString); +ZEND_METHOD(MongoDB_BSON_Javascript, serialize); +ZEND_METHOD(MongoDB_BSON_Javascript, unserialize); +ZEND_METHOD(MongoDB_BSON_Javascript, __unserialize); +ZEND_METHOD(MongoDB_BSON_Javascript, __serialize); +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_Javascript, jsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_Javascript, jsonSerialize); +#endif + + +static const zend_function_entry class_MongoDB_BSON_Javascript_methods[] = { +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_Javascript, __construct, arginfo_class_MongoDB_BSON_Javascript___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_Javascript, __construct, arginfo_class_MongoDB_BSON_Javascript___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_BSON_Javascript, __set_state, arginfo_class_MongoDB_BSON_Javascript___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(MongoDB_BSON_Javascript, getCode, arginfo_class_MongoDB_BSON_Javascript_getCode, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Javascript, getScope, arginfo_class_MongoDB_BSON_Javascript_getScope, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Javascript, __toString, arginfo_class_MongoDB_BSON_Javascript___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Javascript, serialize, arginfo_class_MongoDB_BSON_Javascript_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Javascript, unserialize, arginfo_class_MongoDB_BSON_Javascript_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Javascript, __unserialize, arginfo_class_MongoDB_BSON_Javascript___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Javascript, __serialize, arginfo_class_MongoDB_BSON_Javascript___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_Javascript, jsonSerialize, arginfo_class_MongoDB_BSON_Javascript_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_Javascript, jsonSerialize, arginfo_class_MongoDB_BSON_Javascript_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; diff --git a/src/BSON/MaxKey.c b/src/BSON/MaxKey.c index a1f4ed8b3..bdeda03e6 100644 --- a/src/BSON/MaxKey.c +++ b/src/BSON/MaxKey.c @@ -21,12 +21,13 @@ #include "php_phongo.h" #include "phongo_error.h" +#include "MaxKey_arginfo.h" zend_class_entry* php_phongo_maxkey_ce; /* {{{ proto MongoDB\BSON\MaxKey MongoDB\BSON\MaxKey::__set_state(array $properties) */ -static PHP_METHOD(MaxKey, __set_state) +PHP_METHOD(MongoDB_BSON_MaxKey, __set_state) { zval* array; @@ -39,7 +40,7 @@ static PHP_METHOD(MaxKey, __set_state) /* {{{ proto array MongoDB\BSON\MaxKey::jsonSerialize() */ -static PHP_METHOD(MaxKey, jsonSerialize) +PHP_METHOD(MongoDB_BSON_MaxKey, jsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -49,7 +50,7 @@ static PHP_METHOD(MaxKey, jsonSerialize) /* {{{ proto string MongoDB\BSON\MaxKey::serialize() */ -static PHP_METHOD(MaxKey, serialize) +PHP_METHOD(MongoDB_BSON_MaxKey, serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -58,7 +59,7 @@ static PHP_METHOD(MaxKey, serialize) /* {{{ proto void MongoDB\BSON\MaxKey::unserialize(string $serialized) */ -static PHP_METHOD(MaxKey, unserialize) +PHP_METHOD(MongoDB_BSON_MaxKey, unserialize) { char* serialized; size_t serialized_len; @@ -70,7 +71,7 @@ static PHP_METHOD(MaxKey, unserialize) /* {{{ proto array MongoDB\Driver\MaxKey::__serialize() */ -static PHP_METHOD(MaxKey, __serialize) +PHP_METHOD(MongoDB_BSON_MaxKey, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -79,7 +80,7 @@ static PHP_METHOD(MaxKey, __serialize) /* {{{ proto void MongoDB\Driver\MaxKey::__unserialize(array $data) */ -static PHP_METHOD(MaxKey, __unserialize) +PHP_METHOD(MongoDB_BSON_MaxKey, __unserialize) { zval* data; @@ -88,38 +89,6 @@ static PHP_METHOD(MaxKey, __unserialize) PHONGO_PARSE_PARAMETERS_END(); } /* }}} */ -/* {{{ MongoDB\BSON\MaxKey function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_INFO_EX(ai_MaxKey___set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, properties, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_MaxKey___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_MaxKey_jsonSerialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_MaxKey_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_MaxKey_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_maxkey_me[] = { - PHP_ME(MaxKey, __serialize, ai_MaxKey_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(MaxKey, __set_state, ai_MaxKey___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(MaxKey, __unserialize, ai_MaxKey___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(MaxKey, jsonSerialize, ai_MaxKey_jsonSerialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(MaxKey, serialize, ai_MaxKey_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(MaxKey, unserialize, ai_MaxKey_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - /* {{{ MongoDB\BSON\MaxKey object handlers */ static zend_object_handlers php_phongo_handler_maxkey; @@ -147,7 +116,7 @@ void php_phongo_maxkey_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MaxKey", php_phongo_maxkey_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MaxKey", class_MongoDB_BSON_MaxKey_methods); php_phongo_maxkey_ce = zend_register_internal_class(&ce); php_phongo_maxkey_ce->create_object = php_phongo_maxkey_create_object; PHONGO_CE_FINAL(php_phongo_maxkey_ce); diff --git a/src/BSON/MaxKey.stub.php b/src/BSON/MaxKey.stub.php new file mode 100644 index 000000000..432f93be4 --- /dev/null +++ b/src/BSON/MaxKey.stub.php @@ -0,0 +1,27 @@ += 80000 + final public function jsonSerialize(): mixed {} +#else + /** @return mixed */ + final public function jsonSerialize() {} +#endif + } +} diff --git a/src/BSON/MaxKey_arginfo.h b/src/BSON/MaxKey_arginfo.h new file mode 100644 index 000000000..b41bb22bf --- /dev/null +++ b/src/BSON/MaxKey_arginfo.h @@ -0,0 +1,59 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 1a3f1ae78ba423da004c39927310bf4d3c83e515 */ + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey___set_state, 0, 1, IS_OBJECT, 0) + ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey_serialize, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey___unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey___serialize, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey_jsonSerialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey_jsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + + +ZEND_METHOD(MongoDB_BSON_MaxKey, __set_state); +ZEND_METHOD(MongoDB_BSON_MaxKey, serialize); +ZEND_METHOD(MongoDB_BSON_MaxKey, unserialize); +ZEND_METHOD(MongoDB_BSON_MaxKey, __unserialize); +ZEND_METHOD(MongoDB_BSON_MaxKey, __serialize); +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_MaxKey, jsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_MaxKey, jsonSerialize); +#endif + + +static const zend_function_entry class_MongoDB_BSON_MaxKey_methods[] = { + ZEND_ME(MongoDB_BSON_MaxKey, __set_state, arginfo_class_MongoDB_BSON_MaxKey___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(MongoDB_BSON_MaxKey, serialize, arginfo_class_MongoDB_BSON_MaxKey_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_MaxKey, unserialize, arginfo_class_MongoDB_BSON_MaxKey_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_MaxKey, __unserialize, arginfo_class_MongoDB_BSON_MaxKey___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_MaxKey, __serialize, arginfo_class_MongoDB_BSON_MaxKey___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_MaxKey, jsonSerialize, arginfo_class_MongoDB_BSON_MaxKey_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_MaxKey, jsonSerialize, arginfo_class_MongoDB_BSON_MaxKey_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; diff --git a/src/BSON/MinKey.c b/src/BSON/MinKey.c index e5bdc8d75..ad7fcc51e 100644 --- a/src/BSON/MinKey.c +++ b/src/BSON/MinKey.c @@ -21,12 +21,13 @@ #include "php_phongo.h" #include "phongo_error.h" +#include "MinKey_arginfo.h" zend_class_entry* php_phongo_minkey_ce; /* {{{ proto MongoDB\BSON\MinKey MongoDB\BSON\MinKey::__set_state(array $properties) */ -static PHP_METHOD(MinKey, __set_state) +PHP_METHOD(MongoDB_BSON_MinKey, __set_state) { zval* array; @@ -39,7 +40,7 @@ static PHP_METHOD(MinKey, __set_state) /* {{{ proto array MongoDB\BSON\MinKey::jsonSerialize() */ -static PHP_METHOD(MinKey, jsonSerialize) +PHP_METHOD(MongoDB_BSON_MinKey, jsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -49,7 +50,7 @@ static PHP_METHOD(MinKey, jsonSerialize) /* {{{ proto string MongoDB\BSON\MinKey::serialize() */ -static PHP_METHOD(MinKey, serialize) +PHP_METHOD(MongoDB_BSON_MinKey, serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -58,7 +59,7 @@ static PHP_METHOD(MinKey, serialize) /* {{{ proto void MongoDB\BSON\MinKey::unserialize(string $serialized) */ -static PHP_METHOD(MinKey, unserialize) +PHP_METHOD(MongoDB_BSON_MinKey, unserialize) { char* serialized; size_t serialized_len; @@ -70,7 +71,7 @@ static PHP_METHOD(MinKey, unserialize) /* {{{ proto array MongoDB\Driver\MinKey::__serialize() */ -static PHP_METHOD(MinKey, __serialize) +PHP_METHOD(MongoDB_BSON_MinKey, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -79,7 +80,7 @@ static PHP_METHOD(MinKey, __serialize) /* {{{ proto void MongoDB\Driver\MinKey::__unserialize(array $data) */ -static PHP_METHOD(MinKey, __unserialize) +PHP_METHOD(MongoDB_BSON_MinKey, __unserialize) { zval* data; @@ -88,38 +89,6 @@ static PHP_METHOD(MinKey, __unserialize) PHONGO_PARSE_PARAMETERS_END(); } /* }}} */ -/* {{{ MongoDB\BSON\MinKey function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_INFO_EX(ai_MinKey___set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, properties, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_MinKey___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_MinKey_jsonSerialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_MinKey_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_MinKey_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_minkey_me[] = { - PHP_ME(MinKey, __serialize, ai_MinKey_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(MinKey, __set_state, ai_MinKey___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(MinKey, __unserialize, ai_MinKey___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(MinKey, jsonSerialize, ai_MinKey_jsonSerialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(MinKey, serialize, ai_MinKey_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(MinKey, unserialize, ai_MinKey_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - /* {{{ MongoDB\BSON\MinKey object handlers */ static zend_object_handlers php_phongo_handler_minkey; @@ -147,7 +116,7 @@ void php_phongo_minkey_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MinKey", php_phongo_minkey_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MinKey", class_MongoDB_BSON_MinKey_methods); php_phongo_minkey_ce = zend_register_internal_class(&ce); php_phongo_minkey_ce->create_object = php_phongo_minkey_create_object; PHONGO_CE_FINAL(php_phongo_minkey_ce); diff --git a/src/BSON/MinKey.stub.php b/src/BSON/MinKey.stub.php new file mode 100644 index 000000000..f2be4e03e --- /dev/null +++ b/src/BSON/MinKey.stub.php @@ -0,0 +1,27 @@ += 80000 + final public function jsonSerialize(): mixed {} +#else + /** @return mixed */ + final public function jsonSerialize() {} +#endif + } +} diff --git a/src/BSON/MinKey_arginfo.h b/src/BSON/MinKey_arginfo.h new file mode 100644 index 000000000..509b18cdf --- /dev/null +++ b/src/BSON/MinKey_arginfo.h @@ -0,0 +1,59 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 1feadbbcb1410f2e8f679288d156dc20243d13c5 */ + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MinKey___set_state, 0, 1, IS_OBJECT, 0) + ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MinKey_serialize, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MinKey_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MinKey___unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MinKey___serialize, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MinKey_jsonSerialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_MinKey_jsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + + +ZEND_METHOD(MongoDB_BSON_MinKey, __set_state); +ZEND_METHOD(MongoDB_BSON_MinKey, serialize); +ZEND_METHOD(MongoDB_BSON_MinKey, unserialize); +ZEND_METHOD(MongoDB_BSON_MinKey, __unserialize); +ZEND_METHOD(MongoDB_BSON_MinKey, __serialize); +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_MinKey, jsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_MinKey, jsonSerialize); +#endif + + +static const zend_function_entry class_MongoDB_BSON_MinKey_methods[] = { + ZEND_ME(MongoDB_BSON_MinKey, __set_state, arginfo_class_MongoDB_BSON_MinKey___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(MongoDB_BSON_MinKey, serialize, arginfo_class_MongoDB_BSON_MinKey_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_MinKey, unserialize, arginfo_class_MongoDB_BSON_MinKey_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_MinKey, __unserialize, arginfo_class_MongoDB_BSON_MinKey___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_MinKey, __serialize, arginfo_class_MongoDB_BSON_MinKey___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_MinKey, jsonSerialize, arginfo_class_MongoDB_BSON_MinKey_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_MinKey, jsonSerialize, arginfo_class_MongoDB_BSON_MinKey_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; diff --git a/src/BSON/ObjectId.c b/src/BSON/ObjectId.c index 388c4a16a..bc990745d 100644 --- a/src/BSON/ObjectId.c +++ b/src/BSON/ObjectId.c @@ -23,6 +23,7 @@ #include "php_phongo.h" #include "phongo_error.h" +#include "ObjectId_arginfo.h" #define PHONGO_OID_SIZE sizeof(((php_phongo_objectid_t*) 0)->oid) #define PHONGO_OID_LEN (PHONGO_OID_SIZE - 1) @@ -103,7 +104,7 @@ static HashTable* php_phongo_objectid_get_properties_hash(phongo_compat_object_h /* {{{ proto void MongoDB\BSON\ObjectId::__construct([string $id]) Constructs a new BSON ObjectId type, optionally from a hex string. */ -static PHP_METHOD(ObjectId, __construct) +PHP_METHOD(MongoDB_BSON_ObjectId, __construct) { php_phongo_objectid_t* intern; char* id = NULL; @@ -125,7 +126,7 @@ static PHP_METHOD(ObjectId, __construct) /* {{{ proto integer MongoDB\BSON\ObjectId::getTimestamp() */ -static PHP_METHOD(ObjectId, getTimestamp) +PHP_METHOD(MongoDB_BSON_ObjectId, getTimestamp) { php_phongo_objectid_t* intern; bson_oid_t tmp_oid; @@ -140,7 +141,7 @@ static PHP_METHOD(ObjectId, getTimestamp) /* {{{ proto MongoDB\BSON\ObjectId MongoDB\BSON\ObjectId::__set_state(array $properties) */ -static PHP_METHOD(ObjectId, __set_state) +PHP_METHOD(MongoDB_BSON_ObjectId, __set_state) { php_phongo_objectid_t* intern; HashTable* props; @@ -160,7 +161,7 @@ static PHP_METHOD(ObjectId, __set_state) /* {{{ proto string MongoDB\BSON\ObjectId::__toString() */ -static PHP_METHOD(ObjectId, __toString) +PHP_METHOD(MongoDB_BSON_ObjectId, __toString) { php_phongo_objectid_t* intern; @@ -173,7 +174,7 @@ static PHP_METHOD(ObjectId, __toString) /* {{{ proto array MongoDB\BSON\ObjectId::jsonSerialize() */ -static PHP_METHOD(ObjectId, jsonSerialize) +PHP_METHOD(MongoDB_BSON_ObjectId, jsonSerialize) { php_phongo_objectid_t* intern; @@ -187,7 +188,7 @@ static PHP_METHOD(ObjectId, jsonSerialize) /* {{{ proto string MongoDB\BSON\ObjectId::serialize() */ -static PHP_METHOD(ObjectId, serialize) +PHP_METHOD(MongoDB_BSON_ObjectId, serialize) { php_phongo_objectid_t* intern; zval retval; @@ -214,7 +215,7 @@ static PHP_METHOD(ObjectId, serialize) /* {{{ proto void MongoDB\BSON\ObjectId::unserialize(string $serialized) */ -static PHP_METHOD(ObjectId, unserialize) +PHP_METHOD(MongoDB_BSON_ObjectId, unserialize) { php_phongo_objectid_t* intern; char* serialized; @@ -244,7 +245,7 @@ static PHP_METHOD(ObjectId, unserialize) /* {{{ proto array MongoDB\Driver\ObjectId::__serialize() */ -static PHP_METHOD(ObjectId, __serialize) +PHP_METHOD(MongoDB_BSON_ObjectId, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -253,7 +254,7 @@ static PHP_METHOD(ObjectId, __serialize) /* {{{ proto void MongoDB\Driver\ObjectId::__unserialize(array $data) */ -static PHP_METHOD(ObjectId, __unserialize) +PHP_METHOD(MongoDB_BSON_ObjectId, __unserialize) { zval* data; @@ -264,48 +265,6 @@ static PHP_METHOD(ObjectId, __unserialize) php_phongo_objectid_init_from_hash(Z_OBJECTID_OBJ_P(getThis()), Z_ARRVAL_P(data)); } /* }}} */ -/* {{{ MongoDB\BSON\ObjectId function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_INFO_EX(ai_ObjectId___construct, 0, 0, 0) - ZEND_ARG_INFO(0, id) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ObjectId___set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, properties, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_ObjectId___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ObjectId___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_ObjectId_jsonSerialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ObjectId_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ObjectId_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_objectid_me[] = { - PHP_ME(ObjectId, __construct, ai_ObjectId___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ObjectId, getTimestamp, ai_ObjectId_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ObjectId, __serialize, ai_ObjectId_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ObjectId, __set_state, ai_ObjectId___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(ObjectId, __toString, ai_ObjectId___toString, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ObjectId, __unserialize, ai_ObjectId___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ObjectId, jsonSerialize, ai_ObjectId_jsonSerialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ObjectId, serialize, ai_ObjectId_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ObjectId, unserialize, ai_ObjectId_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - /* {{{ MongoDB\BSON\ObjectId object handlers */ static zend_object_handlers php_phongo_handler_objectid; @@ -381,7 +340,7 @@ void php_phongo_objectid_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "ObjectId", php_phongo_objectid_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "ObjectId", class_MongoDB_BSON_ObjectId_methods); php_phongo_objectid_ce = zend_register_internal_class(&ce); php_phongo_objectid_ce->create_object = php_phongo_objectid_create_object; PHONGO_CE_FINAL(php_phongo_objectid_ce); diff --git a/src/BSON/ObjectId.stub.php b/src/BSON/ObjectId.stub.php new file mode 100644 index 000000000..d7cc8054e --- /dev/null +++ b/src/BSON/ObjectId.stub.php @@ -0,0 +1,33 @@ += 80000 + final public function jsonSerialize(): mixed {} +#else + /** @return mixed */ + final public function jsonSerialize() {} +#endif + } +} diff --git a/src/BSON/ObjectIdInterface.c b/src/BSON/ObjectIdInterface.c index a572b5b9b..c8d9134c1 100644 --- a/src/BSON/ObjectIdInterface.c +++ b/src/BSON/ObjectIdInterface.c @@ -17,29 +17,14 @@ #include #include "php_phongo.h" +#include "ObjectIdInterface_arginfo.h" zend_class_entry* php_phongo_objectid_interface_ce; -/* {{{ MongoDB\BSON\ObjectIdInterface function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_ObjectIdInterface___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ObjectIdInterface_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_objectid_interface_me[] = { - ZEND_ABSTRACT_ME(ObjectIdInterface, getTimestamp, ai_ObjectIdInterface_void) - ZEND_ABSTRACT_ME(ObjectIdInterface, __toString, ai_ObjectIdInterface___toString) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - void php_phongo_objectid_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "ObjectIdInterface", php_phongo_objectid_interface_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "ObjectIdInterface", class_MongoDB_BSON_ObjectIdInterface_methods); php_phongo_objectid_interface_ce = zend_register_internal_interface(&ce); } /* }}} */ diff --git a/src/BSON/ObjectIdInterface.stub.php b/src/BSON/ObjectIdInterface.stub.php new file mode 100644 index 000000000..e8886e610 --- /dev/null +++ b/src/BSON/ObjectIdInterface.stub.php @@ -0,0 +1,15 @@ += 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId_jsonSerialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId_jsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + + +ZEND_METHOD(MongoDB_BSON_ObjectId, __construct); +ZEND_METHOD(MongoDB_BSON_ObjectId, getTimestamp); +ZEND_METHOD(MongoDB_BSON_ObjectId, __toString); +ZEND_METHOD(MongoDB_BSON_ObjectId, __set_state); +ZEND_METHOD(MongoDB_BSON_ObjectId, serialize); +ZEND_METHOD(MongoDB_BSON_ObjectId, unserialize); +ZEND_METHOD(MongoDB_BSON_ObjectId, __unserialize); +ZEND_METHOD(MongoDB_BSON_ObjectId, __serialize); +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_ObjectId, jsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_ObjectId, jsonSerialize); +#endif + + +static const zend_function_entry class_MongoDB_BSON_ObjectId_methods[] = { + ZEND_ME(MongoDB_BSON_ObjectId, __construct, arginfo_class_MongoDB_BSON_ObjectId___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_ObjectId, getTimestamp, arginfo_class_MongoDB_BSON_ObjectId_getTimestamp, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_ObjectId, __toString, arginfo_class_MongoDB_BSON_ObjectId___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_ObjectId, __set_state, arginfo_class_MongoDB_BSON_ObjectId___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(MongoDB_BSON_ObjectId, serialize, arginfo_class_MongoDB_BSON_ObjectId_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_ObjectId, unserialize, arginfo_class_MongoDB_BSON_ObjectId_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_ObjectId, __unserialize, arginfo_class_MongoDB_BSON_ObjectId___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_ObjectId, __serialize, arginfo_class_MongoDB_BSON_ObjectId___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_ObjectId, jsonSerialize, arginfo_class_MongoDB_BSON_ObjectId_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_ObjectId, jsonSerialize, arginfo_class_MongoDB_BSON_ObjectId_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; diff --git a/src/BSON/Persistable.c b/src/BSON/Persistable.c index 29949f4ab..a34886ca1 100644 --- a/src/BSON/Persistable.c +++ b/src/BSON/Persistable.c @@ -17,20 +17,15 @@ #include #include "php_phongo.h" +#include "Persistable_arginfo.h" zend_class_entry* php_phongo_persistable_ce; -/* {{{ MongoDB\BSON\Persistable function entries */ -static zend_function_entry php_phongo_persistable_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_persistable_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Persistable", php_phongo_persistable_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Persistable", class_MongoDB_BSON_Persistable_methods); php_phongo_persistable_ce = zend_register_internal_interface(&ce); zend_class_implements(php_phongo_persistable_ce, 2, php_phongo_unserializable_ce, php_phongo_serializable_ce); } /* }}} */ diff --git a/src/BSON/Persistable.stub.php b/src/BSON/Persistable.stub.php new file mode 100644 index 000000000..9e1553ce8 --- /dev/null +++ b/src/BSON/Persistable.stub.php @@ -0,0 +1,10 @@ +create_object = php_phongo_regex_create_object; PHONGO_CE_FINAL(php_phongo_regex_ce); diff --git a/src/BSON/Regex.stub.php b/src/BSON/Regex.stub.php new file mode 100644 index 000000000..03fa4cb0b --- /dev/null +++ b/src/BSON/Regex.stub.php @@ -0,0 +1,35 @@ += 80000 + final public function jsonSerialize(): mixed {} +#else + /** @return mixed */ + final public function jsonSerialize() {} +#endif + } +} diff --git a/src/BSON/RegexInterface.c b/src/BSON/RegexInterface.c index c8c0e2673..24a31c739 100644 --- a/src/BSON/RegexInterface.c +++ b/src/BSON/RegexInterface.c @@ -17,30 +17,14 @@ #include #include "php_phongo.h" +#include "RegexInterface_arginfo.h" zend_class_entry* php_phongo_regex_interface_ce; -/* {{{ MongoDB\BSON\RegexInterface function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_RegexInterface___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_RegexInterface_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_regex_interface_me[] = { - ZEND_ABSTRACT_ME(RegexInterface, getFlags, ai_RegexInterface_void) - ZEND_ABSTRACT_ME(RegexInterface, getPattern, ai_RegexInterface_void) - ZEND_ABSTRACT_ME(RegexInterface, __toString, ai_RegexInterface___toString) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - void php_phongo_regex_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "RegexInterface", php_phongo_regex_interface_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "RegexInterface", class_MongoDB_BSON_RegexInterface_methods); php_phongo_regex_interface_ce = zend_register_internal_interface(&ce); } /* }}} */ diff --git a/src/BSON/RegexInterface.stub.php b/src/BSON/RegexInterface.stub.php new file mode 100644 index 000000000..8ba4d405b --- /dev/null +++ b/src/BSON/RegexInterface.stub.php @@ -0,0 +1,18 @@ += 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Regex_jsonSerialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Regex_jsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + + +ZEND_METHOD(MongoDB_BSON_Regex, __construct); +ZEND_METHOD(MongoDB_BSON_Regex, getPattern); +ZEND_METHOD(MongoDB_BSON_Regex, getFlags); +ZEND_METHOD(MongoDB_BSON_Regex, __toString); +ZEND_METHOD(MongoDB_BSON_Regex, __set_state); +ZEND_METHOD(MongoDB_BSON_Regex, serialize); +ZEND_METHOD(MongoDB_BSON_Regex, unserialize); +ZEND_METHOD(MongoDB_BSON_Regex, __unserialize); +ZEND_METHOD(MongoDB_BSON_Regex, __serialize); +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_Regex, jsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_Regex, jsonSerialize); +#endif + + +static const zend_function_entry class_MongoDB_BSON_Regex_methods[] = { + ZEND_ME(MongoDB_BSON_Regex, __construct, arginfo_class_MongoDB_BSON_Regex___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Regex, getPattern, arginfo_class_MongoDB_BSON_Regex_getPattern, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Regex, getFlags, arginfo_class_MongoDB_BSON_Regex_getFlags, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Regex, __toString, arginfo_class_MongoDB_BSON_Regex___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Regex, __set_state, arginfo_class_MongoDB_BSON_Regex___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(MongoDB_BSON_Regex, serialize, arginfo_class_MongoDB_BSON_Regex_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Regex, unserialize, arginfo_class_MongoDB_BSON_Regex_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Regex, __unserialize, arginfo_class_MongoDB_BSON_Regex___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Regex, __serialize, arginfo_class_MongoDB_BSON_Regex___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_Regex, jsonSerialize, arginfo_class_MongoDB_BSON_Regex_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_Regex, jsonSerialize, arginfo_class_MongoDB_BSON_Regex_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; diff --git a/src/BSON/Serializable.c b/src/BSON/Serializable.c index 5563b29eb..94d067948 100644 --- a/src/BSON/Serializable.c +++ b/src/BSON/Serializable.c @@ -17,26 +17,15 @@ #include #include "php_phongo.h" +#include "Serializable_arginfo.h" zend_class_entry* php_phongo_serializable_ce; -/* {{{ MongoDB\BSON\Serializable function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_Serializable_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_serializable_me[] = { - /* clang-format off */ - ZEND_ABSTRACT_ME(Serializable, bsonSerialize, ai_Serializable_void) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - void php_phongo_serializable_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Serializable", php_phongo_serializable_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Serializable", class_MongoDB_BSON_Serializable_methods); php_phongo_serializable_ce = zend_register_internal_interface(&ce); zend_class_implements(php_phongo_serializable_ce, 1, php_phongo_type_ce); } /* }}} */ diff --git a/src/BSON/Serializable.stub.php b/src/BSON/Serializable.stub.php new file mode 100644 index 000000000..fc9ef1a1c --- /dev/null +++ b/src/BSON/Serializable.stub.php @@ -0,0 +1,12 @@ +create_object = php_phongo_symbol_create_object; PHONGO_CE_FINAL(php_phongo_symbol_ce); diff --git a/src/BSON/Symbol.stub.php b/src/BSON/Symbol.stub.php new file mode 100644 index 000000000..d2d9290c8 --- /dev/null +++ b/src/BSON/Symbol.stub.php @@ -0,0 +1,29 @@ += 80000 + final public function jsonSerialize(): mixed {} +#else + /** @return mixed */ + final public function jsonSerialize() {} +#endif + } +} diff --git a/src/BSON/Symbol_arginfo.h b/src/BSON/Symbol_arginfo.h new file mode 100644 index 000000000..f054d356f --- /dev/null +++ b/src/BSON/Symbol_arginfo.h @@ -0,0 +1,62 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: ecfb2e9f3329d6ca822bfd8d4720b08543dadafd */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Symbol___construct, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Symbol___toString, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_BSON_Symbol_serialize arginfo_class_MongoDB_BSON_Symbol___toString + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Symbol_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Symbol___unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Symbol___serialize, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Symbol_jsonSerialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Symbol_jsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + + +ZEND_METHOD(MongoDB_BSON_Symbol, __construct); +ZEND_METHOD(MongoDB_BSON_Symbol, __toString); +ZEND_METHOD(MongoDB_BSON_Symbol, serialize); +ZEND_METHOD(MongoDB_BSON_Symbol, unserialize); +ZEND_METHOD(MongoDB_BSON_Symbol, __unserialize); +ZEND_METHOD(MongoDB_BSON_Symbol, __serialize); +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_Symbol, jsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_Symbol, jsonSerialize); +#endif + + +static const zend_function_entry class_MongoDB_BSON_Symbol_methods[] = { + ZEND_ME(MongoDB_BSON_Symbol, __construct, arginfo_class_MongoDB_BSON_Symbol___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Symbol, __toString, arginfo_class_MongoDB_BSON_Symbol___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Symbol, serialize, arginfo_class_MongoDB_BSON_Symbol_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Symbol, unserialize, arginfo_class_MongoDB_BSON_Symbol_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Symbol, __unserialize, arginfo_class_MongoDB_BSON_Symbol___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Symbol, __serialize, arginfo_class_MongoDB_BSON_Symbol___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_Symbol, jsonSerialize, arginfo_class_MongoDB_BSON_Symbol_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_Symbol, jsonSerialize, arginfo_class_MongoDB_BSON_Symbol_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; diff --git a/src/BSON/Timestamp.c b/src/BSON/Timestamp.c index c4b77863c..79d4d4cdf 100644 --- a/src/BSON/Timestamp.c +++ b/src/BSON/Timestamp.c @@ -22,6 +22,7 @@ #include "php_phongo.h" #include "phongo_error.h" #include "phongo_util.h" +#include "Timestamp_arginfo.h" zend_class_entry* php_phongo_timestamp_ce; @@ -122,7 +123,7 @@ static HashTable* php_phongo_timestamp_get_properties_hash(phongo_compat_object_ /* {{{ proto void MongoDB\BSON\Timestamp::__construct(int|string $increment, int|string $timestamp) Construct a new BSON timestamp type, which consists of a 4-byte increment and 4-byte timestamp. */ -static PHP_METHOD(Timestamp, __construct) +PHP_METHOD(MongoDB_BSON_Timestamp, __construct) { php_phongo_timestamp_t* intern; zval * increment = NULL, *timestamp = NULL; @@ -162,7 +163,7 @@ static PHP_METHOD(Timestamp, __construct) /* {{{ proto integer MongoDB\BSON\Timestamp::getIncrement() */ -static PHP_METHOD(Timestamp, getIncrement) +PHP_METHOD(MongoDB_BSON_Timestamp, getIncrement) { php_phongo_timestamp_t* intern; @@ -175,7 +176,7 @@ static PHP_METHOD(Timestamp, getIncrement) /* {{{ proto integer MongoDB\BSON\Timestamp::getTimestamp() */ -static PHP_METHOD(Timestamp, getTimestamp) +PHP_METHOD(MongoDB_BSON_Timestamp, getTimestamp) { php_phongo_timestamp_t* intern; @@ -188,7 +189,7 @@ static PHP_METHOD(Timestamp, getTimestamp) /* {{{ proto MongoDB\BSON\Timestamp MongoDB\BSON\Timestamp::__set_state(array $properties) */ -static PHP_METHOD(Timestamp, __set_state) +PHP_METHOD(MongoDB_BSON_Timestamp, __set_state) { php_phongo_timestamp_t* intern; HashTable* props; @@ -208,7 +209,7 @@ static PHP_METHOD(Timestamp, __set_state) /* {{{ proto string MongoDB\BSON\Timestamp::__toString() Returns a string in the form: [increment:timestamp] */ -static PHP_METHOD(Timestamp, __toString) +PHP_METHOD(MongoDB_BSON_Timestamp, __toString) { php_phongo_timestamp_t* intern; char* retval; @@ -225,7 +226,7 @@ static PHP_METHOD(Timestamp, __toString) /* {{{ proto array MongoDB\BSON\Timestamp::jsonSerialize() */ -static PHP_METHOD(Timestamp, jsonSerialize) +PHP_METHOD(MongoDB_BSON_Timestamp, jsonSerialize) { php_phongo_timestamp_t* intern; @@ -247,7 +248,7 @@ static PHP_METHOD(Timestamp, jsonSerialize) /* {{{ proto string MongoDB\BSON\Timestamp::serialize() */ -static PHP_METHOD(Timestamp, serialize) +PHP_METHOD(MongoDB_BSON_Timestamp, serialize) { php_phongo_timestamp_t* intern; zval retval; @@ -282,7 +283,7 @@ static PHP_METHOD(Timestamp, serialize) /* {{{ proto void MongoDB\BSON\Timestamp::unserialize(string $serialized) */ -static PHP_METHOD(Timestamp, unserialize) +PHP_METHOD(MongoDB_BSON_Timestamp, unserialize) { php_phongo_timestamp_t* intern; char* serialized; @@ -312,7 +313,7 @@ static PHP_METHOD(Timestamp, unserialize) /* {{{ proto array MongoDB\Driver\Timestamp::__serialize() */ -static PHP_METHOD(Timestamp, __serialize) +PHP_METHOD(MongoDB_BSON_Timestamp, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -321,7 +322,7 @@ static PHP_METHOD(Timestamp, __serialize) /* {{{ proto void MongoDB\Driver\Timestamp::__unserialize(array $data) */ -static PHP_METHOD(Timestamp, __unserialize) +PHP_METHOD(MongoDB_BSON_Timestamp, __unserialize) { zval* data; @@ -332,50 +333,6 @@ static PHP_METHOD(Timestamp, __unserialize) php_phongo_timestamp_init_from_hash(Z_TIMESTAMP_OBJ_P(getThis()), Z_ARRVAL_P(data)); } /* }}} */ -/* {{{ MongoDB\BSON\Timestamp function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_INFO_EX(ai_Timestamp___construct, 0, 0, 2) - ZEND_ARG_INFO(0, increment) - ZEND_ARG_INFO(0, timestamp) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Timestamp___set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, properties, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_Timestamp___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Timestamp___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_Timestamp_jsonSerialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Timestamp_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Timestamp_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_timestamp_me[] = { - PHP_ME(Timestamp, __construct, ai_Timestamp___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Timestamp, __serialize, ai_Timestamp_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Timestamp, __set_state, ai_Timestamp___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(Timestamp, __toString, ai_Timestamp___toString, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Timestamp, __unserialize, ai_Timestamp___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Timestamp, jsonSerialize, ai_Timestamp_jsonSerialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Timestamp, serialize, ai_Timestamp_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Timestamp, unserialize, ai_Timestamp_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Timestamp, getIncrement, ai_Timestamp_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Timestamp, getTimestamp, ai_Timestamp_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - /* {{{ MongoDB\BSON\Timestamp object handlers */ static zend_object_handlers php_phongo_handler_timestamp; @@ -457,7 +414,7 @@ void php_phongo_timestamp_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Timestamp", php_phongo_timestamp_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Timestamp", class_MongoDB_BSON_Timestamp_methods); php_phongo_timestamp_ce = zend_register_internal_class(&ce); php_phongo_timestamp_ce->create_object = php_phongo_timestamp_create_object; PHONGO_CE_FINAL(php_phongo_timestamp_ce); diff --git a/src/BSON/Timestamp.stub.php b/src/BSON/Timestamp.stub.php new file mode 100644 index 000000000..ceafb43c4 --- /dev/null +++ b/src/BSON/Timestamp.stub.php @@ -0,0 +1,43 @@ += 80000 + public final function __construct(int|string $increment, int|string $timestamp) {} +#else + /** + * @param int|string $increment + * @param int|string $timestamp + */ + public final function __construct($increment, $timestamp) {} +#endif + + public final function getTimestamp(): int {} + + public final function getIncrement(): int {} + + public final function __toString(): string {} + + public static function __set_state(array $properties): object {} + + final public function serialize(): string {} + + /** @param string $serialized */ + final public function unserialize($serialized): void {} + + final public function __unserialize(array $data): void {} + + final public function __serialize(): array {} + +#if PHP_VERSION_ID >= 80000 + final public function jsonSerialize(): mixed {} +#else + /** @return mixed */ + final public function jsonSerialize() {} +#endif + } +} diff --git a/src/BSON/TimestampInterface.c b/src/BSON/TimestampInterface.c index 4963eae03..299cb5dea 100644 --- a/src/BSON/TimestampInterface.c +++ b/src/BSON/TimestampInterface.c @@ -17,30 +17,14 @@ #include #include "php_phongo.h" +#include "TimestampInterface_arginfo.h" zend_class_entry* php_phongo_timestamp_interface_ce; -/* {{{ MongoDB\BSON\TimestampInterface function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_TimestampInterface___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_TimestampInterface_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_timestamp_interface_me[] = { - ZEND_ABSTRACT_ME(TimestampInterface, getIncrement, ai_TimestampInterface_void) - ZEND_ABSTRACT_ME(TimestampInterface, getTimestamp, ai_TimestampInterface_void) - ZEND_ABSTRACT_ME(TimestampInterface, __toString, ai_TimestampInterface___toString) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - void php_phongo_timestamp_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "TimestampInterface", php_phongo_timestamp_interface_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "TimestampInterface", class_MongoDB_BSON_TimestampInterface_methods); php_phongo_timestamp_interface_ce = zend_register_internal_interface(&ce); } /* }}} */ diff --git a/src/BSON/TimestampInterface.stub.php b/src/BSON/TimestampInterface.stub.php new file mode 100644 index 000000000..ddcf8d779 --- /dev/null +++ b/src/BSON/TimestampInterface.stub.php @@ -0,0 +1,18 @@ += 80000 +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___construct, 0, 0, 2) + ZEND_ARG_TYPE_MASK(0, increment, MAY_BE_LONG|MAY_BE_STRING, NULL) + ZEND_ARG_TYPE_MASK(0, timestamp, MAY_BE_LONG|MAY_BE_STRING, NULL) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___construct, 0, 0, 2) + ZEND_ARG_INFO(0, increment) + ZEND_ARG_INFO(0, timestamp) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp_getTimestamp, 0, 0, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_BSON_Timestamp_getIncrement arginfo_class_MongoDB_BSON_Timestamp_getTimestamp + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___toString, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___set_state, 0, 1, IS_OBJECT, 0) + ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_BSON_Timestamp_serialize arginfo_class_MongoDB_BSON_Timestamp___toString + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___serialize, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp_jsonSerialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp_jsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + + +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_Timestamp, __construct); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_Timestamp, __construct); +#endif +ZEND_METHOD(MongoDB_BSON_Timestamp, getTimestamp); +ZEND_METHOD(MongoDB_BSON_Timestamp, getIncrement); +ZEND_METHOD(MongoDB_BSON_Timestamp, __toString); +ZEND_METHOD(MongoDB_BSON_Timestamp, __set_state); +ZEND_METHOD(MongoDB_BSON_Timestamp, serialize); +ZEND_METHOD(MongoDB_BSON_Timestamp, unserialize); +ZEND_METHOD(MongoDB_BSON_Timestamp, __unserialize); +ZEND_METHOD(MongoDB_BSON_Timestamp, __serialize); +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_Timestamp, jsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_Timestamp, jsonSerialize); +#endif + + +static const zend_function_entry class_MongoDB_BSON_Timestamp_methods[] = { +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_Timestamp, __construct, arginfo_class_MongoDB_BSON_Timestamp___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_Timestamp, __construct, arginfo_class_MongoDB_BSON_Timestamp___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_BSON_Timestamp, getTimestamp, arginfo_class_MongoDB_BSON_Timestamp_getTimestamp, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Timestamp, getIncrement, arginfo_class_MongoDB_BSON_Timestamp_getIncrement, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Timestamp, __toString, arginfo_class_MongoDB_BSON_Timestamp___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Timestamp, __set_state, arginfo_class_MongoDB_BSON_Timestamp___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(MongoDB_BSON_Timestamp, serialize, arginfo_class_MongoDB_BSON_Timestamp_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Timestamp, unserialize, arginfo_class_MongoDB_BSON_Timestamp_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Timestamp, __unserialize, arginfo_class_MongoDB_BSON_Timestamp___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Timestamp, __serialize, arginfo_class_MongoDB_BSON_Timestamp___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_Timestamp, jsonSerialize, arginfo_class_MongoDB_BSON_Timestamp_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_Timestamp, jsonSerialize, arginfo_class_MongoDB_BSON_Timestamp_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; diff --git a/src/BSON/UTCDateTime.c b/src/BSON/UTCDateTime.c index e057fdc8f..349adfaa0 100644 --- a/src/BSON/UTCDateTime.c +++ b/src/BSON/UTCDateTime.c @@ -25,6 +25,7 @@ #include "php_phongo.h" #include "phongo_error.h" #include "phongo_util.h" +#include "UTCDateTime_arginfo.h" zend_class_entry* php_phongo_utcdatetime_ce; @@ -129,7 +130,7 @@ static HashTable* php_phongo_utcdatetime_get_properties_hash(phongo_compat_objec Construct a new BSON UTCDateTime type from either the current time, milliseconds since the epoch, or a DateTimeInterface object. Defaults to the current time. */ -static PHP_METHOD(UTCDateTime, __construct) +PHP_METHOD(MongoDB_BSON_UTCDateTime, __construct) { php_phongo_utcdatetime_t* intern; zval* milliseconds = NULL; @@ -182,7 +183,7 @@ static PHP_METHOD(UTCDateTime, __construct) /* {{{ proto MongoDB\BSON\UTCDateTime MongoDB\BSON\UTCDateTime::__set_state(array $properties) */ -static PHP_METHOD(UTCDateTime, __set_state) +PHP_METHOD(MongoDB_BSON_UTCDateTime, __set_state) { php_phongo_utcdatetime_t* intern; HashTable* props; @@ -202,7 +203,7 @@ static PHP_METHOD(UTCDateTime, __set_state) /* {{{ proto string MongoDB\BSON\UTCDateTime::__toString() Returns the UTCDateTime's milliseconds as a string */ -static PHP_METHOD(UTCDateTime, __toString) +PHP_METHOD(MongoDB_BSON_UTCDateTime, __toString) { php_phongo_utcdatetime_t* intern; @@ -215,7 +216,7 @@ static PHP_METHOD(UTCDateTime, __toString) /* {{{ proto DateTime MongoDB\BSON\UTCDateTime::toDateTime() Returns a DateTime object representing this UTCDateTime */ -static PHP_METHOD(UTCDateTime, toDateTime) +PHP_METHOD(MongoDB_BSON_UTCDateTime, toDateTime) { php_phongo_utcdatetime_t* intern; php_date_obj* datetime_obj; @@ -239,7 +240,7 @@ static PHP_METHOD(UTCDateTime, toDateTime) /* {{{ proto array MongoDB\BSON\UTCDateTime::jsonSerialize() */ -static PHP_METHOD(UTCDateTime, jsonSerialize) +PHP_METHOD(MongoDB_BSON_UTCDateTime, jsonSerialize) { php_phongo_utcdatetime_t* intern; @@ -260,7 +261,7 @@ static PHP_METHOD(UTCDateTime, jsonSerialize) /* {{{ proto string MongoDB\BSON\UTCDateTime::serialize() */ -static PHP_METHOD(UTCDateTime, serialize) +PHP_METHOD(MongoDB_BSON_UTCDateTime, serialize) { php_phongo_utcdatetime_t* intern; zval retval; @@ -287,7 +288,7 @@ static PHP_METHOD(UTCDateTime, serialize) /* {{{ proto void MongoDB\BSON\UTCDateTime::unserialize(string $serialized) */ -static PHP_METHOD(UTCDateTime, unserialize) +PHP_METHOD(MongoDB_BSON_UTCDateTime, unserialize) { php_phongo_utcdatetime_t* intern; char* serialized; @@ -317,7 +318,7 @@ static PHP_METHOD(UTCDateTime, unserialize) /* {{{ proto array MongoDB\Driver\UTCDateTime::__serialize() */ -static PHP_METHOD(UTCDateTime, __serialize) +PHP_METHOD(MongoDB_BSON_UTCDateTime, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -326,7 +327,7 @@ static PHP_METHOD(UTCDateTime, __serialize) /* {{{ proto void MongoDB\Driver\UTCDateTime::__unserialize(array $data) */ -static PHP_METHOD(UTCDateTime, __unserialize) +PHP_METHOD(MongoDB_BSON_UTCDateTime, __unserialize) { zval* data; @@ -337,48 +338,6 @@ static PHP_METHOD(UTCDateTime, __unserialize) php_phongo_utcdatetime_init_from_hash(Z_UTCDATETIME_OBJ_P(getThis()), Z_ARRVAL_P(data)); } /* }}} */ -/* {{{ MongoDB\BSON\UTCDateTime function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_INFO_EX(ai_UTCDateTime___construct, 0, 0, 0) - ZEND_ARG_INFO(0, milliseconds) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_UTCDateTime___set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, properties, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_UTCDateTime___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_UTCDateTime___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_UTCDateTime_jsonSerialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_UTCDateTime_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_UTCDateTime_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_utcdatetime_me[] = { - PHP_ME(UTCDateTime, __construct, ai_UTCDateTime___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(UTCDateTime, __serialize, ai_UTCDateTime_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(UTCDateTime, __set_state, ai_UTCDateTime___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(UTCDateTime, __toString, ai_UTCDateTime___toString, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(UTCDateTime, __unserialize, ai_UTCDateTime___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(UTCDateTime, jsonSerialize, ai_UTCDateTime_jsonSerialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(UTCDateTime, serialize, ai_UTCDateTime_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(UTCDateTime, unserialize, ai_UTCDateTime_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(UTCDateTime, toDateTime, ai_UTCDateTime_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - /* {{{ MongoDB\BSON\UTCDateTime object handlers */ static zend_object_handlers php_phongo_handler_utcdatetime; @@ -455,7 +414,7 @@ void php_phongo_utcdatetime_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "UTCDateTime", php_phongo_utcdatetime_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "UTCDateTime", class_MongoDB_BSON_UTCDateTime_methods); php_phongo_utcdatetime_ce = zend_register_internal_class(&ce); php_phongo_utcdatetime_ce->create_object = php_phongo_utcdatetime_create_object; PHONGO_CE_FINAL(php_phongo_utcdatetime_ce); diff --git a/src/BSON/UTCDateTime.stub.php b/src/BSON/UTCDateTime.stub.php new file mode 100644 index 000000000..b56d7c14c --- /dev/null +++ b/src/BSON/UTCDateTime.stub.php @@ -0,0 +1,38 @@ += 80000 + public final function __construct(int|string|float|\DateTime|\DateTimeImmutable|null $milliseconds = null) {} +#else + /** @param int|string|float|\DateTime|\DateTimeImmutable|null $milliseconds */ + public final function __construct($milliseconds = null) {} +#endif + + public final function toDateTime(): \DateTime {} + + public final function __toString(): string {} + + public static function __set_state(array $properties): object {} + + final public function serialize(): string {} + + /** @param string $serialized */ + final public function unserialize($serialized): void {} + + final public function __unserialize(array $data): void {} + + final public function __serialize(): array {} + +#if PHP_VERSION_ID >= 80000 + final public function jsonSerialize(): mixed {} +#else + /** @return mixed */ + final public function jsonSerialize() {} +#endif + } +} diff --git a/src/BSON/UTCDateTimeInterface.c b/src/BSON/UTCDateTimeInterface.c index 7c5e8947c..694aaf1b1 100644 --- a/src/BSON/UTCDateTimeInterface.c +++ b/src/BSON/UTCDateTimeInterface.c @@ -17,29 +17,14 @@ #include #include "php_phongo.h" +#include "UTCDateTimeInterface_arginfo.h" zend_class_entry* php_phongo_utcdatetime_interface_ce; -/* {{{ MongoDB\BSON\UTCDateTimeInterface function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_UTCDateTimeInterface___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_UTCDateTimeInterface_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_utcdatetime_interface_me[] = { - ZEND_ABSTRACT_ME(UTCDateTimeInterface, toDateTime, ai_UTCDateTimeInterface_void) - ZEND_ABSTRACT_ME(UTCDateTimeInterface, __toString, ai_UTCDateTimeInterface___toString) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - void php_phongo_utcdatetime_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "UTCDateTimeInterface", php_phongo_utcdatetime_interface_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "UTCDateTimeInterface", class_MongoDB_BSON_UTCDateTimeInterface_methods); php_phongo_utcdatetime_interface_ce = zend_register_internal_interface(&ce); } /* }}} */ diff --git a/src/BSON/UTCDateTimeInterface.stub.php b/src/BSON/UTCDateTimeInterface.stub.php new file mode 100644 index 000000000..e0a6e7715 --- /dev/null +++ b/src/BSON/UTCDateTimeInterface.stub.php @@ -0,0 +1,15 @@ += 80000 +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___construct, 0, 0, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, milliseconds, DateTime|DateTimeImmutable, MAY_BE_LONG|MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_NULL, "null") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___construct, 0, 0, 0) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, milliseconds, "null") +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime_toDateTime, 0, 0, DateTime, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___toString, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___set_state, 0, 1, IS_OBJECT, 0) + ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_BSON_UTCDateTime_serialize arginfo_class_MongoDB_BSON_UTCDateTime___toString + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___serialize, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime_jsonSerialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime_jsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + + +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_UTCDateTime, __construct); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_UTCDateTime, __construct); +#endif +ZEND_METHOD(MongoDB_BSON_UTCDateTime, toDateTime); +ZEND_METHOD(MongoDB_BSON_UTCDateTime, __toString); +ZEND_METHOD(MongoDB_BSON_UTCDateTime, __set_state); +ZEND_METHOD(MongoDB_BSON_UTCDateTime, serialize); +ZEND_METHOD(MongoDB_BSON_UTCDateTime, unserialize); +ZEND_METHOD(MongoDB_BSON_UTCDateTime, __unserialize); +ZEND_METHOD(MongoDB_BSON_UTCDateTime, __serialize); +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_UTCDateTime, jsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_UTCDateTime, jsonSerialize); +#endif + + +static const zend_function_entry class_MongoDB_BSON_UTCDateTime_methods[] = { +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_UTCDateTime, __construct, arginfo_class_MongoDB_BSON_UTCDateTime___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_UTCDateTime, __construct, arginfo_class_MongoDB_BSON_UTCDateTime___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_BSON_UTCDateTime, toDateTime, arginfo_class_MongoDB_BSON_UTCDateTime_toDateTime, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_UTCDateTime, __toString, arginfo_class_MongoDB_BSON_UTCDateTime___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_UTCDateTime, __set_state, arginfo_class_MongoDB_BSON_UTCDateTime___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(MongoDB_BSON_UTCDateTime, serialize, arginfo_class_MongoDB_BSON_UTCDateTime_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_UTCDateTime, unserialize, arginfo_class_MongoDB_BSON_UTCDateTime_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_UTCDateTime, __unserialize, arginfo_class_MongoDB_BSON_UTCDateTime___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_UTCDateTime, __serialize, arginfo_class_MongoDB_BSON_UTCDateTime___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_UTCDateTime, jsonSerialize, arginfo_class_MongoDB_BSON_UTCDateTime_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_UTCDateTime, jsonSerialize, arginfo_class_MongoDB_BSON_UTCDateTime_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; diff --git a/src/BSON/Undefined.c b/src/BSON/Undefined.c index f6e0253ce..b2dfa4d43 100644 --- a/src/BSON/Undefined.c +++ b/src/BSON/Undefined.c @@ -21,12 +21,15 @@ #include "php_phongo.h" #include "phongo_error.h" +#include "Undefined_arginfo.h" zend_class_entry* php_phongo_undefined_ce; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_BSON_Undefined) + /* {{{ proto string MongoDB\BSON\Undefined::__toString() Return the empty string. */ -static PHP_METHOD(Undefined, __toString) +PHP_METHOD(MongoDB_BSON_Undefined, __toString) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -35,7 +38,7 @@ static PHP_METHOD(Undefined, __toString) /* {{{ proto array MongoDB\BSON\Undefined::jsonSerialize() */ -static PHP_METHOD(Undefined, jsonSerialize) +PHP_METHOD(MongoDB_BSON_Undefined, jsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -45,7 +48,7 @@ static PHP_METHOD(Undefined, jsonSerialize) /* {{{ proto string MongoDB\BSON\Undefined::serialize() */ -static PHP_METHOD(Undefined, serialize) +PHP_METHOD(MongoDB_BSON_Undefined, serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -54,7 +57,7 @@ static PHP_METHOD(Undefined, serialize) /* {{{ proto void MongoDB\BSON\Undefined::unserialize(string $serialized) */ -static PHP_METHOD(Undefined, unserialize) +PHP_METHOD(MongoDB_BSON_Undefined, unserialize) { char* serialized; size_t serialized_len; @@ -66,7 +69,7 @@ static PHP_METHOD(Undefined, unserialize) /* {{{ proto array MongoDB\Driver\Undefined::__serialize() */ -static PHP_METHOD(Undefined, __serialize) +PHP_METHOD(MongoDB_BSON_Undefined, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -75,7 +78,7 @@ static PHP_METHOD(Undefined, __serialize) /* {{{ proto void MongoDB\Driver\Undefined::__unserialize(array $data) */ -static PHP_METHOD(Undefined, __unserialize) +PHP_METHOD(MongoDB_BSON_Undefined, __unserialize) { zval* data; @@ -84,39 +87,6 @@ static PHP_METHOD(Undefined, __unserialize) PHONGO_PARSE_PARAMETERS_END(); } /* }}} */ -/* {{{ MongoDB\BSON\Undefined function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_Undefined___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Undefined___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_Undefined_jsonSerialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Undefined_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Undefined_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_undefined_me[] = { - /* __set_state intentionally missing */ - PHP_ME(Undefined, __serialize, ai_Undefined_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Undefined, __toString, ai_Undefined___toString, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Undefined, __unserialize, ai_Undefined___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Undefined, jsonSerialize, ai_Undefined_jsonSerialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Undefined, serialize, ai_Undefined_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Undefined, unserialize, ai_Undefined_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Undefined_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - /* {{{ MongoDB\BSON\Undefined object handlers */ static zend_object_handlers php_phongo_handler_undefined; @@ -144,7 +114,7 @@ void php_phongo_undefined_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Undefined", php_phongo_undefined_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Undefined", class_MongoDB_BSON_Undefined_methods); php_phongo_undefined_ce = zend_register_internal_class(&ce); php_phongo_undefined_ce->create_object = php_phongo_undefined_create_object; PHONGO_CE_FINAL(php_phongo_undefined_ce); diff --git a/src/BSON/Undefined.stub.php b/src/BSON/Undefined.stub.php new file mode 100644 index 000000000..ffc8deeca --- /dev/null +++ b/src/BSON/Undefined.stub.php @@ -0,0 +1,29 @@ += 80000 + final public function jsonSerialize(): mixed {} +#else + /** @return mixed */ + final public function jsonSerialize() {} +#endif + } +} diff --git a/src/BSON/Undefined_arginfo.h b/src/BSON/Undefined_arginfo.h new file mode 100644 index 000000000..840bd223b --- /dev/null +++ b/src/BSON/Undefined_arginfo.h @@ -0,0 +1,62 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 78669572ebbe92cabbefacd145fca8332bc7cb75 */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Undefined___construct, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Undefined___toString, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_BSON_Undefined_serialize arginfo_class_MongoDB_BSON_Undefined___toString + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Undefined_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Undefined___unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Undefined___serialize, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Undefined_jsonSerialize, 0, 0, IS_MIXED, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Undefined_jsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + + +ZEND_METHOD(MongoDB_BSON_Undefined, __construct); +ZEND_METHOD(MongoDB_BSON_Undefined, __toString); +ZEND_METHOD(MongoDB_BSON_Undefined, serialize); +ZEND_METHOD(MongoDB_BSON_Undefined, unserialize); +ZEND_METHOD(MongoDB_BSON_Undefined, __unserialize); +ZEND_METHOD(MongoDB_BSON_Undefined, __serialize); +#if PHP_VERSION_ID >= 80000 +ZEND_METHOD(MongoDB_BSON_Undefined, jsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_METHOD(MongoDB_BSON_Undefined, jsonSerialize); +#endif + + +static const zend_function_entry class_MongoDB_BSON_Undefined_methods[] = { + ZEND_ME(MongoDB_BSON_Undefined, __construct, arginfo_class_MongoDB_BSON_Undefined___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Undefined, __toString, arginfo_class_MongoDB_BSON_Undefined___toString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Undefined, serialize, arginfo_class_MongoDB_BSON_Undefined_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Undefined, unserialize, arginfo_class_MongoDB_BSON_Undefined_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Undefined, __unserialize, arginfo_class_MongoDB_BSON_Undefined___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_BSON_Undefined, __serialize, arginfo_class_MongoDB_BSON_Undefined___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_BSON_Undefined, jsonSerialize, arginfo_class_MongoDB_BSON_Undefined_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_BSON_Undefined, jsonSerialize, arginfo_class_MongoDB_BSON_Undefined_jsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; diff --git a/src/BSON/Unserializable.c b/src/BSON/Unserializable.c index 62eb49c20..a6c6d5037 100644 --- a/src/BSON/Unserializable.c +++ b/src/BSON/Unserializable.c @@ -17,26 +17,14 @@ #include #include "php_phongo.h" +#include "Unserializable_arginfo.h" zend_class_entry* php_phongo_unserializable_ce; -/* {{{ MongoDB\BSON\Unserializable function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_Unserializable_bsonUnserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_unserializable_me[] = { - /* clang-format off */ - ZEND_ABSTRACT_ME(Unserializable, bsonUnserialize, ai_Unserializable_bsonUnserialize) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - void php_phongo_unserializable_init_ce(INIT_FUNC_ARGS) /* {{{ */ { zend_class_entry ce; - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Unserializable", php_phongo_unserializable_me); + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Unserializable", class_MongoDB_BSON_Unserializable_methods); php_phongo_unserializable_ce = zend_register_internal_interface(&ce); } /* }}} */ diff --git a/src/BSON/Unserializable.stub.php b/src/BSON/Unserializable.stub.php new file mode 100644 index 000000000..841377e25 --- /dev/null +++ b/src/BSON/Unserializable.stub.php @@ -0,0 +1,12 @@ + --EXPECTF-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException +OK: Got TypeError %SMongoDB\BSON\Decimal128::__construct()%sstring, array given OK: Got MongoDB\Driver\Exception\InvalidArgumentException Error parsing Decimal128 string: foo diff --git a/tests/bson/bson-objectid_error-001.phpt b/tests/bson/bson-objectid_error-001.phpt index dd634338d..e06a34186 100644 --- a/tests/bson/bson-objectid_error-001.phpt +++ b/tests/bson/bson-objectid_error-001.phpt @@ -10,12 +10,12 @@ require_once __DIR__ . '/../utils/basic.inc'; echo throws(function() { new MongoDB\BSON\ObjectId(new stdclass); -}, MongoDB\Driver\Exception\InvalidArgumentException::class), "\n"; +}, TypeError::class), "\n"; ?> ===DONE=== --EXPECTF-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -%SMongoDB\BSON\ObjectId::__construct()%sstring, %r(object|stdClass)%r given +OK: Got TypeError +%SMongoDB\BSON\ObjectId::__construct()%sstring or null, %r(object|stdClass)%r given ===DONE=== From 7441e3f43352c77e76aa712d63bc27bc60bbe54d Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Fri, 22 Jul 2022 12:09:41 +0200 Subject: [PATCH 04/26] Declare tentative return types in interfaces --- src/BSON/BinaryInterface.stub.php | 11 +++++------ src/BSON/BinaryInterface_arginfo.h | 10 ++++++---- src/BSON/Decimal128Interface.stub.php | 4 ++-- src/BSON/Decimal128Interface_arginfo.h | 4 ++-- src/BSON/JavascriptInterface.stub.php | 12 ++++++------ src/BSON/JavascriptInterface_arginfo.h | 7 ++++--- src/BSON/ObjectIdInterface.stub.php | 8 ++++---- src/BSON/ObjectIdInterface_arginfo.h | 7 ++++--- src/BSON/RegexInterface.stub.php | 12 ++++++------ src/BSON/RegexInterface_arginfo.h | 4 ++-- src/BSON/Serializable.stub.php | 5 +++++ src/BSON/Serializable_arginfo.h | 18 +++++++++++++++++- src/BSON/TimestampInterface.stub.php | 12 ++++++------ src/BSON/TimestampInterface_arginfo.h | 7 ++++--- src/BSON/UTCDateTimeInterface.stub.php | 8 ++++---- src/BSON/UTCDateTimeInterface_arginfo.h | 7 ++++--- src/BSON/Unserializable.stub.php | 4 ++-- src/BSON/Unserializable_arginfo.h | 4 ++-- src/phongo_compat.h | 16 ++++++++++++++++ 19 files changed, 101 insertions(+), 59 deletions(-) diff --git a/src/BSON/BinaryInterface.stub.php b/src/BSON/BinaryInterface.stub.php index fd16f3b09..94db537af 100644 --- a/src/BSON/BinaryInterface.stub.php +++ b/src/BSON/BinaryInterface.stub.php @@ -6,13 +6,12 @@ { interface BinaryInterface { - /** @return string */ - public function getData(); + /** @tentative-return-type */ + public function getData(): string; - /** @return int */ - public function getType(); + /** @tentative-return-type */ + public function getType(): int; - /** @return string */ - public function __toString(); + public function __toString(): string; } } diff --git a/src/BSON/BinaryInterface_arginfo.h b/src/BSON/BinaryInterface_arginfo.h index 661c6e386..0fe9af64c 100644 --- a/src/BSON/BinaryInterface_arginfo.h +++ b/src/BSON/BinaryInterface_arginfo.h @@ -1,12 +1,14 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 94e9712be580cfdfb00e3dc1495a02f21c0776f2 */ + * Stub hash: f473cfa60d45e1bc8105562cd69d5520ada009a6 */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_BinaryInterface_getData, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_BinaryInterface_getData, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_BinaryInterface_getType arginfo_class_MongoDB_BSON_BinaryInterface_getData +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_BinaryInterface_getType, 0, 0, IS_LONG, 0) +ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_BinaryInterface___toString arginfo_class_MongoDB_BSON_BinaryInterface_getData +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_BinaryInterface___toString, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() diff --git a/src/BSON/Decimal128Interface.stub.php b/src/BSON/Decimal128Interface.stub.php index c20e359f1..88d30ee4c 100644 --- a/src/BSON/Decimal128Interface.stub.php +++ b/src/BSON/Decimal128Interface.stub.php @@ -6,7 +6,7 @@ { interface Decimal128Interface { - /** @return string **/ - public function __toString() {} + /** @tentative-return-type */ + public function __toString(): string; } } diff --git a/src/BSON/Decimal128Interface_arginfo.h b/src/BSON/Decimal128Interface_arginfo.h index 557b9dc04..7744fd292 100644 --- a/src/BSON/Decimal128Interface_arginfo.h +++ b/src/BSON/Decimal128Interface_arginfo.h @@ -1,7 +1,7 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 8b420c20d426e77fc2472e4bebf3b05fa1932023 */ + * Stub hash: 368214eaa78cedaf7ad40b4775cbf6c66c5112e5 */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128Interface___toString, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128Interface___toString, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/src/BSON/JavascriptInterface.stub.php b/src/BSON/JavascriptInterface.stub.php index 82162ac39..5ca214b61 100644 --- a/src/BSON/JavascriptInterface.stub.php +++ b/src/BSON/JavascriptInterface.stub.php @@ -6,13 +6,13 @@ { interface JavascriptInterface { - /** @return string */ - public function getCode(); + /** @tentative-return-type */ + public function getCode(): string; - /** @return object|null */ - public function getScope(); + /** @tentative-return-type */ + public function getScope(): ?object; - /** @return string */ - public function __toString(); + /** @tentative-return-type */ + public function __toString(): string; } } diff --git a/src/BSON/JavascriptInterface_arginfo.h b/src/BSON/JavascriptInterface_arginfo.h index 0b9cc7957..3f5c5f8a7 100644 --- a/src/BSON/JavascriptInterface_arginfo.h +++ b/src/BSON/JavascriptInterface_arginfo.h @@ -1,10 +1,11 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: fed93e737f61211a869f684f5a47cf59b8289d38 */ + * Stub hash: c7f05d054ca5c6cef6c1e8c7be5d25f97f88cabb */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_JavascriptInterface_getCode, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_JavascriptInterface_getCode, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_JavascriptInterface_getScope arginfo_class_MongoDB_BSON_JavascriptInterface_getCode +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_JavascriptInterface_getScope, 0, 0, IS_OBJECT, 1) +ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_JavascriptInterface___toString arginfo_class_MongoDB_BSON_JavascriptInterface_getCode diff --git a/src/BSON/ObjectIdInterface.stub.php b/src/BSON/ObjectIdInterface.stub.php index e8886e610..d74d4f69b 100644 --- a/src/BSON/ObjectIdInterface.stub.php +++ b/src/BSON/ObjectIdInterface.stub.php @@ -6,10 +6,10 @@ { interface ObjectIdInterface { - /** @return int */ - public function getTimestamp(); + /** @tentative-return-type */ + public function getTimestamp(): int; - /** @return string */ - public function __toString(); + /** @tentative-return-type */ + public function __toString(): string; } } diff --git a/src/BSON/ObjectIdInterface_arginfo.h b/src/BSON/ObjectIdInterface_arginfo.h index c6b69051c..beef59a6f 100644 --- a/src/BSON/ObjectIdInterface_arginfo.h +++ b/src/BSON/ObjectIdInterface_arginfo.h @@ -1,10 +1,11 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 6cf18a028a28b0e98e195d015135a44063872715 */ + * Stub hash: 8bae600a914e3246326ad171a7ceb001646e9777 */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_ObjectIdInterface_getTimestamp, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_ObjectIdInterface_getTimestamp, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_ObjectIdInterface___toString arginfo_class_MongoDB_BSON_ObjectIdInterface_getTimestamp +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_ObjectIdInterface___toString, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() diff --git a/src/BSON/RegexInterface.stub.php b/src/BSON/RegexInterface.stub.php index 8ba4d405b..808fd696d 100644 --- a/src/BSON/RegexInterface.stub.php +++ b/src/BSON/RegexInterface.stub.php @@ -6,13 +6,13 @@ { interface RegexInterface { - /** @return string */ - public function getPattern(); + /** @tentative-return-type */ + public function getPattern(): string; - /** @return string */ - public function getFlags(); + /** @tentative-return-type */ + public function getFlags(): string; - /** @return string */ - public function __toString(); + /** @tentative-return-type */ + public function __toString(): string; } } diff --git a/src/BSON/RegexInterface_arginfo.h b/src/BSON/RegexInterface_arginfo.h index 9966bd1e4..6ad8e0760 100644 --- a/src/BSON/RegexInterface_arginfo.h +++ b/src/BSON/RegexInterface_arginfo.h @@ -1,7 +1,7 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 721f3456663248c393ef810ca6ef8f78fb6237c1 */ + * Stub hash: d7caad936945e20c44c665682b946fe9cdc769a5 */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_RegexInterface_getPattern, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_RegexInterface_getPattern, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_RegexInterface_getFlags arginfo_class_MongoDB_BSON_RegexInterface_getPattern diff --git a/src/BSON/Serializable.stub.php b/src/BSON/Serializable.stub.php index fc9ef1a1c..28300128b 100644 --- a/src/BSON/Serializable.stub.php +++ b/src/BSON/Serializable.stub.php @@ -6,7 +6,12 @@ { interface Serializable { +#if PHP_VERSION_ID >= 80000 + /** @tentative-return-type */ + public function bsonSerialize(): array|object; +#else /** @return array|object */ public function bsonSerialize(); +#endif } } diff --git a/src/BSON/Serializable_arginfo.h b/src/BSON/Serializable_arginfo.h index 6bba97265..a56beaa37 100644 --- a/src/BSON/Serializable_arginfo.h +++ b/src/BSON/Serializable_arginfo.h @@ -1,13 +1,29 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 9423cef46fb8c459a336f2b97c45c0ec0497bb8b */ + * Stub hash: d5b8cd4af55b91124737510ee9cb2435982214d9 */ +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_BSON_Serializable_bsonSerialize, 0, 0, MAY_BE_ARRAY|MAY_BE_OBJECT) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Serializable_bsonSerialize, 0, 0, 0) ZEND_END_ARG_INFO() +#endif +#if PHP_VERSION_ID >= 80000 +#endif +#if !(PHP_VERSION_ID >= 80000) +#endif static const zend_function_entry class_MongoDB_BSON_Serializable_methods[] = { +#if PHP_VERSION_ID >= 80000 + ZEND_ABSTRACT_ME_WITH_FLAGS(MongoDB_BSON_Serializable, bsonSerialize, arginfo_class_MongoDB_BSON_Serializable_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) +#endif +#if !(PHP_VERSION_ID >= 80000) ZEND_ABSTRACT_ME_WITH_FLAGS(MongoDB_BSON_Serializable, bsonSerialize, arginfo_class_MongoDB_BSON_Serializable_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) +#endif ZEND_FE_END }; diff --git a/src/BSON/TimestampInterface.stub.php b/src/BSON/TimestampInterface.stub.php index ddcf8d779..10e048b31 100644 --- a/src/BSON/TimestampInterface.stub.php +++ b/src/BSON/TimestampInterface.stub.php @@ -6,13 +6,13 @@ { interface TimestampInterface { - /** @return int */ - public function getTimestamp(); + /** @tentative-return-type */ + public function getTimestamp(): int; - /** @return int */ - public function getIncrement(); + /** @tentative-return-type */ + public function getIncrement(): int; - /** @return string */ - public function __toString(); + /** @tentative-return-type */ + public function __toString(): string; } } diff --git a/src/BSON/TimestampInterface_arginfo.h b/src/BSON/TimestampInterface_arginfo.h index 5d84ee073..c67603c91 100644 --- a/src/BSON/TimestampInterface_arginfo.h +++ b/src/BSON/TimestampInterface_arginfo.h @@ -1,12 +1,13 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c6c7c0738bb1aa76ffc0b068e67bdc66f9f9a2eb */ + * Stub hash: 78de12d24d4b0b4a282f3c430a045d8d56adec93 */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_TimestampInterface_getTimestamp, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_TimestampInterface_getTimestamp, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_TimestampInterface_getIncrement arginfo_class_MongoDB_BSON_TimestampInterface_getTimestamp -#define arginfo_class_MongoDB_BSON_TimestampInterface___toString arginfo_class_MongoDB_BSON_TimestampInterface_getTimestamp +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_TimestampInterface___toString, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() diff --git a/src/BSON/UTCDateTimeInterface.stub.php b/src/BSON/UTCDateTimeInterface.stub.php index e0a6e7715..7513124ac 100644 --- a/src/BSON/UTCDateTimeInterface.stub.php +++ b/src/BSON/UTCDateTimeInterface.stub.php @@ -6,10 +6,10 @@ { interface UTCDateTimeInterface { - /** @return \DateTime */ - public function toDateTime(); + /** @tentative-return-type */ + public function toDateTime(): \DateTime; - /** @return string */ - public function __toString(); + /** @tentative-return-type */ + public function __toString(): string; } } diff --git a/src/BSON/UTCDateTimeInterface_arginfo.h b/src/BSON/UTCDateTimeInterface_arginfo.h index 96ea7c3a6..2b82fea00 100644 --- a/src/BSON/UTCDateTimeInterface_arginfo.h +++ b/src/BSON/UTCDateTimeInterface_arginfo.h @@ -1,10 +1,11 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 14b398d2dda9345fe17e6c8d11e505ddc4fcba00 */ + * Stub hash: 1e892540102b36a2493090eb2fb021345ce54f73 */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTimeInterface_toDateTime, 0, 0, 0) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTimeInterface_toDateTime, 0, 0, DateTime, 0) ZEND_END_ARG_INFO() -#define arginfo_class_MongoDB_BSON_UTCDateTimeInterface___toString arginfo_class_MongoDB_BSON_UTCDateTimeInterface_toDateTime +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTimeInterface___toString, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() diff --git a/src/BSON/Unserializable.stub.php b/src/BSON/Unserializable.stub.php index 841377e25..e48b197bb 100644 --- a/src/BSON/Unserializable.stub.php +++ b/src/BSON/Unserializable.stub.php @@ -6,7 +6,7 @@ { interface Unserializable { - /** @return void */ - public function bsonUnserialize(array $data); + /** @tentative-return-type */ + public function bsonUnserialize(array $data): void; } } diff --git a/src/BSON/Unserializable_arginfo.h b/src/BSON/Unserializable_arginfo.h index c0c9cadc6..3a4e4ec93 100644 --- a/src/BSON/Unserializable_arginfo.h +++ b/src/BSON/Unserializable_arginfo.h @@ -1,7 +1,7 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ff2d1f7867e361355d1198d9fe29ad89b98595a3 */ + * Stub hash: 481db381cf7f0ff2035b7944fe20332730f9f51d */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Unserializable_bsonUnserialize, 0, 0, 1) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Unserializable_bsonUnserialize, 0, 1, IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/src/phongo_compat.h b/src/phongo_compat.h index 410edbbd3..9b0b9ffde 100644 --- a/src/phongo_compat.h +++ b/src/phongo_compat.h @@ -290,6 +290,22 @@ static inline zend_bool zend_ini_parse_bool(zend_string* str) ZEND_ARG_INFO(pass_by_ref, name) #endif +/* The ZEND_BEGIN_ARG_WITH_TENTATIVE_* set of macros was introduced in PHP 8.1 */ +#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX +#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ + ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) +#endif + +#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX +#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(name, return_reference, required_num_args, type) \ + ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) +#endif + +#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX +#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(name, return_reference, required_num_args, class_name, allow_null) \ + ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) +#endif + zend_bool php_phongo_zend_hash_apply_protection_begin(HashTable* ht); zend_bool php_phongo_zend_hash_apply_protection_end(HashTable* ht); From da90d6c965ddf9d3c78c892aee69bf02c9f60652 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 26 Jul 2022 09:33:25 +0200 Subject: [PATCH 05/26] Add correct return type for __set_state methods --- src/BSON/Binary.stub.php | 2 +- src/BSON/Binary_arginfo.h | 4 ++-- src/BSON/Decimal128.stub.php | 2 +- src/BSON/Decimal128_arginfo.h | 4 ++-- src/BSON/Javascript.stub.php | 2 +- src/BSON/Javascript_arginfo.h | 4 ++-- src/BSON/MaxKey.stub.php | 2 +- src/BSON/MaxKey_arginfo.h | 4 ++-- src/BSON/MinKey.stub.php | 2 +- src/BSON/MinKey_arginfo.h | 4 ++-- src/BSON/ObjectId.stub.php | 2 +- src/BSON/ObjectId_arginfo.h | 4 ++-- src/BSON/Regex.stub.php | 2 +- src/BSON/Regex_arginfo.h | 4 ++-- src/BSON/Timestamp.stub.php | 2 +- src/BSON/Timestamp_arginfo.h | 4 ++-- src/BSON/UTCDateTime.stub.php | 2 +- src/BSON/UTCDateTime_arginfo.h | 4 ++-- 18 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/BSON/Binary.stub.php b/src/BSON/Binary.stub.php index 148a1e0fc..40063855e 100644 --- a/src/BSON/Binary.stub.php +++ b/src/BSON/Binary.stub.php @@ -12,7 +12,7 @@ final public function getData(): string {} final public function getType(): int {} - public static function __set_state(array $properties): object {} + public static function __set_state(array $properties): Binary {} final public function __toString(): string {} diff --git a/src/BSON/Binary_arginfo.h b/src/BSON/Binary_arginfo.h index 8f33d5d5a..32a09c6a9 100644 --- a/src/BSON/Binary_arginfo.h +++ b/src/BSON/Binary_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 412adcf1154c1fdb8aee0e74eeda2e2528081fea */ + * Stub hash: f0ecc0b0ccfd6b0fceaa13cea21306a337022994 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Binary___construct, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) @@ -12,7 +12,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Binary_getType, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Binary___set_state, 0, 1, IS_OBJECT, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Binary___set_state, 0, 1, MongoDB\\BSON\\Binary, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/src/BSON/Decimal128.stub.php b/src/BSON/Decimal128.stub.php index ddc53b232..c7a71baca 100644 --- a/src/BSON/Decimal128.stub.php +++ b/src/BSON/Decimal128.stub.php @@ -10,7 +10,7 @@ final public function __construct(string $value = '') {} final public function __toString(): string {} - public static function __set_state(array $properties): object {} + public static function __set_state(array $properties): Decimal128 {} final public function serialize(): string {} diff --git a/src/BSON/Decimal128_arginfo.h b/src/BSON/Decimal128_arginfo.h index 55cf732aa..29ae2a835 100644 --- a/src/BSON/Decimal128_arginfo.h +++ b/src/BSON/Decimal128_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 76722efb5d6fc1b049ddd05dc27102b6ea66bdeb */ + * Stub hash: 27c67c871c2b56ef3091d5ae67f83ef4c6b050ad */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value, IS_STRING, 0, "\'\'") @@ -8,7 +8,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128___toString, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128___set_state, 0, 1, IS_OBJECT, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128___set_state, 0, 1, MongoDB\\BSON\\Decimal128, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/src/BSON/Javascript.stub.php b/src/BSON/Javascript.stub.php index b472bf395..d54db713c 100644 --- a/src/BSON/Javascript.stub.php +++ b/src/BSON/Javascript.stub.php @@ -13,7 +13,7 @@ final public function __construct(string $code, array|object|null $scope = null) final public function __construct(string $code, $scope = null) {} #endif - public static function __set_state(array $properties): object {} + public static function __set_state(array $properties): Javascript {} final public function getCode(): string {} diff --git a/src/BSON/Javascript_arginfo.h b/src/BSON/Javascript_arginfo.h index c2f2bbb7e..128486729 100644 --- a/src/BSON/Javascript_arginfo.h +++ b/src/BSON/Javascript_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 230f7c3390a65253d29bf9afa7df2a909d67cdf3 */ + * Stub hash: c291523fccb2bef4eacbcb422acc3025d6400946 */ #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___construct, 0, 0, 1) @@ -15,7 +15,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___construct, 0, 0, ZEND_END_ARG_INFO() #endif -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___set_state, 0, 1, IS_OBJECT, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___set_state, 0, 1, MongoDB\\BSON\\Javascript, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/src/BSON/MaxKey.stub.php b/src/BSON/MaxKey.stub.php index 432f93be4..0cdd1bf0c 100644 --- a/src/BSON/MaxKey.stub.php +++ b/src/BSON/MaxKey.stub.php @@ -6,7 +6,7 @@ { final class MaxKey { - public static function __set_state(array $properties): object {} + public static function __set_state(array $properties): MaxKey {} final public function serialize(): string {} diff --git a/src/BSON/MaxKey_arginfo.h b/src/BSON/MaxKey_arginfo.h index b41bb22bf..7f72fe814 100644 --- a/src/BSON/MaxKey_arginfo.h +++ b/src/BSON/MaxKey_arginfo.h @@ -1,7 +1,7 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 1a3f1ae78ba423da004c39927310bf4d3c83e515 */ + * Stub hash: 5c51e348f96c975a78829ad85b37ca679d8f303c */ -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey___set_state, 0, 1, IS_OBJECT, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey___set_state, 0, 1, MongoDB\\BSON\\MaxKey, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/src/BSON/MinKey.stub.php b/src/BSON/MinKey.stub.php index f2be4e03e..796c45584 100644 --- a/src/BSON/MinKey.stub.php +++ b/src/BSON/MinKey.stub.php @@ -6,7 +6,7 @@ { final class MinKey { - public static function __set_state(array $properties): object {} + public static function __set_state(array $properties): MinKey {} final public function serialize(): string {} diff --git a/src/BSON/MinKey_arginfo.h b/src/BSON/MinKey_arginfo.h index 509b18cdf..a3eca4e58 100644 --- a/src/BSON/MinKey_arginfo.h +++ b/src/BSON/MinKey_arginfo.h @@ -1,7 +1,7 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 1feadbbcb1410f2e8f679288d156dc20243d13c5 */ + * Stub hash: 38571448536fc3d6796cf95bcff83bfcd2d48068 */ -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_MinKey___set_state, 0, 1, IS_OBJECT, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_MinKey___set_state, 0, 1, MongoDB\\BSON\\MinKey, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/src/BSON/ObjectId.stub.php b/src/BSON/ObjectId.stub.php index d7cc8054e..74a4778a1 100644 --- a/src/BSON/ObjectId.stub.php +++ b/src/BSON/ObjectId.stub.php @@ -12,7 +12,7 @@ public final function getTimestamp(): int {} public final function __toString(): string {} - public static function __set_state(array $properties): object {} + public static function __set_state(array $properties): ObjectId {} final public function serialize(): string {} diff --git a/src/BSON/ObjectId_arginfo.h b/src/BSON/ObjectId_arginfo.h index 8c896a316..a634c538d 100644 --- a/src/BSON/ObjectId_arginfo.h +++ b/src/BSON/ObjectId_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3c30cc271533707c24d41525d6a2241803e819b2 */ + * Stub hash: c8158191698e96df756d9aa5767c598e6c4258bf */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, id, IS_STRING, 1, "null") @@ -11,7 +11,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId___toString, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId___set_state, 0, 1, IS_OBJECT, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId___set_state, 0, 1, MongoDB\\BSON\\ObjectId, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/src/BSON/Regex.stub.php b/src/BSON/Regex.stub.php index 03fa4cb0b..46dd2702f 100644 --- a/src/BSON/Regex.stub.php +++ b/src/BSON/Regex.stub.php @@ -14,7 +14,7 @@ public final function getFlags(): string {} public final function __toString(): string {} - public static function __set_state(array $properties): object {} + public static function __set_state(array $properties): Regex {} final public function serialize(): string {} diff --git a/src/BSON/Regex_arginfo.h b/src/BSON/Regex_arginfo.h index ec2984396..808a40204 100644 --- a/src/BSON/Regex_arginfo.h +++ b/src/BSON/Regex_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 4112f399f1c724b346a431a7d15e29e700549317 */ + * Stub hash: 76a05a27305d859539e9bc82818e7b37aeddeabf */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Regex___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0) @@ -13,7 +13,7 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_BSON_Regex___toString arginfo_class_MongoDB_BSON_Regex_getPattern -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Regex___set_state, 0, 1, IS_OBJECT, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Regex___set_state, 0, 1, MongoDB\\BSON\\Regex, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/src/BSON/Timestamp.stub.php b/src/BSON/Timestamp.stub.php index ceafb43c4..eacd19d00 100644 --- a/src/BSON/Timestamp.stub.php +++ b/src/BSON/Timestamp.stub.php @@ -22,7 +22,7 @@ public final function getIncrement(): int {} public final function __toString(): string {} - public static function __set_state(array $properties): object {} + public static function __set_state(array $properties): Timestamp {} final public function serialize(): string {} diff --git a/src/BSON/Timestamp_arginfo.h b/src/BSON/Timestamp_arginfo.h index e04183854..94d4857b6 100644 --- a/src/BSON/Timestamp_arginfo.h +++ b/src/BSON/Timestamp_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c566aa463b811fdc8f93a620d66ee19271fc12ec */ + * Stub hash: 8eaa3f85a84e77e54cae626f83b2f05967931afb */ #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___construct, 0, 0, 2) @@ -23,7 +23,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___toString, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___set_state, 0, 1, IS_OBJECT, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___set_state, 0, 1, MongoDB\\BSON\\Timestamp, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() diff --git a/src/BSON/UTCDateTime.stub.php b/src/BSON/UTCDateTime.stub.php index b56d7c14c..67ea01aba 100644 --- a/src/BSON/UTCDateTime.stub.php +++ b/src/BSON/UTCDateTime.stub.php @@ -17,7 +17,7 @@ public final function toDateTime(): \DateTime {} public final function __toString(): string {} - public static function __set_state(array $properties): object {} + public static function __set_state(array $properties): UTCDateTime {} final public function serialize(): string {} diff --git a/src/BSON/UTCDateTime_arginfo.h b/src/BSON/UTCDateTime_arginfo.h index ecefec7b2..5c40770ce 100644 --- a/src/BSON/UTCDateTime_arginfo.h +++ b/src/BSON/UTCDateTime_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c12df07890fa4157411a88b1a2a90577bcf28967 */ + * Stub hash: 7c0beb464e92cd5fc7bf6f4d0bea48dabb7875db */ #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___construct, 0, 0, 0) @@ -19,7 +19,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___toString, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___set_state, 0, 1, IS_OBJECT, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___set_state, 0, 1, MongoDB\\BSON\\UTCDateTime, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() From 4d54c6f515ed68674f5e1d956d0f19ad16977a2c Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Wed, 27 Jul 2022 13:44:40 +0200 Subject: [PATCH 06/26] Generate class entries for BSON classes --- src/BSON/Binary.c | 31 +++++++------------- src/BSON/Binary.stub.php | 7 +++-- src/BSON/BinaryInterface.c | 5 +--- src/BSON/BinaryInterface.stub.php | 5 +++- src/BSON/BinaryInterface_arginfo.h | 12 +++++++- src/BSON/Binary_arginfo.h | 36 +++++++++++++++-------- src/BSON/DBPointer.c | 22 +++++--------- src/BSON/DBPointer.stub.php | 7 +++-- src/BSON/DBPointer_arginfo.h | 30 +++++++++++++------ src/BSON/Decimal128.c | 27 ++++++------------ src/BSON/Decimal128.stub.php | 7 +++-- src/BSON/Decimal128Interface.c | 5 +--- src/BSON/Decimal128Interface.stub.php | 5 +++- src/BSON/Decimal128Interface_arginfo.h | 12 +++++++- src/BSON/Decimal128_arginfo.h | 32 ++++++++++++++------- src/BSON/Int64.c | 22 +++++--------- src/BSON/Int64.stub.php | 7 +++-- src/BSON/Int64_arginfo.h | 30 +++++++++++++------ src/BSON/Javascript.c | 31 +++++++------------- src/BSON/Javascript.stub.php | 7 +++-- src/BSON/JavascriptInterface.c | 5 +--- src/BSON/JavascriptInterface.stub.php | 5 +++- src/BSON/JavascriptInterface_arginfo.h | 12 +++++++- src/BSON/Javascript_arginfo.h | 38 ++++++++++++++++--------- src/BSON/MaxKey.c | 23 +++++---------- src/BSON/MaxKey.stub.php | 7 +++-- src/BSON/MaxKeyInterface.c | 12 ++------ src/BSON/MaxKeyInterface.stub.php | 13 +++++++++ src/BSON/MaxKeyInterface_arginfo.h | 19 +++++++++++++ src/BSON/MaxKey_arginfo.h | 28 ++++++++++++------ src/BSON/MinKey.c | 23 +++++---------- src/BSON/MinKey.stub.php | 7 +++-- src/BSON/MinKeyInterface.c | 12 ++------ src/BSON/MinKeyInterface.stub.php | 13 +++++++++ src/BSON/MinKeyInterface_arginfo.h | 19 +++++++++++++ src/BSON/MinKey_arginfo.h | 28 ++++++++++++------ src/BSON/ObjectId.c | 29 +++++++------------ src/BSON/ObjectId.stub.php | 7 +++-- src/BSON/ObjectIdInterface.c | 5 +--- src/BSON/ObjectIdInterface.stub.php | 5 +++- src/BSON/ObjectIdInterface_arginfo.h | 12 +++++++- src/BSON/ObjectId_arginfo.h | 34 +++++++++++++++------- src/BSON/Persistable.c | 6 +--- src/BSON/Persistable.stub.php | 7 +++-- src/BSON/Persistable_arginfo.h | 13 ++++++++- src/BSON/Regex.c | 31 +++++++------------- src/BSON/Regex.stub.php | 7 +++-- src/BSON/RegexInterface.c | 5 +--- src/BSON/RegexInterface.stub.php | 5 +++- src/BSON/RegexInterface_arginfo.h | 12 +++++++- src/BSON/Regex_arginfo.h | 36 +++++++++++++++-------- src/BSON/Serializable.c | 6 +--- src/BSON/Serializable.stub.php | 7 +++-- src/BSON/Serializable_arginfo.h | 13 ++++++++- src/BSON/Symbol.c | 22 +++++--------- src/BSON/Symbol.stub.php | 7 +++-- src/BSON/Symbol_arginfo.h | 30 +++++++++++++------ src/BSON/Timestamp.c | 31 +++++++------------- src/BSON/Timestamp.stub.php | 7 +++-- src/BSON/TimestampInterface.c | 5 +--- src/BSON/TimestampInterface.stub.php | 5 +++- src/BSON/TimestampInterface_arginfo.h | 12 +++++++- src/BSON/Timestamp_arginfo.h | 38 ++++++++++++++++--------- src/BSON/Type.c | 12 ++------ src/BSON/Type.stub.php | 13 +++++++++ src/BSON/Type_arginfo.h | 19 +++++++++++++ src/BSON/UTCDateTime.c | 29 +++++++------------ src/BSON/UTCDateTime.stub.php | 7 +++-- src/BSON/UTCDateTimeInterface.c | 5 +--- src/BSON/UTCDateTimeInterface.stub.php | 5 +++- src/BSON/UTCDateTimeInterface_arginfo.h | 12 +++++++- src/BSON/UTCDateTime_arginfo.h | 38 ++++++++++++++++--------- src/BSON/Undefined.c | 22 +++++--------- src/BSON/Undefined.stub.php | 7 +++-- src/BSON/Undefined_arginfo.h | 30 +++++++++++++------ src/BSON/Unserializable.c | 5 +--- src/BSON/Unserializable.stub.php | 5 +++- src/BSON/Unserializable_arginfo.h | 12 +++++++- 78 files changed, 738 insertions(+), 484 deletions(-) create mode 100644 src/BSON/MaxKeyInterface.stub.php create mode 100644 src/BSON/MaxKeyInterface_arginfo.h create mode 100644 src/BSON/MinKeyInterface.stub.php create mode 100644 src/BSON/MinKeyInterface_arginfo.h create mode 100644 src/BSON/Type.stub.php create mode 100644 src/BSON/Type_arginfo.h diff --git a/src/BSON/Binary.c b/src/BSON/Binary.c index c190bab7b..647ab6e2e 100644 --- a/src/BSON/Binary.c +++ b/src/BSON/Binary.c @@ -93,7 +93,7 @@ static HashTable* php_phongo_binary_get_properties_hash(phongo_compat_object_han /* {{{ proto void MongoDB\BSON\Binary::__construct(string $data, int $type) Construct a new BSON binary type */ -PHP_METHOD(MongoDB_BSON_Binary, __construct) +static PHP_METHOD(MongoDB_BSON_Binary, __construct) { php_phongo_binary_t* intern; char* data; @@ -112,7 +112,7 @@ PHP_METHOD(MongoDB_BSON_Binary, __construct) /* {{{ proto MongoDB\BSON\Binary MongoDB\BSON\Binary::__set_state(array $properties) */ -PHP_METHOD(MongoDB_BSON_Binary, __set_state) +static PHP_METHOD(MongoDB_BSON_Binary, __set_state) { php_phongo_binary_t* intern; HashTable* props; @@ -132,7 +132,7 @@ PHP_METHOD(MongoDB_BSON_Binary, __set_state) /* {{{ proto string MongoDB\BSON\Binary::__toString() Return the Binary's data string. */ -PHP_METHOD(MongoDB_BSON_Binary, __toString) +static PHP_METHOD(MongoDB_BSON_Binary, __toString) { php_phongo_binary_t* intern; @@ -145,7 +145,7 @@ PHP_METHOD(MongoDB_BSON_Binary, __toString) /* {{{ proto string MongoDB\BSON\Binary::getData() */ -PHP_METHOD(MongoDB_BSON_Binary, getData) +static PHP_METHOD(MongoDB_BSON_Binary, getData) { php_phongo_binary_t* intern; @@ -158,7 +158,7 @@ PHP_METHOD(MongoDB_BSON_Binary, getData) /* {{{ proto integer MongoDB\BSON\Binary::getType() */ -PHP_METHOD(MongoDB_BSON_Binary, getType) +static PHP_METHOD(MongoDB_BSON_Binary, getType) { php_phongo_binary_t* intern; @@ -171,7 +171,7 @@ PHP_METHOD(MongoDB_BSON_Binary, getType) /* {{{ proto array MongoDB\BSON\Binary::jsonSerialize() */ -PHP_METHOD(MongoDB_BSON_Binary, jsonSerialize) +static PHP_METHOD(MongoDB_BSON_Binary, jsonSerialize) { php_phongo_binary_t* intern; char type[3]; @@ -195,7 +195,7 @@ PHP_METHOD(MongoDB_BSON_Binary, jsonSerialize) /* {{{ proto string MongoDB\BSON\Binary::serialize() */ -PHP_METHOD(MongoDB_BSON_Binary, serialize) +static PHP_METHOD(MongoDB_BSON_Binary, serialize) { php_phongo_binary_t* intern; zval retval; @@ -223,7 +223,7 @@ PHP_METHOD(MongoDB_BSON_Binary, serialize) /* {{{ proto void MongoDB\BSON\Binary::unserialize(string $serialized) */ -PHP_METHOD(MongoDB_BSON_Binary, unserialize) +static PHP_METHOD(MongoDB_BSON_Binary, unserialize) { php_phongo_binary_t* intern; char* serialized; @@ -253,7 +253,7 @@ PHP_METHOD(MongoDB_BSON_Binary, unserialize) /* {{{ proto array MongoDB\Driver\Binary::__serialize() */ -PHP_METHOD(MongoDB_BSON_Binary, __serialize) +static PHP_METHOD(MongoDB_BSON_Binary, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -262,7 +262,7 @@ PHP_METHOD(MongoDB_BSON_Binary, __serialize) /* {{{ proto void MongoDB\Driver\Binary::__unserialize(array $data) */ -PHP_METHOD(MongoDB_BSON_Binary, __unserialize) +static PHP_METHOD(MongoDB_BSON_Binary, __unserialize) { zval* data; @@ -357,17 +357,8 @@ static HashTable* php_phongo_binary_get_properties(phongo_compat_object_handler_ void php_phongo_binary_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Binary", class_MongoDB_BSON_Binary_methods); - php_phongo_binary_ce = zend_register_internal_class(&ce); + 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->create_object = php_phongo_binary_create_object; - PHONGO_CE_FINAL(php_phongo_binary_ce); - - zend_class_implements(php_phongo_binary_ce, 1, php_phongo_binary_interface_ce); - zend_class_implements(php_phongo_binary_ce, 1, php_phongo_json_serializable_ce); - zend_class_implements(php_phongo_binary_ce, 1, php_phongo_type_ce); - zend_class_implements(php_phongo_binary_ce, 1, zend_ce_serializable); #if PHP_VERSION_ID >= 80000 zend_class_implements(php_phongo_binary_ce, 1, zend_ce_stringable); diff --git a/src/BSON/Binary.stub.php b/src/BSON/Binary.stub.php index 40063855e..101378ca1 100644 --- a/src/BSON/Binary.stub.php +++ b/src/BSON/Binary.stub.php @@ -1,10 +1,13 @@ = 80000 -ZEND_METHOD(MongoDB_BSON_Binary, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Binary, jsonSerialize); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_Binary, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Binary, jsonSerialize); #endif @@ -77,3 +77,15 @@ static const zend_function_entry class_MongoDB_BSON_Binary_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_Binary(zend_class_entry *class_entry_MongoDB_BSON_BinaryInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Binary", class_MongoDB_BSON_Binary_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_BinaryInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + + return class_entry; +} diff --git a/src/BSON/DBPointer.c b/src/BSON/DBPointer.c index 0c651e41c..c848771d3 100644 --- a/src/BSON/DBPointer.c +++ b/src/BSON/DBPointer.c @@ -95,7 +95,7 @@ PHONGO_DISABLED_CONSTRUCTOR(MongoDB_BSON_DBPointer) /* {{{ proto string MongoDB\BSON\DBPointer::__toString() Return the DBPointer's namespace string and ObjectId. */ -PHP_METHOD(MongoDB_BSON_DBPointer, __toString) +static PHP_METHOD(MongoDB_BSON_DBPointer, __toString) { php_phongo_dbpointer_t* intern; char* retval; @@ -112,7 +112,7 @@ PHP_METHOD(MongoDB_BSON_DBPointer, __toString) /* {{{ proto array MongoDB\BSON\Symbol::jsonSerialize() */ -PHP_METHOD(MongoDB_BSON_DBPointer, jsonSerialize) +static PHP_METHOD(MongoDB_BSON_DBPointer, jsonSerialize) { php_phongo_dbpointer_t* intern; zval zdb_pointer; @@ -134,7 +134,7 @@ PHP_METHOD(MongoDB_BSON_DBPointer, jsonSerialize) /* {{{ proto string MongoDB\BSON\DBPointer::serialize() */ -PHP_METHOD(MongoDB_BSON_DBPointer, serialize) +static PHP_METHOD(MongoDB_BSON_DBPointer, serialize) { php_phongo_dbpointer_t* intern; zval retval; @@ -162,7 +162,7 @@ PHP_METHOD(MongoDB_BSON_DBPointer, serialize) /* {{{ proto void MongoDB\BSON\DBPointer::unserialize(string $serialized) */ -PHP_METHOD(MongoDB_BSON_DBPointer, unserialize) +static PHP_METHOD(MongoDB_BSON_DBPointer, unserialize) { php_phongo_dbpointer_t* intern; char* serialized; @@ -192,7 +192,7 @@ PHP_METHOD(MongoDB_BSON_DBPointer, unserialize) /* {{{ proto array MongoDB\Driver\DBPointer::__serialize() */ -PHP_METHOD(MongoDB_BSON_DBPointer, __serialize) +static PHP_METHOD(MongoDB_BSON_DBPointer, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -201,7 +201,7 @@ PHP_METHOD(MongoDB_BSON_DBPointer, __serialize) /* {{{ proto void MongoDB\Driver\DBPointer::__unserialize(array $data) */ -PHP_METHOD(MongoDB_BSON_DBPointer, __unserialize) +static PHP_METHOD(MongoDB_BSON_DBPointer, __unserialize) { zval* data; @@ -293,16 +293,8 @@ static HashTable* php_phongo_dbpointer_get_properties(phongo_compat_object_handl void php_phongo_dbpointer_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "DBPointer", class_MongoDB_BSON_DBPointer_methods); - php_phongo_dbpointer_ce = zend_register_internal_class(&ce); + 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->create_object = php_phongo_dbpointer_create_object; - PHONGO_CE_FINAL(php_phongo_dbpointer_ce); - - zend_class_implements(php_phongo_dbpointer_ce, 1, php_phongo_json_serializable_ce); - zend_class_implements(php_phongo_dbpointer_ce, 1, php_phongo_type_ce); - zend_class_implements(php_phongo_dbpointer_ce, 1, zend_ce_serializable); #if PHP_VERSION_ID >= 80000 zend_class_implements(php_phongo_dbpointer_ce, 1, zend_ce_stringable); diff --git a/src/BSON/DBPointer.stub.php b/src/BSON/DBPointer.stub.php index 9e29007ab..1a72e3266 100644 --- a/src/BSON/DBPointer.stub.php +++ b/src/BSON/DBPointer.stub.php @@ -1,10 +1,13 @@ = 80000 -ZEND_METHOD(MongoDB_BSON_DBPointer, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_DBPointer, jsonSerialize); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_DBPointer, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_DBPointer, jsonSerialize); #endif @@ -60,3 +60,15 @@ static const zend_function_entry class_MongoDB_BSON_DBPointer_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_DBPointer(zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "DBPointer", class_MongoDB_BSON_DBPointer_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 3, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + + return class_entry; +} diff --git a/src/BSON/Decimal128.c b/src/BSON/Decimal128.c index ffd34bb8f..673a13f8d 100644 --- a/src/BSON/Decimal128.c +++ b/src/BSON/Decimal128.c @@ -83,7 +83,7 @@ static HashTable* php_phongo_decimal128_get_properties_hash(phongo_compat_object /* {{{ proto void MongoDB\BSON\Decimal128::__construct(string $value) Construct a new BSON Decimal128 type */ -PHP_METHOD(MongoDB_BSON_Decimal128, __construct) +static PHP_METHOD(MongoDB_BSON_Decimal128, __construct) { php_phongo_decimal128_t* intern; char* value; @@ -100,7 +100,7 @@ PHP_METHOD(MongoDB_BSON_Decimal128, __construct) /* {{{ proto MongoDB\BSON\Decimal128 MongoDB\BSON\Decimal128::__set_state(array $properties) */ -PHP_METHOD(MongoDB_BSON_Decimal128, __set_state) +static PHP_METHOD(MongoDB_BSON_Decimal128, __set_state) { php_phongo_decimal128_t* intern; HashTable* props; @@ -120,7 +120,7 @@ PHP_METHOD(MongoDB_BSON_Decimal128, __set_state) /* {{{ proto string MongoDB\BSON\Decimal128::__toString() */ -PHP_METHOD(MongoDB_BSON_Decimal128, __toString) +static PHP_METHOD(MongoDB_BSON_Decimal128, __toString) { php_phongo_decimal128_t* intern; char outbuf[BSON_DECIMAL128_STRING]; @@ -136,7 +136,7 @@ PHP_METHOD(MongoDB_BSON_Decimal128, __toString) /* {{{ proto array MongoDB\BSON\Decimal128::jsonSerialize() */ -PHP_METHOD(MongoDB_BSON_Decimal128, jsonSerialize) +static PHP_METHOD(MongoDB_BSON_Decimal128, jsonSerialize) { php_phongo_decimal128_t* intern; char outbuf[BSON_DECIMAL128_STRING] = ""; @@ -152,7 +152,7 @@ PHP_METHOD(MongoDB_BSON_Decimal128, jsonSerialize) /* {{{ proto string MongoDB\BSON\Decimal128::serialize() */ -PHP_METHOD(MongoDB_BSON_Decimal128, serialize) +static PHP_METHOD(MongoDB_BSON_Decimal128, serialize) { php_phongo_decimal128_t* intern; zval retval; @@ -181,7 +181,7 @@ PHP_METHOD(MongoDB_BSON_Decimal128, serialize) /* {{{ proto void MongoDB\BSON\Decimal128::unserialize(string $serialized) */ -PHP_METHOD(MongoDB_BSON_Decimal128, unserialize) +static PHP_METHOD(MongoDB_BSON_Decimal128, unserialize) { php_phongo_decimal128_t* intern; char* serialized; @@ -211,7 +211,7 @@ PHP_METHOD(MongoDB_BSON_Decimal128, unserialize) /* {{{ proto array MongoDB\Driver\Decimal128::__serialize() */ -PHP_METHOD(MongoDB_BSON_Decimal128, __serialize) +static PHP_METHOD(MongoDB_BSON_Decimal128, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -220,7 +220,7 @@ PHP_METHOD(MongoDB_BSON_Decimal128, __serialize) /* {{{ proto void MongoDB\Driver\Decimal128::__unserialize(array $data) */ -PHP_METHOD(MongoDB_BSON_Decimal128, __unserialize) +static PHP_METHOD(MongoDB_BSON_Decimal128, __unserialize) { zval* data; @@ -291,17 +291,8 @@ static HashTable* php_phongo_decimal128_get_properties(phongo_compat_object_hand void php_phongo_decimal128_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Decimal128", class_MongoDB_BSON_Decimal128_methods); - php_phongo_decimal128_ce = zend_register_internal_class(&ce); + 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->create_object = php_phongo_decimal128_create_object; - PHONGO_CE_FINAL(php_phongo_decimal128_ce); - - zend_class_implements(php_phongo_decimal128_ce, 1, php_phongo_decimal128_interface_ce); - zend_class_implements(php_phongo_decimal128_ce, 1, php_phongo_json_serializable_ce); - zend_class_implements(php_phongo_decimal128_ce, 1, php_phongo_type_ce); - zend_class_implements(php_phongo_decimal128_ce, 1, zend_ce_serializable); #if PHP_VERSION_ID >= 80000 zend_class_implements(php_phongo_decimal128_ce, 1, zend_ce_stringable); diff --git a/src/BSON/Decimal128.stub.php b/src/BSON/Decimal128.stub.php index c7a71baca..5a9f5b918 100644 --- a/src/BSON/Decimal128.stub.php +++ b/src/BSON/Decimal128.stub.php @@ -1,10 +1,13 @@ = 80000 -ZEND_METHOD(MongoDB_BSON_Decimal128, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Decimal128, jsonSerialize); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_Decimal128, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Decimal128, jsonSerialize); #endif @@ -67,3 +67,15 @@ static const zend_function_entry class_MongoDB_BSON_Decimal128_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_Decimal128(zend_class_entry *class_entry_MongoDB_BSON_Decimal128Interface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Decimal128", class_MongoDB_BSON_Decimal128_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_Decimal128Interface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + + return class_entry; +} diff --git a/src/BSON/Int64.c b/src/BSON/Int64.c index cca087579..cd527aa06 100644 --- a/src/BSON/Int64.c +++ b/src/BSON/Int64.c @@ -90,7 +90,7 @@ PHONGO_DISABLED_CONSTRUCTOR(MongoDB_BSON_Int64) /* {{{ proto string MongoDB\BSON\Int64::__toString() Return the Int64's value as a string. */ -PHP_METHOD(MongoDB_BSON_Int64, __toString) +static PHP_METHOD(MongoDB_BSON_Int64, __toString) { php_phongo_int64_t* intern; @@ -103,7 +103,7 @@ PHP_METHOD(MongoDB_BSON_Int64, __toString) /* {{{ proto array MongoDB\BSON\Int64::jsonSerialize() */ -PHP_METHOD(MongoDB_BSON_Int64, jsonSerialize) +static PHP_METHOD(MongoDB_BSON_Int64, jsonSerialize) { php_phongo_int64_t* intern; @@ -118,7 +118,7 @@ PHP_METHOD(MongoDB_BSON_Int64, jsonSerialize) /* {{{ proto string MongoDB\BSON\Int64::serialize() */ -PHP_METHOD(MongoDB_BSON_Int64, serialize) +static PHP_METHOD(MongoDB_BSON_Int64, serialize) { php_phongo_int64_t* intern; zval retval; @@ -145,7 +145,7 @@ PHP_METHOD(MongoDB_BSON_Int64, serialize) /* {{{ proto void MongoDB\BSON\Int64::unserialize(string $serialized) */ -PHP_METHOD(MongoDB_BSON_Int64, unserialize) +static PHP_METHOD(MongoDB_BSON_Int64, unserialize) { php_phongo_int64_t* intern; char* serialized; @@ -175,7 +175,7 @@ PHP_METHOD(MongoDB_BSON_Int64, unserialize) /* {{{ proto array MongoDB\Driver\Int64::__serialize() */ -PHP_METHOD(MongoDB_BSON_Int64, __serialize) +static PHP_METHOD(MongoDB_BSON_Int64, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -184,7 +184,7 @@ PHP_METHOD(MongoDB_BSON_Int64, __serialize) /* {{{ proto void MongoDB\Driver\Int64::__unserialize(array $data) */ -PHP_METHOD(MongoDB_BSON_Int64, __unserialize) +static PHP_METHOD(MongoDB_BSON_Int64, __unserialize) { zval* data; @@ -269,16 +269,8 @@ static HashTable* php_phongo_int64_get_properties(phongo_compat_object_handler_t void php_phongo_int64_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Int64", class_MongoDB_BSON_Int64_methods); - php_phongo_int64_ce = zend_register_internal_class(&ce); + 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->create_object = php_phongo_int64_create_object; - PHONGO_CE_FINAL(php_phongo_int64_ce); - - zend_class_implements(php_phongo_int64_ce, 1, php_phongo_json_serializable_ce); - zend_class_implements(php_phongo_int64_ce, 1, php_phongo_type_ce); - zend_class_implements(php_phongo_int64_ce, 1, zend_ce_serializable); #if PHP_VERSION_ID >= 80000 zend_class_implements(php_phongo_int64_ce, 1, zend_ce_stringable); diff --git a/src/BSON/Int64.stub.php b/src/BSON/Int64.stub.php index be13d990a..7a5ccd937 100644 --- a/src/BSON/Int64.stub.php +++ b/src/BSON/Int64.stub.php @@ -1,10 +1,13 @@ = 80000 -ZEND_METHOD(MongoDB_BSON_Int64, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Int64, jsonSerialize); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_Int64, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Int64, jsonSerialize); #endif @@ -60,3 +60,15 @@ static const zend_function_entry class_MongoDB_BSON_Int64_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_Int64(zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Int64", class_MongoDB_BSON_Int64_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 3, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + + return class_entry; +} diff --git a/src/BSON/Javascript.c b/src/BSON/Javascript.c index 8a1f0c3da..ece5a5084 100644 --- a/src/BSON/Javascript.c +++ b/src/BSON/Javascript.c @@ -119,7 +119,7 @@ HashTable* php_phongo_javascript_get_properties_hash(phongo_compat_object_handle Construct a new BSON Javascript type. The scope is a document mapping identifiers and values, representing the scope in which the code string will be evaluated. Note that this type cannot be represented as Extended JSON. */ -PHP_METHOD(MongoDB_BSON_Javascript, __construct) +static PHP_METHOD(MongoDB_BSON_Javascript, __construct) { php_phongo_javascript_t* intern; char* code; @@ -139,7 +139,7 @@ PHP_METHOD(MongoDB_BSON_Javascript, __construct) /* {{{ proto MongoDB\BSON\Javascript MongoDB\BSON\Javascript::__set_state(array $properties) */ -PHP_METHOD(MongoDB_BSON_Javascript, __set_state) +static PHP_METHOD(MongoDB_BSON_Javascript, __set_state) { php_phongo_javascript_t* intern; HashTable* props; @@ -159,7 +159,7 @@ PHP_METHOD(MongoDB_BSON_Javascript, __set_state) /* {{{ proto string MongoDB\BSON\Javascript::__toString() Return the Javascript's code string. */ -PHP_METHOD(MongoDB_BSON_Javascript, __toString) +static PHP_METHOD(MongoDB_BSON_Javascript, __toString) { php_phongo_javascript_t* intern; @@ -172,7 +172,7 @@ PHP_METHOD(MongoDB_BSON_Javascript, __toString) /* {{{ proto string MongoDB\BSON\Javascript::getCode() */ -PHP_METHOD(MongoDB_BSON_Javascript, getCode) +static PHP_METHOD(MongoDB_BSON_Javascript, getCode) { php_phongo_javascript_t* intern; @@ -185,7 +185,7 @@ PHP_METHOD(MongoDB_BSON_Javascript, getCode) /* {{{ proto object|null MongoDB\BSON\Javascript::getScope() */ -PHP_METHOD(MongoDB_BSON_Javascript, getScope) +static PHP_METHOD(MongoDB_BSON_Javascript, getScope) { php_phongo_javascript_t* intern; @@ -215,7 +215,7 @@ PHP_METHOD(MongoDB_BSON_Javascript, getScope) /* {{{ proto array MongoDB\BSON\Javascript::jsonSerialize() */ -PHP_METHOD(MongoDB_BSON_Javascript, jsonSerialize) +static PHP_METHOD(MongoDB_BSON_Javascript, jsonSerialize) { php_phongo_javascript_t* intern; @@ -241,7 +241,7 @@ PHP_METHOD(MongoDB_BSON_Javascript, jsonSerialize) /* {{{ proto string MongoDB\BSON\Javascript::serialize() */ -PHP_METHOD(MongoDB_BSON_Javascript, serialize) +static PHP_METHOD(MongoDB_BSON_Javascript, serialize) { php_phongo_javascript_t* intern; zval retval; @@ -281,7 +281,7 @@ PHP_METHOD(MongoDB_BSON_Javascript, serialize) /* {{{ proto void MongoDB\BSON\Javascript::unserialize(string $serialized) */ -PHP_METHOD(MongoDB_BSON_Javascript, unserialize) +static PHP_METHOD(MongoDB_BSON_Javascript, unserialize) { php_phongo_javascript_t* intern; char* serialized; @@ -311,7 +311,7 @@ PHP_METHOD(MongoDB_BSON_Javascript, unserialize) /* {{{ proto array MongoDB\Driver\Javascript::__serialize() */ -PHP_METHOD(MongoDB_BSON_Javascript, __serialize) +static PHP_METHOD(MongoDB_BSON_Javascript, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -320,7 +320,7 @@ PHP_METHOD(MongoDB_BSON_Javascript, __serialize) /* {{{ proto void MongoDB\Driver\Javascript::__unserialize(array $data) */ -PHP_METHOD(MongoDB_BSON_Javascript, __unserialize) +static PHP_METHOD(MongoDB_BSON_Javascript, __unserialize) { zval* data; @@ -411,17 +411,8 @@ static HashTable* php_phongo_javascript_get_properties(phongo_compat_object_hand void php_phongo_javascript_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Javascript", class_MongoDB_BSON_Javascript_methods); - php_phongo_javascript_ce = zend_register_internal_class(&ce); + 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->create_object = php_phongo_javascript_create_object; - PHONGO_CE_FINAL(php_phongo_javascript_ce); - - zend_class_implements(php_phongo_javascript_ce, 1, php_phongo_javascript_interface_ce); - zend_class_implements(php_phongo_javascript_ce, 1, php_phongo_json_serializable_ce); - zend_class_implements(php_phongo_javascript_ce, 1, php_phongo_type_ce); - zend_class_implements(php_phongo_javascript_ce, 1, zend_ce_serializable); #if PHP_VERSION_ID >= 80000 zend_class_implements(php_phongo_javascript_ce, 1, zend_ce_stringable); diff --git a/src/BSON/Javascript.stub.php b/src/BSON/Javascript.stub.php index d54db713c..b9cfa2b4c 100644 --- a/src/BSON/Javascript.stub.php +++ b/src/BSON/Javascript.stub.php @@ -1,10 +1,13 @@ = 80000 final public function __construct(string $code, array|object|null $scope = null) {} diff --git a/src/BSON/JavascriptInterface.c b/src/BSON/JavascriptInterface.c index 6dd1cfaac..ddc597fc0 100644 --- a/src/BSON/JavascriptInterface.c +++ b/src/BSON/JavascriptInterface.c @@ -23,8 +23,5 @@ zend_class_entry* php_phongo_javascript_interface_ce; void php_phongo_javascript_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "JavascriptInterface", class_MongoDB_BSON_JavascriptInterface_methods); - php_phongo_javascript_interface_ce = zend_register_internal_interface(&ce); + php_phongo_javascript_interface_ce = register_class_MongoDB_BSON_JavascriptInterface(); } /* }}} */ diff --git a/src/BSON/JavascriptInterface.stub.php b/src/BSON/JavascriptInterface.stub.php index 5ca214b61..d9b2452f6 100644 --- a/src/BSON/JavascriptInterface.stub.php +++ b/src/BSON/JavascriptInterface.stub.php @@ -1,6 +1,9 @@ = 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___construct, 0, 0, 1) @@ -52,24 +52,24 @@ ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 80000 -ZEND_METHOD(MongoDB_BSON_Javascript, __construct); +static ZEND_METHOD(MongoDB_BSON_Javascript, __construct); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_Javascript, __construct); +static ZEND_METHOD(MongoDB_BSON_Javascript, __construct); #endif -ZEND_METHOD(MongoDB_BSON_Javascript, __set_state); -ZEND_METHOD(MongoDB_BSON_Javascript, getCode); -ZEND_METHOD(MongoDB_BSON_Javascript, getScope); -ZEND_METHOD(MongoDB_BSON_Javascript, __toString); -ZEND_METHOD(MongoDB_BSON_Javascript, serialize); -ZEND_METHOD(MongoDB_BSON_Javascript, unserialize); -ZEND_METHOD(MongoDB_BSON_Javascript, __unserialize); -ZEND_METHOD(MongoDB_BSON_Javascript, __serialize); +static ZEND_METHOD(MongoDB_BSON_Javascript, __set_state); +static ZEND_METHOD(MongoDB_BSON_Javascript, getCode); +static ZEND_METHOD(MongoDB_BSON_Javascript, getScope); +static ZEND_METHOD(MongoDB_BSON_Javascript, __toString); +static ZEND_METHOD(MongoDB_BSON_Javascript, serialize); +static ZEND_METHOD(MongoDB_BSON_Javascript, unserialize); +static ZEND_METHOD(MongoDB_BSON_Javascript, __unserialize); +static ZEND_METHOD(MongoDB_BSON_Javascript, __serialize); #if PHP_VERSION_ID >= 80000 -ZEND_METHOD(MongoDB_BSON_Javascript, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Javascript, jsonSerialize); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_Javascript, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Javascript, jsonSerialize); #endif @@ -96,3 +96,15 @@ static const zend_function_entry class_MongoDB_BSON_Javascript_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_Javascript(zend_class_entry *class_entry_MongoDB_BSON_JavascriptInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Javascript", class_MongoDB_BSON_Javascript_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_JavascriptInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + + return class_entry; +} diff --git a/src/BSON/MaxKey.c b/src/BSON/MaxKey.c index bdeda03e6..4cdab89e8 100644 --- a/src/BSON/MaxKey.c +++ b/src/BSON/MaxKey.c @@ -27,7 +27,7 @@ zend_class_entry* php_phongo_maxkey_ce; /* {{{ proto MongoDB\BSON\MaxKey MongoDB\BSON\MaxKey::__set_state(array $properties) */ -PHP_METHOD(MongoDB_BSON_MaxKey, __set_state) +static PHP_METHOD(MongoDB_BSON_MaxKey, __set_state) { zval* array; @@ -40,7 +40,7 @@ PHP_METHOD(MongoDB_BSON_MaxKey, __set_state) /* {{{ proto array MongoDB\BSON\MaxKey::jsonSerialize() */ -PHP_METHOD(MongoDB_BSON_MaxKey, jsonSerialize) +static PHP_METHOD(MongoDB_BSON_MaxKey, jsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -50,7 +50,7 @@ PHP_METHOD(MongoDB_BSON_MaxKey, jsonSerialize) /* {{{ proto string MongoDB\BSON\MaxKey::serialize() */ -PHP_METHOD(MongoDB_BSON_MaxKey, serialize) +static PHP_METHOD(MongoDB_BSON_MaxKey, serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -59,7 +59,7 @@ PHP_METHOD(MongoDB_BSON_MaxKey, serialize) /* {{{ proto void MongoDB\BSON\MaxKey::unserialize(string $serialized) */ -PHP_METHOD(MongoDB_BSON_MaxKey, unserialize) +static PHP_METHOD(MongoDB_BSON_MaxKey, unserialize) { char* serialized; size_t serialized_len; @@ -71,7 +71,7 @@ PHP_METHOD(MongoDB_BSON_MaxKey, unserialize) /* {{{ proto array MongoDB\Driver\MaxKey::__serialize() */ -PHP_METHOD(MongoDB_BSON_MaxKey, __serialize) +static PHP_METHOD(MongoDB_BSON_MaxKey, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -80,7 +80,7 @@ PHP_METHOD(MongoDB_BSON_MaxKey, __serialize) /* {{{ proto void MongoDB\Driver\MaxKey::__unserialize(array $data) */ -PHP_METHOD(MongoDB_BSON_MaxKey, __unserialize) +static PHP_METHOD(MongoDB_BSON_MaxKey, __unserialize) { zval* data; @@ -114,17 +114,8 @@ static zend_object* php_phongo_maxkey_create_object(zend_class_entry* class_type void php_phongo_maxkey_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MaxKey", class_MongoDB_BSON_MaxKey_methods); - php_phongo_maxkey_ce = zend_register_internal_class(&ce); + php_phongo_maxkey_ce = register_class_MongoDB_BSON_MaxKey(php_phongo_maxkey_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); php_phongo_maxkey_ce->create_object = php_phongo_maxkey_create_object; - PHONGO_CE_FINAL(php_phongo_maxkey_ce); - - zend_class_implements(php_phongo_maxkey_ce, 1, php_phongo_maxkey_interface_ce); - zend_class_implements(php_phongo_maxkey_ce, 1, php_phongo_json_serializable_ce); - zend_class_implements(php_phongo_maxkey_ce, 1, php_phongo_type_ce); - zend_class_implements(php_phongo_maxkey_ce, 1, zend_ce_serializable); memcpy(&php_phongo_handler_maxkey, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); /* Re-assign default handler previously removed in php_phongo.c */ diff --git a/src/BSON/MaxKey.stub.php b/src/BSON/MaxKey.stub.php index 0cdd1bf0c..9125c1b6b 100644 --- a/src/BSON/MaxKey.stub.php +++ b/src/BSON/MaxKey.stub.php @@ -1,10 +1,13 @@ #include "php_phongo.h" +#include "MaxKeyInterface_arginfo.h" zend_class_entry* php_phongo_maxkey_interface_ce; -/* {{{ MongoDB\BSON\MaxKeyInterface function entries */ -static zend_function_entry php_phongo_maxkey_interface_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_maxkey_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MaxKeyInterface", php_phongo_maxkey_interface_me); - php_phongo_maxkey_interface_ce = zend_register_internal_interface(&ce); + php_phongo_maxkey_interface_ce = register_class_MongoDB_BSON_MaxKeyInterface(); } /* }}} */ diff --git a/src/BSON/MaxKeyInterface.stub.php b/src/BSON/MaxKeyInterface.stub.php new file mode 100644 index 000000000..0323e637a --- /dev/null +++ b/src/BSON/MaxKeyInterface.stub.php @@ -0,0 +1,13 @@ += 80000 -ZEND_METHOD(MongoDB_BSON_MaxKey, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_MaxKey, jsonSerialize); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_MaxKey, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_MaxKey, jsonSerialize); #endif @@ -57,3 +57,15 @@ static const zend_function_entry class_MongoDB_BSON_MaxKey_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_MaxKey(zend_class_entry *class_entry_MongoDB_BSON_MaxKeyInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MaxKey", class_MongoDB_BSON_MaxKey_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_MaxKeyInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + + return class_entry; +} diff --git a/src/BSON/MinKey.c b/src/BSON/MinKey.c index ad7fcc51e..4f60541e6 100644 --- a/src/BSON/MinKey.c +++ b/src/BSON/MinKey.c @@ -27,7 +27,7 @@ zend_class_entry* php_phongo_minkey_ce; /* {{{ proto MongoDB\BSON\MinKey MongoDB\BSON\MinKey::__set_state(array $properties) */ -PHP_METHOD(MongoDB_BSON_MinKey, __set_state) +static PHP_METHOD(MongoDB_BSON_MinKey, __set_state) { zval* array; @@ -40,7 +40,7 @@ PHP_METHOD(MongoDB_BSON_MinKey, __set_state) /* {{{ proto array MongoDB\BSON\MinKey::jsonSerialize() */ -PHP_METHOD(MongoDB_BSON_MinKey, jsonSerialize) +static PHP_METHOD(MongoDB_BSON_MinKey, jsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -50,7 +50,7 @@ PHP_METHOD(MongoDB_BSON_MinKey, jsonSerialize) /* {{{ proto string MongoDB\BSON\MinKey::serialize() */ -PHP_METHOD(MongoDB_BSON_MinKey, serialize) +static PHP_METHOD(MongoDB_BSON_MinKey, serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -59,7 +59,7 @@ PHP_METHOD(MongoDB_BSON_MinKey, serialize) /* {{{ proto void MongoDB\BSON\MinKey::unserialize(string $serialized) */ -PHP_METHOD(MongoDB_BSON_MinKey, unserialize) +static PHP_METHOD(MongoDB_BSON_MinKey, unserialize) { char* serialized; size_t serialized_len; @@ -71,7 +71,7 @@ PHP_METHOD(MongoDB_BSON_MinKey, unserialize) /* {{{ proto array MongoDB\Driver\MinKey::__serialize() */ -PHP_METHOD(MongoDB_BSON_MinKey, __serialize) +static PHP_METHOD(MongoDB_BSON_MinKey, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -80,7 +80,7 @@ PHP_METHOD(MongoDB_BSON_MinKey, __serialize) /* {{{ proto void MongoDB\Driver\MinKey::__unserialize(array $data) */ -PHP_METHOD(MongoDB_BSON_MinKey, __unserialize) +static PHP_METHOD(MongoDB_BSON_MinKey, __unserialize) { zval* data; @@ -114,17 +114,8 @@ static zend_object* php_phongo_minkey_create_object(zend_class_entry* class_type void php_phongo_minkey_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MinKey", class_MongoDB_BSON_MinKey_methods); - php_phongo_minkey_ce = zend_register_internal_class(&ce); + php_phongo_minkey_ce = register_class_MongoDB_BSON_MinKey(php_phongo_minkey_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); php_phongo_minkey_ce->create_object = php_phongo_minkey_create_object; - PHONGO_CE_FINAL(php_phongo_minkey_ce); - - zend_class_implements(php_phongo_minkey_ce, 1, php_phongo_minkey_interface_ce); - zend_class_implements(php_phongo_minkey_ce, 1, php_phongo_json_serializable_ce); - zend_class_implements(php_phongo_minkey_ce, 1, php_phongo_type_ce); - zend_class_implements(php_phongo_minkey_ce, 1, zend_ce_serializable); memcpy(&php_phongo_handler_minkey, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); /* Re-assign default handler previously removed in php_phongo.c */ diff --git a/src/BSON/MinKey.stub.php b/src/BSON/MinKey.stub.php index 796c45584..001902412 100644 --- a/src/BSON/MinKey.stub.php +++ b/src/BSON/MinKey.stub.php @@ -1,10 +1,13 @@ #include "php_phongo.h" +#include "MinKeyInterface_arginfo.h" zend_class_entry* php_phongo_minkey_interface_ce; -/* {{{ MongoDB\BSON\MinKeyInterface function entries */ -static zend_function_entry php_phongo_minkey_interface_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_minkey_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MinKeyInterface", php_phongo_minkey_interface_me); - php_phongo_minkey_interface_ce = zend_register_internal_interface(&ce); + php_phongo_minkey_interface_ce = register_class_MongoDB_BSON_MinKeyInterface(); } /* }}} */ diff --git a/src/BSON/MinKeyInterface.stub.php b/src/BSON/MinKeyInterface.stub.php new file mode 100644 index 000000000..e7bd42db2 --- /dev/null +++ b/src/BSON/MinKeyInterface.stub.php @@ -0,0 +1,13 @@ += 80000 -ZEND_METHOD(MongoDB_BSON_MinKey, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_MinKey, jsonSerialize); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_MinKey, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_MinKey, jsonSerialize); #endif @@ -57,3 +57,15 @@ static const zend_function_entry class_MongoDB_BSON_MinKey_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_MinKey(zend_class_entry *class_entry_MongoDB_BSON_MinKeyInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MinKey", class_MongoDB_BSON_MinKey_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_MinKeyInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + + return class_entry; +} diff --git a/src/BSON/ObjectId.c b/src/BSON/ObjectId.c index bc990745d..ed6d00696 100644 --- a/src/BSON/ObjectId.c +++ b/src/BSON/ObjectId.c @@ -104,7 +104,7 @@ static HashTable* php_phongo_objectid_get_properties_hash(phongo_compat_object_h /* {{{ proto void MongoDB\BSON\ObjectId::__construct([string $id]) Constructs a new BSON ObjectId type, optionally from a hex string. */ -PHP_METHOD(MongoDB_BSON_ObjectId, __construct) +static PHP_METHOD(MongoDB_BSON_ObjectId, __construct) { php_phongo_objectid_t* intern; char* id = NULL; @@ -126,7 +126,7 @@ PHP_METHOD(MongoDB_BSON_ObjectId, __construct) /* {{{ proto integer MongoDB\BSON\ObjectId::getTimestamp() */ -PHP_METHOD(MongoDB_BSON_ObjectId, getTimestamp) +static PHP_METHOD(MongoDB_BSON_ObjectId, getTimestamp) { php_phongo_objectid_t* intern; bson_oid_t tmp_oid; @@ -141,7 +141,7 @@ PHP_METHOD(MongoDB_BSON_ObjectId, getTimestamp) /* {{{ proto MongoDB\BSON\ObjectId MongoDB\BSON\ObjectId::__set_state(array $properties) */ -PHP_METHOD(MongoDB_BSON_ObjectId, __set_state) +static PHP_METHOD(MongoDB_BSON_ObjectId, __set_state) { php_phongo_objectid_t* intern; HashTable* props; @@ -161,7 +161,7 @@ PHP_METHOD(MongoDB_BSON_ObjectId, __set_state) /* {{{ proto string MongoDB\BSON\ObjectId::__toString() */ -PHP_METHOD(MongoDB_BSON_ObjectId, __toString) +static PHP_METHOD(MongoDB_BSON_ObjectId, __toString) { php_phongo_objectid_t* intern; @@ -174,7 +174,7 @@ PHP_METHOD(MongoDB_BSON_ObjectId, __toString) /* {{{ proto array MongoDB\BSON\ObjectId::jsonSerialize() */ -PHP_METHOD(MongoDB_BSON_ObjectId, jsonSerialize) +static PHP_METHOD(MongoDB_BSON_ObjectId, jsonSerialize) { php_phongo_objectid_t* intern; @@ -188,7 +188,7 @@ PHP_METHOD(MongoDB_BSON_ObjectId, jsonSerialize) /* {{{ proto string MongoDB\BSON\ObjectId::serialize() */ -PHP_METHOD(MongoDB_BSON_ObjectId, serialize) +static PHP_METHOD(MongoDB_BSON_ObjectId, serialize) { php_phongo_objectid_t* intern; zval retval; @@ -215,7 +215,7 @@ PHP_METHOD(MongoDB_BSON_ObjectId, serialize) /* {{{ proto void MongoDB\BSON\ObjectId::unserialize(string $serialized) */ -PHP_METHOD(MongoDB_BSON_ObjectId, unserialize) +static PHP_METHOD(MongoDB_BSON_ObjectId, unserialize) { php_phongo_objectid_t* intern; char* serialized; @@ -245,7 +245,7 @@ PHP_METHOD(MongoDB_BSON_ObjectId, unserialize) /* {{{ proto array MongoDB\Driver\ObjectId::__serialize() */ -PHP_METHOD(MongoDB_BSON_ObjectId, __serialize) +static PHP_METHOD(MongoDB_BSON_ObjectId, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -254,7 +254,7 @@ PHP_METHOD(MongoDB_BSON_ObjectId, __serialize) /* {{{ proto void MongoDB\Driver\ObjectId::__unserialize(array $data) */ -PHP_METHOD(MongoDB_BSON_ObjectId, __unserialize) +static PHP_METHOD(MongoDB_BSON_ObjectId, __unserialize) { zval* data; @@ -338,17 +338,8 @@ static HashTable* php_phongo_objectid_get_properties(phongo_compat_object_handle void php_phongo_objectid_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "ObjectId", class_MongoDB_BSON_ObjectId_methods); - php_phongo_objectid_ce = zend_register_internal_class(&ce); + 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->create_object = php_phongo_objectid_create_object; - PHONGO_CE_FINAL(php_phongo_objectid_ce); - - zend_class_implements(php_phongo_objectid_ce, 1, php_phongo_objectid_interface_ce); - zend_class_implements(php_phongo_objectid_ce, 1, php_phongo_json_serializable_ce); - zend_class_implements(php_phongo_objectid_ce, 1, php_phongo_type_ce); - zend_class_implements(php_phongo_objectid_ce, 1, zend_ce_serializable); #if PHP_VERSION_ID >= 80000 zend_class_implements(php_phongo_objectid_ce, 1, zend_ce_stringable); diff --git a/src/BSON/ObjectId.stub.php b/src/BSON/ObjectId.stub.php index 74a4778a1..763f30428 100644 --- a/src/BSON/ObjectId.stub.php +++ b/src/BSON/ObjectId.stub.php @@ -1,10 +1,13 @@ = 80000 -ZEND_METHOD(MongoDB_BSON_ObjectId, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_ObjectId, jsonSerialize); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_ObjectId, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_ObjectId, jsonSerialize); #endif @@ -72,3 +72,15 @@ static const zend_function_entry class_MongoDB_BSON_ObjectId_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_ObjectId(zend_class_entry *class_entry_MongoDB_BSON_ObjectIdInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "ObjectId", class_MongoDB_BSON_ObjectId_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_ObjectIdInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + + return class_entry; +} diff --git a/src/BSON/Persistable.c b/src/BSON/Persistable.c index a34886ca1..d933c31e6 100644 --- a/src/BSON/Persistable.c +++ b/src/BSON/Persistable.c @@ -23,9 +23,5 @@ zend_class_entry* php_phongo_persistable_ce; void php_phongo_persistable_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Persistable", class_MongoDB_BSON_Persistable_methods); - php_phongo_persistable_ce = zend_register_internal_interface(&ce); - zend_class_implements(php_phongo_persistable_ce, 2, php_phongo_unserializable_ce, php_phongo_serializable_ce); + php_phongo_persistable_ce = register_class_MongoDB_BSON_Persistable(php_phongo_serializable_ce, php_phongo_unserializable_ce); } /* }}} */ diff --git a/src/BSON/Persistable.stub.php b/src/BSON/Persistable.stub.php index 9e1553ce8..afe31436a 100644 --- a/src/BSON/Persistable.stub.php +++ b/src/BSON/Persistable.stub.php @@ -1,10 +1,13 @@ create_object = php_phongo_regex_create_object; - PHONGO_CE_FINAL(php_phongo_regex_ce); - - zend_class_implements(php_phongo_regex_ce, 1, php_phongo_regex_interface_ce); - zend_class_implements(php_phongo_regex_ce, 1, php_phongo_type_ce); - zend_class_implements(php_phongo_regex_ce, 1, zend_ce_serializable); - zend_class_implements(php_phongo_regex_ce, 1, php_phongo_json_serializable_ce); #if PHP_VERSION_ID >= 80000 zend_class_implements(php_phongo_regex_ce, 1, zend_ce_stringable); diff --git a/src/BSON/Regex.stub.php b/src/BSON/Regex.stub.php index 46dd2702f..fa58b61a4 100644 --- a/src/BSON/Regex.stub.php +++ b/src/BSON/Regex.stub.php @@ -1,10 +1,13 @@ = 80000 -ZEND_METHOD(MongoDB_BSON_Regex, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Regex, jsonSerialize); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_Regex, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Regex, jsonSerialize); #endif @@ -76,3 +76,15 @@ static const zend_function_entry class_MongoDB_BSON_Regex_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_Regex(zend_class_entry *class_entry_MongoDB_BSON_RegexInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Regex", class_MongoDB_BSON_Regex_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_RegexInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + + return class_entry; +} diff --git a/src/BSON/Serializable.c b/src/BSON/Serializable.c index 94d067948..6072a729d 100644 --- a/src/BSON/Serializable.c +++ b/src/BSON/Serializable.c @@ -23,9 +23,5 @@ zend_class_entry* php_phongo_serializable_ce; void php_phongo_serializable_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Serializable", class_MongoDB_BSON_Serializable_methods); - php_phongo_serializable_ce = zend_register_internal_interface(&ce); - zend_class_implements(php_phongo_serializable_ce, 1, php_phongo_type_ce); + php_phongo_serializable_ce = register_class_MongoDB_BSON_Serializable(php_phongo_type_ce); } /* }}} */ diff --git a/src/BSON/Serializable.stub.php b/src/BSON/Serializable.stub.php index 28300128b..eafdd0b22 100644 --- a/src/BSON/Serializable.stub.php +++ b/src/BSON/Serializable.stub.php @@ -1,10 +1,13 @@ = 80000 /** @tentative-return-type */ diff --git a/src/BSON/Serializable_arginfo.h b/src/BSON/Serializable_arginfo.h index a56beaa37..b96cb4201 100644 --- a/src/BSON/Serializable_arginfo.h +++ b/src/BSON/Serializable_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: d5b8cd4af55b91124737510ee9cb2435982214d9 */ + * Stub hash: 22bef071736dda02427583bb0f259a8a3f2ccffe */ #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_BSON_Serializable_bsonSerialize, 0, 0, MAY_BE_ARRAY|MAY_BE_OBJECT) @@ -27,3 +27,14 @@ static const zend_function_entry class_MongoDB_BSON_Serializable_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_Serializable(zend_class_entry *class_entry_MongoDB_BSON_Type) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Serializable", class_MongoDB_BSON_Serializable_methods); + class_entry = zend_register_internal_interface(&ce); + zend_class_implements(class_entry, 1, class_entry_MongoDB_BSON_Type); + + return class_entry; +} diff --git a/src/BSON/Symbol.c b/src/BSON/Symbol.c index 4e3dcf539..8d44efa98 100644 --- a/src/BSON/Symbol.c +++ b/src/BSON/Symbol.c @@ -81,7 +81,7 @@ PHONGO_DISABLED_CONSTRUCTOR(MongoDB_BSON_Symbol) /* {{{ proto string MongoDB\BSON\Symbol::__toString() Return the Symbol's symbol string. */ -PHP_METHOD(MongoDB_BSON_Symbol, __toString) +static PHP_METHOD(MongoDB_BSON_Symbol, __toString) { php_phongo_symbol_t* intern; @@ -94,7 +94,7 @@ PHP_METHOD(MongoDB_BSON_Symbol, __toString) /* {{{ proto array MongoDB\BSON\Symbol::jsonSerialize() */ -PHP_METHOD(MongoDB_BSON_Symbol, jsonSerialize) +static PHP_METHOD(MongoDB_BSON_Symbol, jsonSerialize) { php_phongo_symbol_t* intern; @@ -108,7 +108,7 @@ PHP_METHOD(MongoDB_BSON_Symbol, jsonSerialize) /* {{{ proto string MongoDB\BSON\Symbol::serialize() */ -PHP_METHOD(MongoDB_BSON_Symbol, serialize) +static PHP_METHOD(MongoDB_BSON_Symbol, serialize) { php_phongo_symbol_t* intern; zval retval; @@ -135,7 +135,7 @@ PHP_METHOD(MongoDB_BSON_Symbol, serialize) /* {{{ proto void MongoDB\BSON\Symbol::unserialize(string $serialized) */ -PHP_METHOD(MongoDB_BSON_Symbol, unserialize) +static PHP_METHOD(MongoDB_BSON_Symbol, unserialize) { php_phongo_symbol_t* intern; char* serialized; @@ -165,7 +165,7 @@ PHP_METHOD(MongoDB_BSON_Symbol, unserialize) /* {{{ proto array MongoDB\Driver\Symbol::__serialize() */ -PHP_METHOD(MongoDB_BSON_Symbol, __serialize) +static PHP_METHOD(MongoDB_BSON_Symbol, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -174,7 +174,7 @@ PHP_METHOD(MongoDB_BSON_Symbol, __serialize) /* {{{ proto void MongoDB\Driver\Symbol::__unserialize(array $data) */ -PHP_METHOD(MongoDB_BSON_Symbol, __unserialize) +static PHP_METHOD(MongoDB_BSON_Symbol, __unserialize) { zval* data; @@ -259,16 +259,8 @@ static HashTable* php_phongo_symbol_get_properties(phongo_compat_object_handler_ void php_phongo_symbol_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Symbol", class_MongoDB_BSON_Symbol_methods); - php_phongo_symbol_ce = zend_register_internal_class(&ce); + php_phongo_symbol_ce = register_class_MongoDB_BSON_Symbol(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); php_phongo_symbol_ce->create_object = php_phongo_symbol_create_object; - PHONGO_CE_FINAL(php_phongo_symbol_ce); - - zend_class_implements(php_phongo_symbol_ce, 1, php_phongo_json_serializable_ce); - zend_class_implements(php_phongo_symbol_ce, 1, php_phongo_type_ce); - zend_class_implements(php_phongo_symbol_ce, 1, zend_ce_serializable); #if PHP_VERSION_ID >= 80000 zend_class_implements(php_phongo_symbol_ce, 1, zend_ce_stringable); diff --git a/src/BSON/Symbol.stub.php b/src/BSON/Symbol.stub.php index d2d9290c8..180acd14c 100644 --- a/src/BSON/Symbol.stub.php +++ b/src/BSON/Symbol.stub.php @@ -1,10 +1,13 @@ = 80000 -ZEND_METHOD(MongoDB_BSON_Symbol, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Symbol, jsonSerialize); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_Symbol, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Symbol, jsonSerialize); #endif @@ -60,3 +60,15 @@ static const zend_function_entry class_MongoDB_BSON_Symbol_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_Symbol(zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Symbol", class_MongoDB_BSON_Symbol_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 3, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + + return class_entry; +} diff --git a/src/BSON/Timestamp.c b/src/BSON/Timestamp.c index 79d4d4cdf..fd58d4c72 100644 --- a/src/BSON/Timestamp.c +++ b/src/BSON/Timestamp.c @@ -123,7 +123,7 @@ static HashTable* php_phongo_timestamp_get_properties_hash(phongo_compat_object_ /* {{{ proto void MongoDB\BSON\Timestamp::__construct(int|string $increment, int|string $timestamp) Construct a new BSON timestamp type, which consists of a 4-byte increment and 4-byte timestamp. */ -PHP_METHOD(MongoDB_BSON_Timestamp, __construct) +static PHP_METHOD(MongoDB_BSON_Timestamp, __construct) { php_phongo_timestamp_t* intern; zval * increment = NULL, *timestamp = NULL; @@ -163,7 +163,7 @@ PHP_METHOD(MongoDB_BSON_Timestamp, __construct) /* {{{ proto integer MongoDB\BSON\Timestamp::getIncrement() */ -PHP_METHOD(MongoDB_BSON_Timestamp, getIncrement) +static PHP_METHOD(MongoDB_BSON_Timestamp, getIncrement) { php_phongo_timestamp_t* intern; @@ -176,7 +176,7 @@ PHP_METHOD(MongoDB_BSON_Timestamp, getIncrement) /* {{{ proto integer MongoDB\BSON\Timestamp::getTimestamp() */ -PHP_METHOD(MongoDB_BSON_Timestamp, getTimestamp) +static PHP_METHOD(MongoDB_BSON_Timestamp, getTimestamp) { php_phongo_timestamp_t* intern; @@ -189,7 +189,7 @@ PHP_METHOD(MongoDB_BSON_Timestamp, getTimestamp) /* {{{ proto MongoDB\BSON\Timestamp MongoDB\BSON\Timestamp::__set_state(array $properties) */ -PHP_METHOD(MongoDB_BSON_Timestamp, __set_state) +static PHP_METHOD(MongoDB_BSON_Timestamp, __set_state) { php_phongo_timestamp_t* intern; HashTable* props; @@ -209,7 +209,7 @@ PHP_METHOD(MongoDB_BSON_Timestamp, __set_state) /* {{{ proto string MongoDB\BSON\Timestamp::__toString() Returns a string in the form: [increment:timestamp] */ -PHP_METHOD(MongoDB_BSON_Timestamp, __toString) +static PHP_METHOD(MongoDB_BSON_Timestamp, __toString) { php_phongo_timestamp_t* intern; char* retval; @@ -226,7 +226,7 @@ PHP_METHOD(MongoDB_BSON_Timestamp, __toString) /* {{{ proto array MongoDB\BSON\Timestamp::jsonSerialize() */ -PHP_METHOD(MongoDB_BSON_Timestamp, jsonSerialize) +static PHP_METHOD(MongoDB_BSON_Timestamp, jsonSerialize) { php_phongo_timestamp_t* intern; @@ -248,7 +248,7 @@ PHP_METHOD(MongoDB_BSON_Timestamp, jsonSerialize) /* {{{ proto string MongoDB\BSON\Timestamp::serialize() */ -PHP_METHOD(MongoDB_BSON_Timestamp, serialize) +static PHP_METHOD(MongoDB_BSON_Timestamp, serialize) { php_phongo_timestamp_t* intern; zval retval; @@ -283,7 +283,7 @@ PHP_METHOD(MongoDB_BSON_Timestamp, serialize) /* {{{ proto void MongoDB\BSON\Timestamp::unserialize(string $serialized) */ -PHP_METHOD(MongoDB_BSON_Timestamp, unserialize) +static PHP_METHOD(MongoDB_BSON_Timestamp, unserialize) { php_phongo_timestamp_t* intern; char* serialized; @@ -313,7 +313,7 @@ PHP_METHOD(MongoDB_BSON_Timestamp, unserialize) /* {{{ proto array MongoDB\Driver\Timestamp::__serialize() */ -PHP_METHOD(MongoDB_BSON_Timestamp, __serialize) +static PHP_METHOD(MongoDB_BSON_Timestamp, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -322,7 +322,7 @@ PHP_METHOD(MongoDB_BSON_Timestamp, __serialize) /* {{{ proto void MongoDB\Driver\Timestamp::__unserialize(array $data) */ -PHP_METHOD(MongoDB_BSON_Timestamp, __unserialize) +static PHP_METHOD(MongoDB_BSON_Timestamp, __unserialize) { zval* data; @@ -412,17 +412,8 @@ static HashTable* php_phongo_timestamp_get_properties(phongo_compat_object_handl void php_phongo_timestamp_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Timestamp", class_MongoDB_BSON_Timestamp_methods); - php_phongo_timestamp_ce = zend_register_internal_class(&ce); + php_phongo_timestamp_ce = register_class_MongoDB_BSON_Timestamp(php_phongo_timestamp_interface_ce, php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); php_phongo_timestamp_ce->create_object = php_phongo_timestamp_create_object; - PHONGO_CE_FINAL(php_phongo_timestamp_ce); - - zend_class_implements(php_phongo_timestamp_ce, 1, php_phongo_timestamp_interface_ce); - zend_class_implements(php_phongo_timestamp_ce, 1, php_phongo_json_serializable_ce); - zend_class_implements(php_phongo_timestamp_ce, 1, php_phongo_type_ce); - zend_class_implements(php_phongo_timestamp_ce, 1, zend_ce_serializable); #if PHP_VERSION_ID >= 80000 zend_class_implements(php_phongo_timestamp_ce, 1, zend_ce_stringable); diff --git a/src/BSON/Timestamp.stub.php b/src/BSON/Timestamp.stub.php index eacd19d00..0f81e3c7b 100644 --- a/src/BSON/Timestamp.stub.php +++ b/src/BSON/Timestamp.stub.php @@ -1,10 +1,13 @@ = 80000 public final function __construct(int|string $increment, int|string $timestamp) {} diff --git a/src/BSON/TimestampInterface.c b/src/BSON/TimestampInterface.c index 299cb5dea..e2e876889 100644 --- a/src/BSON/TimestampInterface.c +++ b/src/BSON/TimestampInterface.c @@ -23,8 +23,5 @@ zend_class_entry* php_phongo_timestamp_interface_ce; void php_phongo_timestamp_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "TimestampInterface", class_MongoDB_BSON_TimestampInterface_methods); - php_phongo_timestamp_interface_ce = zend_register_internal_interface(&ce); + php_phongo_timestamp_interface_ce = register_class_MongoDB_BSON_TimestampInterface(); } /* }}} */ diff --git a/src/BSON/TimestampInterface.stub.php b/src/BSON/TimestampInterface.stub.php index 10e048b31..93b26a109 100644 --- a/src/BSON/TimestampInterface.stub.php +++ b/src/BSON/TimestampInterface.stub.php @@ -1,6 +1,9 @@ = 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___construct, 0, 0, 2) @@ -52,24 +52,24 @@ ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 80000 -ZEND_METHOD(MongoDB_BSON_Timestamp, __construct); +static ZEND_METHOD(MongoDB_BSON_Timestamp, __construct); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_Timestamp, __construct); +static ZEND_METHOD(MongoDB_BSON_Timestamp, __construct); #endif -ZEND_METHOD(MongoDB_BSON_Timestamp, getTimestamp); -ZEND_METHOD(MongoDB_BSON_Timestamp, getIncrement); -ZEND_METHOD(MongoDB_BSON_Timestamp, __toString); -ZEND_METHOD(MongoDB_BSON_Timestamp, __set_state); -ZEND_METHOD(MongoDB_BSON_Timestamp, serialize); -ZEND_METHOD(MongoDB_BSON_Timestamp, unserialize); -ZEND_METHOD(MongoDB_BSON_Timestamp, __unserialize); -ZEND_METHOD(MongoDB_BSON_Timestamp, __serialize); +static ZEND_METHOD(MongoDB_BSON_Timestamp, getTimestamp); +static ZEND_METHOD(MongoDB_BSON_Timestamp, getIncrement); +static ZEND_METHOD(MongoDB_BSON_Timestamp, __toString); +static ZEND_METHOD(MongoDB_BSON_Timestamp, __set_state); +static ZEND_METHOD(MongoDB_BSON_Timestamp, serialize); +static ZEND_METHOD(MongoDB_BSON_Timestamp, unserialize); +static ZEND_METHOD(MongoDB_BSON_Timestamp, __unserialize); +static ZEND_METHOD(MongoDB_BSON_Timestamp, __serialize); #if PHP_VERSION_ID >= 80000 -ZEND_METHOD(MongoDB_BSON_Timestamp, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Timestamp, jsonSerialize); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_Timestamp, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Timestamp, jsonSerialize); #endif @@ -96,3 +96,15 @@ static const zend_function_entry class_MongoDB_BSON_Timestamp_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_Timestamp(zend_class_entry *class_entry_MongoDB_BSON_TimestampInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Timestamp", class_MongoDB_BSON_Timestamp_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_TimestampInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + + return class_entry; +} diff --git a/src/BSON/Type.c b/src/BSON/Type.c index 34ff9e527..a7cd2c0c6 100644 --- a/src/BSON/Type.c +++ b/src/BSON/Type.c @@ -17,19 +17,11 @@ #include #include "php_phongo.h" +#include "Type_arginfo.h" zend_class_entry* php_phongo_type_ce; -/* {{{ MongoDB\BSON\Type function entries */ -static zend_function_entry php_phongo_type_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_type_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Type", php_phongo_type_me); - php_phongo_type_ce = zend_register_internal_interface(&ce); + php_phongo_type_ce = register_class_MongoDB_BSON_Type(); } /* }}} */ diff --git a/src/BSON/Type.stub.php b/src/BSON/Type.stub.php new file mode 100644 index 000000000..d606d8f5e --- /dev/null +++ b/src/BSON/Type.stub.php @@ -0,0 +1,13 @@ +create_object = php_phongo_utcdatetime_create_object; - PHONGO_CE_FINAL(php_phongo_utcdatetime_ce); - - zend_class_implements(php_phongo_utcdatetime_ce, 1, php_phongo_utcdatetime_interface_ce); - zend_class_implements(php_phongo_utcdatetime_ce, 1, php_phongo_json_serializable_ce); - zend_class_implements(php_phongo_utcdatetime_ce, 1, php_phongo_type_ce); - zend_class_implements(php_phongo_utcdatetime_ce, 1, zend_ce_serializable); #if PHP_VERSION_ID >= 80000 zend_class_implements(php_phongo_utcdatetime_ce, 1, zend_ce_stringable); diff --git a/src/BSON/UTCDateTime.stub.php b/src/BSON/UTCDateTime.stub.php index 67ea01aba..264d0aba0 100644 --- a/src/BSON/UTCDateTime.stub.php +++ b/src/BSON/UTCDateTime.stub.php @@ -1,10 +1,13 @@ = 80000 public final function __construct(int|string|float|\DateTime|\DateTimeImmutable|null $milliseconds = null) {} diff --git a/src/BSON/UTCDateTimeInterface.c b/src/BSON/UTCDateTimeInterface.c index 694aaf1b1..439011d45 100644 --- a/src/BSON/UTCDateTimeInterface.c +++ b/src/BSON/UTCDateTimeInterface.c @@ -23,8 +23,5 @@ zend_class_entry* php_phongo_utcdatetime_interface_ce; void php_phongo_utcdatetime_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "UTCDateTimeInterface", class_MongoDB_BSON_UTCDateTimeInterface_methods); - php_phongo_utcdatetime_interface_ce = zend_register_internal_interface(&ce); + php_phongo_utcdatetime_interface_ce = register_class_MongoDB_BSON_UTCDateTimeInterface(); } /* }}} */ diff --git a/src/BSON/UTCDateTimeInterface.stub.php b/src/BSON/UTCDateTimeInterface.stub.php index 7513124ac..98605ca88 100644 --- a/src/BSON/UTCDateTimeInterface.stub.php +++ b/src/BSON/UTCDateTimeInterface.stub.php @@ -1,6 +1,9 @@ = 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___construct, 0, 0, 0) @@ -19,7 +19,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___toString, 0, 0, IS_STRING, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___set_state, 0, 1, MongoDB\\BSON\\UTCDateTime, 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___set_state, 0, 1, MongoDB\\BSON\\\125TCDateTime, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) ZEND_END_ARG_INFO() @@ -48,23 +48,23 @@ ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 80000 -ZEND_METHOD(MongoDB_BSON_UTCDateTime, __construct); +static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __construct); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_UTCDateTime, __construct); +static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __construct); #endif -ZEND_METHOD(MongoDB_BSON_UTCDateTime, toDateTime); -ZEND_METHOD(MongoDB_BSON_UTCDateTime, __toString); -ZEND_METHOD(MongoDB_BSON_UTCDateTime, __set_state); -ZEND_METHOD(MongoDB_BSON_UTCDateTime, serialize); -ZEND_METHOD(MongoDB_BSON_UTCDateTime, unserialize); -ZEND_METHOD(MongoDB_BSON_UTCDateTime, __unserialize); -ZEND_METHOD(MongoDB_BSON_UTCDateTime, __serialize); +static ZEND_METHOD(MongoDB_BSON_UTCDateTime, toDateTime); +static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __toString); +static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __set_state); +static ZEND_METHOD(MongoDB_BSON_UTCDateTime, serialize); +static ZEND_METHOD(MongoDB_BSON_UTCDateTime, unserialize); +static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __unserialize); +static ZEND_METHOD(MongoDB_BSON_UTCDateTime, __serialize); #if PHP_VERSION_ID >= 80000 -ZEND_METHOD(MongoDB_BSON_UTCDateTime, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_UTCDateTime, jsonSerialize); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_UTCDateTime, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_UTCDateTime, jsonSerialize); #endif @@ -90,3 +90,15 @@ static const zend_function_entry class_MongoDB_BSON_UTCDateTime_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_UTCDateTime(zend_class_entry *class_entry_MongoDB_BSON_UTCDateTimeInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "UTCDateTime", class_MongoDB_BSON_UTCDateTime_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_UTCDateTimeInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + + return class_entry; +} diff --git a/src/BSON/Undefined.c b/src/BSON/Undefined.c index b2dfa4d43..6d7e23b83 100644 --- a/src/BSON/Undefined.c +++ b/src/BSON/Undefined.c @@ -29,7 +29,7 @@ PHONGO_DISABLED_CONSTRUCTOR(MongoDB_BSON_Undefined) /* {{{ proto string MongoDB\BSON\Undefined::__toString() Return the empty string. */ -PHP_METHOD(MongoDB_BSON_Undefined, __toString) +static PHP_METHOD(MongoDB_BSON_Undefined, __toString) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -38,7 +38,7 @@ PHP_METHOD(MongoDB_BSON_Undefined, __toString) /* {{{ proto array MongoDB\BSON\Undefined::jsonSerialize() */ -PHP_METHOD(MongoDB_BSON_Undefined, jsonSerialize) +static PHP_METHOD(MongoDB_BSON_Undefined, jsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -48,7 +48,7 @@ PHP_METHOD(MongoDB_BSON_Undefined, jsonSerialize) /* {{{ proto string MongoDB\BSON\Undefined::serialize() */ -PHP_METHOD(MongoDB_BSON_Undefined, serialize) +static PHP_METHOD(MongoDB_BSON_Undefined, serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -57,7 +57,7 @@ PHP_METHOD(MongoDB_BSON_Undefined, serialize) /* {{{ proto void MongoDB\BSON\Undefined::unserialize(string $serialized) */ -PHP_METHOD(MongoDB_BSON_Undefined, unserialize) +static PHP_METHOD(MongoDB_BSON_Undefined, unserialize) { char* serialized; size_t serialized_len; @@ -69,7 +69,7 @@ PHP_METHOD(MongoDB_BSON_Undefined, unserialize) /* {{{ proto array MongoDB\Driver\Undefined::__serialize() */ -PHP_METHOD(MongoDB_BSON_Undefined, __serialize) +static PHP_METHOD(MongoDB_BSON_Undefined, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -78,7 +78,7 @@ PHP_METHOD(MongoDB_BSON_Undefined, __serialize) /* {{{ proto void MongoDB\Driver\Undefined::__unserialize(array $data) */ -PHP_METHOD(MongoDB_BSON_Undefined, __unserialize) +static PHP_METHOD(MongoDB_BSON_Undefined, __unserialize) { zval* data; @@ -112,16 +112,8 @@ static zend_object* php_phongo_undefined_create_object(zend_class_entry* class_t void php_phongo_undefined_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Undefined", class_MongoDB_BSON_Undefined_methods); - php_phongo_undefined_ce = zend_register_internal_class(&ce); + php_phongo_undefined_ce = register_class_MongoDB_BSON_Undefined(php_phongo_json_serializable_ce, php_phongo_type_ce, zend_ce_serializable); php_phongo_undefined_ce->create_object = php_phongo_undefined_create_object; - PHONGO_CE_FINAL(php_phongo_undefined_ce); - - zend_class_implements(php_phongo_undefined_ce, 1, php_phongo_json_serializable_ce); - zend_class_implements(php_phongo_undefined_ce, 1, php_phongo_type_ce); - zend_class_implements(php_phongo_undefined_ce, 1, zend_ce_serializable); #if PHP_VERSION_ID >= 80000 zend_class_implements(php_phongo_undefined_ce, 1, zend_ce_stringable); diff --git a/src/BSON/Undefined.stub.php b/src/BSON/Undefined.stub.php index ffc8deeca..6399a897a 100644 --- a/src/BSON/Undefined.stub.php +++ b/src/BSON/Undefined.stub.php @@ -1,10 +1,13 @@ = 80000 -ZEND_METHOD(MongoDB_BSON_Undefined, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Undefined, jsonSerialize); #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_METHOD(MongoDB_BSON_Undefined, jsonSerialize); +static ZEND_METHOD(MongoDB_BSON_Undefined, jsonSerialize); #endif @@ -60,3 +60,15 @@ static const zend_function_entry class_MongoDB_BSON_Undefined_methods[] = { #endif ZEND_FE_END }; + +static zend_class_entry *register_class_MongoDB_BSON_Undefined(zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Undefined", class_MongoDB_BSON_Undefined_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 3, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + + return class_entry; +} diff --git a/src/BSON/Unserializable.c b/src/BSON/Unserializable.c index a6c6d5037..b47a339db 100644 --- a/src/BSON/Unserializable.c +++ b/src/BSON/Unserializable.c @@ -23,8 +23,5 @@ zend_class_entry* php_phongo_unserializable_ce; void php_phongo_unserializable_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Unserializable", class_MongoDB_BSON_Unserializable_methods); - php_phongo_unserializable_ce = zend_register_internal_interface(&ce); + php_phongo_unserializable_ce = register_class_MongoDB_BSON_Unserializable(); } /* }}} */ diff --git a/src/BSON/Unserializable.stub.php b/src/BSON/Unserializable.stub.php index e48b197bb..eab8d62a7 100644 --- a/src/BSON/Unserializable.stub.php +++ b/src/BSON/Unserializable.stub.php @@ -1,6 +1,9 @@ Date: Wed, 27 Jul 2022 14:00:46 +0200 Subject: [PATCH 07/26] Declare Binary class constants in stub file --- src/BSON/Binary.c | 10 ------- src/BSON/Binary.stub.php | 54 +++++++++++++++++++++++++++++++++++++ src/BSON/Binary_arginfo.h | 56 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 109 insertions(+), 11 deletions(-) diff --git a/src/BSON/Binary.c b/src/BSON/Binary.c index 647ab6e2e..5a0bd3fc2 100644 --- a/src/BSON/Binary.c +++ b/src/BSON/Binary.c @@ -371,14 +371,4 @@ void php_phongo_binary_init_ce(INIT_FUNC_ARGS) /* {{{ */ php_phongo_handler_binary.get_properties = php_phongo_binary_get_properties; php_phongo_handler_binary.free_obj = php_phongo_binary_free_object; php_phongo_handler_binary.offset = XtOffsetOf(php_phongo_binary_t, std); - - zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_GENERIC"), BSON_SUBTYPE_BINARY); - zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_FUNCTION"), BSON_SUBTYPE_FUNCTION); - zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_OLD_BINARY"), BSON_SUBTYPE_BINARY_DEPRECATED); - zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_OLD_UUID"), BSON_SUBTYPE_UUID_DEPRECATED); - zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_UUID"), BSON_SUBTYPE_UUID); - zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_MD5"), BSON_SUBTYPE_MD5); - zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_ENCRYPTED"), BSON_SUBTYPE_ENCRYPTED); - zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_COLUMN"), BSON_SUBTYPE_COLUMN); - zend_declare_class_constant_long(php_phongo_binary_ce, ZEND_STRL("TYPE_USER_DEFINED"), BSON_SUBTYPE_USER); } /* }}} */ diff --git a/src/BSON/Binary.stub.php b/src/BSON/Binary.stub.php index 101378ca1..407260340 100644 --- a/src/BSON/Binary.stub.php +++ b/src/BSON/Binary.stub.php @@ -9,6 +9,60 @@ { final class Binary implements BinaryInterface, JsonSerializable, Type, \Serializable { + /** + * @var int + * @cvalue BSON_SUBTYPE_BINARY + */ + public const TYPE_GENERIC = UNKNOWN; + + /** + * @var int + * @cvalue BSON_SUBTYPE_FUNCTION + */ + public const TYPE_FUNCTION = UNKNOWN; + + /** + * @var int + * @cvalue BSON_SUBTYPE_BINARY_DEPRECATED + */ + public const TYPE_OLD_BINARY = UNKNOWN; + + /** + * @var int + * @cvalue BSON_SUBTYPE_UUID_DEPRECATED + */ + public const TYPE_OLD_UUID = UNKNOWN; + + /** + * @var int + * @cvalue BSON_SUBTYPE_UUID + */ + public const TYPE_UUID = UNKNOWN; + + /** + * @var int + * @cvalue BSON_SUBTYPE_MD5 + */ + public const TYPE_MD5 = UNKNOWN; + + /** + * @var int + * @cvalue BSON_SUBTYPE_ENCRYPTED + */ + public const TYPE_ENCRYPTED = UNKNOWN; + + /** + * @var int + * @cvalue BSON_SUBTYPE_COLUMN + */ + public const TYPE_COLUMN = UNKNOWN; + + /** + * @var int + * @cvalue BSON_SUBTYPE_USER + */ + public const TYPE_USER_DEFINED = UNKNOWN; + public final function __construct(string $data, int $type) {} final public function getData(): string {} diff --git a/src/BSON/Binary_arginfo.h b/src/BSON/Binary_arginfo.h index cad5dd4d4..8b217acbc 100644 --- a/src/BSON/Binary_arginfo.h +++ b/src/BSON/Binary_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: d396a5052e0f0ae59adcc382ae0d4fd255d26a45 */ + * Stub hash: f39a96c515f56320c10cf27cdd6d94b008bfaf13 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Binary___construct, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) @@ -87,5 +87,59 @@ static zend_class_entry *register_class_MongoDB_BSON_Binary(zend_class_entry *cl class_entry->ce_flags |= ZEND_ACC_FINAL; zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_BinaryInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zval const_TYPE_GENERIC_value; + ZVAL_LONG(&const_TYPE_GENERIC_value, BSON_SUBTYPE_BINARY); + zend_string *const_TYPE_GENERIC_name = zend_string_init_interned("TYPE_GENERIC", sizeof("TYPE_GENERIC") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_GENERIC_name, &const_TYPE_GENERIC_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_GENERIC_name); + + zval const_TYPE_FUNCTION_value; + ZVAL_LONG(&const_TYPE_FUNCTION_value, BSON_SUBTYPE_FUNCTION); + zend_string *const_TYPE_FUNCTION_name = zend_string_init_interned("TYPE_FUNCTION", sizeof("TYPE_FUNCTION") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_FUNCTION_name, &const_TYPE_FUNCTION_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_FUNCTION_name); + + zval const_TYPE_OLD_BINARY_value; + ZVAL_LONG(&const_TYPE_OLD_BINARY_value, BSON_SUBTYPE_BINARY_DEPRECATED); + zend_string *const_TYPE_OLD_BINARY_name = zend_string_init_interned("TYPE_OLD_BINARY", sizeof("TYPE_OLD_BINARY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_OLD_BINARY_name, &const_TYPE_OLD_BINARY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_OLD_BINARY_name); + + zval const_TYPE_OLD_UUID_value; + ZVAL_LONG(&const_TYPE_OLD_UUID_value, BSON_SUBTYPE_UUID_DEPRECATED); + zend_string *const_TYPE_OLD_UUID_name = zend_string_init_interned("TYPE_OLD_UUID", sizeof("TYPE_OLD_UUID") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_OLD_UUID_name, &const_TYPE_OLD_UUID_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_OLD_UUID_name); + + zval const_TYPE_UUID_value; + ZVAL_LONG(&const_TYPE_UUID_value, BSON_SUBTYPE_UUID); + zend_string *const_TYPE_UUID_name = zend_string_init_interned("TYPE_UUID", sizeof("TYPE_UUID") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_UUID_name, &const_TYPE_UUID_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_UUID_name); + + zval const_TYPE_MD5_value; + ZVAL_LONG(&const_TYPE_MD5_value, BSON_SUBTYPE_MD5); + zend_string *const_TYPE_MD5_name = zend_string_init_interned("TYPE_MD5", sizeof("TYPE_MD5") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_MD5_name, &const_TYPE_MD5_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_MD5_name); + + zval const_TYPE_ENCRYPTED_value; + ZVAL_LONG(&const_TYPE_ENCRYPTED_value, BSON_SUBTYPE_ENCRYPTED); + zend_string *const_TYPE_ENCRYPTED_name = zend_string_init_interned("TYPE_ENCRYPTED", sizeof("TYPE_ENCRYPTED") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_ENCRYPTED_name, &const_TYPE_ENCRYPTED_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_ENCRYPTED_name); + + zval const_TYPE_COLUMN_value; + ZVAL_LONG(&const_TYPE_COLUMN_value, BSON_SUBTYPE_COLUMN); + zend_string *const_TYPE_COLUMN_name = zend_string_init_interned("TYPE_COLUMN", sizeof("TYPE_COLUMN") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_COLUMN_name, &const_TYPE_COLUMN_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_COLUMN_name); + + zval const_TYPE_USER_DEFINED_value; + ZVAL_LONG(&const_TYPE_USER_DEFINED_value, BSON_SUBTYPE_USER); + zend_string *const_TYPE_USER_DEFINED_name = zend_string_init_interned("TYPE_USER_DEFINED", sizeof("TYPE_USER_DEFINED") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_USER_DEFINED_name, &const_TYPE_USER_DEFINED_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_USER_DEFINED_name); + return class_entry; } From 770e95b62b6ecb74956dd6c4f28374452bfcdb0c Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Wed, 27 Jul 2022 14:22:29 +0200 Subject: [PATCH 08/26] Use stubs in exception classes --- .../Exception/AuthenticationException.c | 12 ++----- .../AuthenticationException.stub.php | 13 ++++++++ .../AuthenticationException_arginfo.h | 19 +++++++++++ src/MongoDB/Exception/BulkWriteException.c | 12 ++----- .../Exception/BulkWriteException.stub.php | 13 ++++++++ .../Exception/BulkWriteException_arginfo.h | 19 +++++++++++ src/MongoDB/Exception/CommandException.c | 22 ++----------- .../Exception/CommandException.stub.php | 17 ++++++++++ .../Exception/CommandException_arginfo.h | 30 +++++++++++++++++ src/MongoDB/Exception/ConnectionException.c | 12 ++----- .../Exception/ConnectionException.stub.php | 13 ++++++++ .../Exception/ConnectionException_arginfo.h | 19 +++++++++++ .../Exception/ConnectionTimeoutException.c | 13 ++------ .../ConnectionTimeoutException.stub.php | 13 ++++++++ .../ConnectionTimeoutException_arginfo.h | 20 ++++++++++++ src/MongoDB/Exception/EncryptionException.c | 12 ++----- .../Exception/EncryptionException.stub.php | 13 ++++++++ .../Exception/EncryptionException_arginfo.h | 19 +++++++++++ src/MongoDB/Exception/Exception.c | 13 ++------ src/MongoDB/Exception/Exception.stub.php | 13 ++++++++ src/MongoDB/Exception/Exception_arginfo.h | 20 ++++++++++++ .../Exception/ExecutionTimeoutException.c | 13 ++------ .../ExecutionTimeoutException.stub.php | 13 ++++++++ .../ExecutionTimeoutException_arginfo.h | 20 ++++++++++++ .../Exception/InvalidArgumentException.c | 13 ++------ .../InvalidArgumentException.stub.php | 13 ++++++++ .../InvalidArgumentException_arginfo.h | 20 ++++++++++++ src/MongoDB/Exception/LogicException.c | 13 ++------ src/MongoDB/Exception/LogicException.stub.php | 13 ++++++++ .../Exception/LogicException_arginfo.h | 20 ++++++++++++ src/MongoDB/Exception/RuntimeException.c | 24 ++------------ .../Exception/RuntimeException.stub.php | 17 ++++++++++ .../Exception/RuntimeException_arginfo.h | 32 +++++++++++++++++++ .../Exception/SSLConnectionException.c | 13 ++------ .../Exception/SSLConnectionException.stub.php | 13 ++++++++ .../SSLConnectionException_arginfo.h | 20 ++++++++++++ src/MongoDB/Exception/ServerException.c | 12 ++----- .../Exception/ServerException.stub.php | 13 ++++++++ .../Exception/ServerException_arginfo.h | 19 +++++++++++ .../Exception/UnexpectedValueException.c | 13 ++------ .../UnexpectedValueException.stub.php | 13 ++++++++ .../UnexpectedValueException_arginfo.h | 20 ++++++++++++ src/MongoDB/Exception/WriteException.c | 23 ++----------- src/MongoDB/Exception/WriteException.stub.php | 17 ++++++++++ .../Exception/WriteException_arginfo.h | 31 ++++++++++++++++++ 45 files changed, 568 insertions(+), 187 deletions(-) create mode 100644 src/MongoDB/Exception/AuthenticationException.stub.php create mode 100644 src/MongoDB/Exception/AuthenticationException_arginfo.h create mode 100644 src/MongoDB/Exception/BulkWriteException.stub.php create mode 100644 src/MongoDB/Exception/BulkWriteException_arginfo.h create mode 100644 src/MongoDB/Exception/CommandException.stub.php create mode 100644 src/MongoDB/Exception/CommandException_arginfo.h create mode 100644 src/MongoDB/Exception/ConnectionException.stub.php create mode 100644 src/MongoDB/Exception/ConnectionException_arginfo.h create mode 100644 src/MongoDB/Exception/ConnectionTimeoutException.stub.php create mode 100644 src/MongoDB/Exception/ConnectionTimeoutException_arginfo.h create mode 100644 src/MongoDB/Exception/EncryptionException.stub.php create mode 100644 src/MongoDB/Exception/EncryptionException_arginfo.h create mode 100644 src/MongoDB/Exception/Exception.stub.php create mode 100644 src/MongoDB/Exception/Exception_arginfo.h create mode 100644 src/MongoDB/Exception/ExecutionTimeoutException.stub.php create mode 100644 src/MongoDB/Exception/ExecutionTimeoutException_arginfo.h create mode 100644 src/MongoDB/Exception/InvalidArgumentException.stub.php create mode 100644 src/MongoDB/Exception/InvalidArgumentException_arginfo.h create mode 100644 src/MongoDB/Exception/LogicException.stub.php create mode 100644 src/MongoDB/Exception/LogicException_arginfo.h create mode 100644 src/MongoDB/Exception/RuntimeException.stub.php create mode 100644 src/MongoDB/Exception/RuntimeException_arginfo.h create mode 100644 src/MongoDB/Exception/SSLConnectionException.stub.php create mode 100644 src/MongoDB/Exception/SSLConnectionException_arginfo.h create mode 100644 src/MongoDB/Exception/ServerException.stub.php create mode 100644 src/MongoDB/Exception/ServerException_arginfo.h create mode 100644 src/MongoDB/Exception/UnexpectedValueException.stub.php create mode 100644 src/MongoDB/Exception/UnexpectedValueException_arginfo.h create mode 100644 src/MongoDB/Exception/WriteException.stub.php create mode 100644 src/MongoDB/Exception/WriteException_arginfo.h diff --git a/src/MongoDB/Exception/AuthenticationException.c b/src/MongoDB/Exception/AuthenticationException.c index c118a1173..d23bf0875 100644 --- a/src/MongoDB/Exception/AuthenticationException.c +++ b/src/MongoDB/Exception/AuthenticationException.c @@ -17,19 +17,11 @@ #include #include "php_phongo.h" +#include "AuthenticationException_arginfo.h" zend_class_entry* php_phongo_authenticationexception_ce; -/* {{{ MongoDB\Driver\Exception\AuthenticationException function entries */ -static zend_function_entry php_phongo_authenticationexception_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_authenticationexception_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "AuthenticationException", php_phongo_authenticationexception_me); - php_phongo_authenticationexception_ce = zend_register_internal_class_ex(&ce, php_phongo_connectionexception_ce); + php_phongo_authenticationexception_ce = register_class_MongoDB_Driver_Exception_AuthenticationException(php_phongo_connectionexception_ce); } /* }}} */ diff --git a/src/MongoDB/Exception/AuthenticationException.stub.php b/src/MongoDB/Exception/AuthenticationException.stub.php new file mode 100644 index 000000000..17fa68b05 --- /dev/null +++ b/src/MongoDB/Exception/AuthenticationException.stub.php @@ -0,0 +1,13 @@ + #include "php_phongo.h" +#include "BulkWriteException_arginfo.h" zend_class_entry* php_phongo_bulkwriteexception_ce; -/* {{{ MongoDB\Driver\Exception\BulkWriteException function entries */ -static zend_function_entry php_phongo_bulkwriteexception_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_bulkwriteexception_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "BulkWriteException", php_phongo_bulkwriteexception_me); - php_phongo_bulkwriteexception_ce = zend_register_internal_class_ex(&ce, php_phongo_writeexception_ce); + php_phongo_bulkwriteexception_ce = register_class_MongoDB_Driver_Exception_BulkWriteException(php_phongo_writeexception_ce); } /* }}} */ diff --git a/src/MongoDB/Exception/BulkWriteException.stub.php b/src/MongoDB/Exception/BulkWriteException.stub.php new file mode 100644 index 000000000..489add4ea --- /dev/null +++ b/src/MongoDB/Exception/BulkWriteException.stub.php @@ -0,0 +1,13 @@ + #include "php_phongo.h" +#include "ConnectionException_arginfo.h" zend_class_entry* php_phongo_connectionexception_ce; -/* {{{ MongoDB\Driver\Exception\ConnectionException function entries */ -static zend_function_entry php_phongo_connectionexception_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_connectionexception_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "ConnectionException", php_phongo_connectionexception_me); - php_phongo_connectionexception_ce = zend_register_internal_class_ex(&ce, php_phongo_runtimeexception_ce); + php_phongo_connectionexception_ce = register_class_MongoDB_Driver_Exception_ConnectionException(php_phongo_runtimeexception_ce); } /* }}} */ diff --git a/src/MongoDB/Exception/ConnectionException.stub.php b/src/MongoDB/Exception/ConnectionException.stub.php new file mode 100644 index 000000000..43be5ccd1 --- /dev/null +++ b/src/MongoDB/Exception/ConnectionException.stub.php @@ -0,0 +1,13 @@ + #include "php_phongo.h" +#include "ConnectionTimeoutException_arginfo.h" zend_class_entry* php_phongo_connectiontimeoutexception_ce; -/* {{{ MongoDB\Driver\Exception\ConnectionTimeoutException function entries */ -static zend_function_entry php_phongo_connectiontimeoutexception_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_connectiontimeoutexception_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "ConnectionTimeoutException", php_phongo_connectiontimeoutexception_me); - php_phongo_connectiontimeoutexception_ce = zend_register_internal_class_ex(&ce, php_phongo_connectionexception_ce); - PHONGO_CE_FINAL(php_phongo_connectiontimeoutexception_ce); + php_phongo_connectiontimeoutexception_ce = register_class_MongoDB_Driver_Exception_ConnectionTimeoutException(php_phongo_connectionexception_ce); } /* }}} */ diff --git a/src/MongoDB/Exception/ConnectionTimeoutException.stub.php b/src/MongoDB/Exception/ConnectionTimeoutException.stub.php new file mode 100644 index 000000000..6ececfe0c --- /dev/null +++ b/src/MongoDB/Exception/ConnectionTimeoutException.stub.php @@ -0,0 +1,13 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Exception/EncryptionException.c b/src/MongoDB/Exception/EncryptionException.c index 9016225e6..7f3d92936 100644 --- a/src/MongoDB/Exception/EncryptionException.c +++ b/src/MongoDB/Exception/EncryptionException.c @@ -17,19 +17,11 @@ #include #include "php_phongo.h" +#include "EncryptionException_arginfo.h" zend_class_entry* php_phongo_encryptionexception_ce; -/* {{{ MongoDB\Driver\Exception\EncryptionException function entries */ -static zend_function_entry php_phongo_encryptionexception_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_encryptionexception_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "EncryptionException", php_phongo_encryptionexception_me); - php_phongo_encryptionexception_ce = zend_register_internal_class_ex(&ce, php_phongo_runtimeexception_ce); + php_phongo_encryptionexception_ce = register_class_MongoDB_Driver_Exception_EncryptionException(php_phongo_runtimeexception_ce); } /* }}} */ diff --git a/src/MongoDB/Exception/EncryptionException.stub.php b/src/MongoDB/Exception/EncryptionException.stub.php new file mode 100644 index 000000000..9d27ac2fd --- /dev/null +++ b/src/MongoDB/Exception/EncryptionException.stub.php @@ -0,0 +1,13 @@ + #include "php_phongo.h" +#include "Exception_arginfo.h" zend_class_entry* php_phongo_exception_ce; -/* {{{ MongoDB\Driver\Exception\Exception function entries */ -static zend_function_entry php_phongo_exception_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_exception_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "Exception", php_phongo_exception_me); - php_phongo_exception_ce = zend_register_internal_interface(&ce); - zend_class_implements(php_phongo_exception_ce, 1, zend_ce_throwable); + php_phongo_exception_ce = register_class_MongoDB_Driver_Exception_Exception(zend_ce_throwable); } /* }}} */ diff --git a/src/MongoDB/Exception/Exception.stub.php b/src/MongoDB/Exception/Exception.stub.php new file mode 100644 index 000000000..da2b2ffc0 --- /dev/null +++ b/src/MongoDB/Exception/Exception.stub.php @@ -0,0 +1,13 @@ + #include "php_phongo.h" +#include "ExecutionTimeoutException_arginfo.h" zend_class_entry* php_phongo_executiontimeoutexception_ce; -/* {{{ MongoDB\Driver\Exception\ExecutionTimeoutException function entries */ -static zend_function_entry php_phongo_executiontimeoutexception_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_executiontimeoutexception_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "ExecutionTimeoutException", php_phongo_executiontimeoutexception_me); - php_phongo_executiontimeoutexception_ce = zend_register_internal_class_ex(&ce, php_phongo_serverexception_ce); - PHONGO_CE_FINAL(php_phongo_executiontimeoutexception_ce); + php_phongo_executiontimeoutexception_ce = register_class_MongoDB_Driver_Exception_ExecutionTimeoutException(php_phongo_serverexception_ce); } /* }}} */ diff --git a/src/MongoDB/Exception/ExecutionTimeoutException.stub.php b/src/MongoDB/Exception/ExecutionTimeoutException.stub.php new file mode 100644 index 000000000..2bb26f2d1 --- /dev/null +++ b/src/MongoDB/Exception/ExecutionTimeoutException.stub.php @@ -0,0 +1,13 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Exception/InvalidArgumentException.c b/src/MongoDB/Exception/InvalidArgumentException.c index 515e30624..225d08364 100644 --- a/src/MongoDB/Exception/InvalidArgumentException.c +++ b/src/MongoDB/Exception/InvalidArgumentException.c @@ -18,20 +18,11 @@ #include #include "php_phongo.h" +#include "InvalidArgumentException_arginfo.h" zend_class_entry* php_phongo_invalidargumentexception_ce; -/* {{{ MongoDB\Driver\Exception\InvalidArgumentException function entries */ -static zend_function_entry php_phongo_invalidargumentexception_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_invalidargumentexception_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "InvalidArgumentException", php_phongo_invalidargumentexception_me); - php_phongo_invalidargumentexception_ce = zend_register_internal_class_ex(&ce, spl_ce_InvalidArgumentException); - zend_class_implements(php_phongo_invalidargumentexception_ce, 1, php_phongo_exception_ce); + php_phongo_invalidargumentexception_ce = register_class_MongoDB_Driver_Exception_InvalidArgumentException(spl_ce_InvalidArgumentException, php_phongo_exception_ce); } /* }}} */ diff --git a/src/MongoDB/Exception/InvalidArgumentException.stub.php b/src/MongoDB/Exception/InvalidArgumentException.stub.php new file mode 100644 index 000000000..22342247e --- /dev/null +++ b/src/MongoDB/Exception/InvalidArgumentException.stub.php @@ -0,0 +1,13 @@ + #include "php_phongo.h" +#include "LogicException_arginfo.h" zend_class_entry* php_phongo_logicexception_ce; -/* {{{ MongoDB\Driver\Exception\LogicException function entries */ -static zend_function_entry php_phongo_logicexception_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_logicexception_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "LogicException", php_phongo_logicexception_me); - php_phongo_logicexception_ce = zend_register_internal_class_ex(&ce, spl_ce_LogicException); - zend_class_implements(php_phongo_logicexception_ce, 1, php_phongo_exception_ce); + php_phongo_logicexception_ce = register_class_MongoDB_Driver_Exception_LogicException(spl_ce_LogicException, php_phongo_exception_ce); } /* }}} */ diff --git a/src/MongoDB/Exception/LogicException.stub.php b/src/MongoDB/Exception/LogicException.stub.php new file mode 100644 index 000000000..8c3609f4d --- /dev/null +++ b/src/MongoDB/Exception/LogicException.stub.php @@ -0,0 +1,13 @@ + #include "php_phongo.h" +#include "SSLConnectionException_arginfo.h" zend_class_entry* php_phongo_sslconnectionexception_ce; -/* {{{ MongoDB\Driver\Exception\SSLConnectionException function entries */ -static zend_function_entry php_phongo_sslconnectionexception_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_sslconnectionexception_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "SSLConnectionException", php_phongo_sslconnectionexception_me); - php_phongo_sslconnectionexception_ce = zend_register_internal_class_ex(&ce, php_phongo_connectionexception_ce); - PHONGO_CE_FINAL(php_phongo_sslconnectionexception_ce); + php_phongo_sslconnectionexception_ce = register_class_MongoDB_Driver_Exception_SSLConnectionException(php_phongo_connectionexception_ce); } /* }}} */ diff --git a/src/MongoDB/Exception/SSLConnectionException.stub.php b/src/MongoDB/Exception/SSLConnectionException.stub.php new file mode 100644 index 000000000..7e238ad7d --- /dev/null +++ b/src/MongoDB/Exception/SSLConnectionException.stub.php @@ -0,0 +1,13 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Exception/ServerException.c b/src/MongoDB/Exception/ServerException.c index fdd5df603..c4500d1c8 100644 --- a/src/MongoDB/Exception/ServerException.c +++ b/src/MongoDB/Exception/ServerException.c @@ -17,19 +17,11 @@ #include #include "php_phongo.h" +#include "ServerException_arginfo.h" zend_class_entry* php_phongo_serverexception_ce; -/* {{{ MongoDB\Driver\Exception\ServerException function entries */ -static zend_function_entry php_phongo_serverexception_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_serverexception_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "ServerException", php_phongo_serverexception_me); - php_phongo_serverexception_ce = zend_register_internal_class_ex(&ce, php_phongo_runtimeexception_ce); + php_phongo_serverexception_ce = register_class_MongoDB_Driver_Exception_ServerException(php_phongo_runtimeexception_ce); } /* }}} */ diff --git a/src/MongoDB/Exception/ServerException.stub.php b/src/MongoDB/Exception/ServerException.stub.php new file mode 100644 index 000000000..cffe32b75 --- /dev/null +++ b/src/MongoDB/Exception/ServerException.stub.php @@ -0,0 +1,13 @@ + #include "php_phongo.h" +#include "UnexpectedValueException_arginfo.h" zend_class_entry* php_phongo_unexpectedvalueexception_ce; -/* {{{ MongoDB\Driver\Exception\UnexpectedValueException function entries */ -static zend_function_entry php_phongo_unexpectedvalueexception_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_unexpectedvalueexception_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Exception", "UnexpectedValueException", php_phongo_unexpectedvalueexception_me); - php_phongo_unexpectedvalueexception_ce = zend_register_internal_class_ex(&ce, spl_ce_UnexpectedValueException); - zend_class_implements(php_phongo_unexpectedvalueexception_ce, 1, php_phongo_exception_ce); + php_phongo_unexpectedvalueexception_ce = register_class_MongoDB_Driver_Exception_UnexpectedValueException(spl_ce_UnexpectedValueException, php_phongo_exception_ce); } /* }}} */ diff --git a/src/MongoDB/Exception/UnexpectedValueException.stub.php b/src/MongoDB/Exception/UnexpectedValueException.stub.php new file mode 100644 index 000000000..156119952 --- /dev/null +++ b/src/MongoDB/Exception/UnexpectedValueException.stub.php @@ -0,0 +1,13 @@ +ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; - - zend_declare_property_null(php_phongo_writeexception_ce, ZEND_STRL("writeResult"), ZEND_ACC_PROTECTED); + php_phongo_writeexception_ce = register_class_MongoDB_Driver_Exception_WriteException(php_phongo_serverexception_ce); } /* }}} */ diff --git a/src/MongoDB/Exception/WriteException.stub.php b/src/MongoDB/Exception/WriteException.stub.php new file mode 100644 index 000000000..6dc7d4fb0 --- /dev/null +++ b/src/MongoDB/Exception/WriteException.stub.php @@ -0,0 +1,17 @@ +ce_flags |= ZEND_ACC_ABSTRACT; + + zval property_writeResult_default_value; + ZVAL_NULL(&property_writeResult_default_value); + zend_string *property_writeResult_name = zend_string_init("writeResult", sizeof("writeResult") - 1, 1); + zend_declare_property_ex(class_entry, property_writeResult_name, &property_writeResult_default_value, ZEND_ACC_PROTECTED, NULL); + zend_string_release(property_writeResult_name); + + return class_entry; +} From 369a6df9cdbb951c999f88e0ee219cf832f2615b Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Wed, 27 Jul 2022 15:30:21 +0200 Subject: [PATCH 09/26] Add stubs for monitoring classes --- src/MongoDB/Monitoring/CommandFailedEvent.c | 52 ++++--------- .../Monitoring/CommandFailedEvent.stub.php | 34 +++++++++ .../Monitoring/CommandFailedEvent_arginfo.h | 73 +++++++++++++++++++ src/MongoDB/Monitoring/CommandStartedEvent.c | 51 ++++--------- .../Monitoring/CommandStartedEvent.stub.php | 32 ++++++++ .../Monitoring/CommandStartedEvent_arginfo.h | 67 +++++++++++++++++ src/MongoDB/Monitoring/CommandSubscriber.c | 34 +-------- .../Monitoring/CommandSubscriber.stub.php | 21 ++++++ .../Monitoring/CommandSubscriber_arginfo.h | 35 +++++++++ .../Monitoring/CommandSucceededEvent.c | 51 ++++--------- .../Monitoring/CommandSucceededEvent.stub.php | 32 ++++++++ .../CommandSucceededEvent_arginfo.h | 68 +++++++++++++++++ src/MongoDB/Monitoring/SDAMSubscriber.c | 64 +--------------- .../Monitoring/SDAMSubscriber.stub.php | 39 ++++++++++ .../Monitoring/SDAMSubscriber_arginfo.h | 65 +++++++++++++++++ src/MongoDB/Monitoring/ServerChangedEvent.c | 42 +++-------- .../Monitoring/ServerChangedEvent.stub.php | 26 +++++++ .../Monitoring/ServerChangedEvent_arginfo.h | 54 ++++++++++++++ src/MongoDB/Monitoring/ServerClosedEvent.c | 36 ++------- .../Monitoring/ServerClosedEvent.stub.php | 22 ++++++ .../Monitoring/ServerClosedEvent_arginfo.h | 45 ++++++++++++ .../Monitoring/ServerHeartbeatFailedEvent.c | 42 +++-------- .../ServerHeartbeatFailedEvent.stub.php | 26 +++++++ .../ServerHeartbeatFailedEvent_arginfo.h | 54 ++++++++++++++ .../Monitoring/ServerHeartbeatStartedEvent.c | 34 ++------- .../ServerHeartbeatStartedEvent.stub.php | 22 ++++++ .../ServerHeartbeatStartedEvent_arginfo.h | 45 ++++++++++++ .../ServerHeartbeatSucceededEvent.c | 40 +++------- .../ServerHeartbeatSucceededEvent.stub.php | 26 +++++++ .../ServerHeartbeatSucceededEvent_arginfo.h | 54 ++++++++++++++ src/MongoDB/Monitoring/ServerOpeningEvent.c | 36 ++------- .../Monitoring/ServerOpeningEvent.stub.php | 22 ++++++ .../Monitoring/ServerOpeningEvent_arginfo.h | 45 ++++++++++++ src/MongoDB/Monitoring/Subscriber.c | 16 +--- src/MongoDB/Monitoring/Subscriber.stub.php | 13 ++++ src/MongoDB/Monitoring/Subscriber_arginfo.h | 19 +++++ src/MongoDB/Monitoring/TopologyChangedEvent.c | 32 ++------ .../Monitoring/TopologyChangedEvent.stub.php | 22 ++++++ .../Monitoring/TopologyChangedEvent_arginfo.h | 44 +++++++++++ src/MongoDB/Monitoring/TopologyClosedEvent.c | 26 ++----- .../Monitoring/TopologyClosedEvent.stub.php | 18 +++++ .../Monitoring/TopologyClosedEvent_arginfo.h | 35 +++++++++ src/MongoDB/Monitoring/TopologyOpeningEvent.c | 26 ++----- .../Monitoring/TopologyOpeningEvent.stub.php | 18 +++++ .../Monitoring/TopologyOpeningEvent_arginfo.h | 35 +++++++++ 45 files changed, 1231 insertions(+), 462 deletions(-) create mode 100644 src/MongoDB/Monitoring/CommandFailedEvent.stub.php create mode 100644 src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h create mode 100644 src/MongoDB/Monitoring/CommandStartedEvent.stub.php create mode 100644 src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h create mode 100644 src/MongoDB/Monitoring/CommandSubscriber.stub.php create mode 100644 src/MongoDB/Monitoring/CommandSubscriber_arginfo.h create mode 100644 src/MongoDB/Monitoring/CommandSucceededEvent.stub.php create mode 100644 src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h create mode 100644 src/MongoDB/Monitoring/SDAMSubscriber.stub.php create mode 100644 src/MongoDB/Monitoring/SDAMSubscriber_arginfo.h create mode 100644 src/MongoDB/Monitoring/ServerChangedEvent.stub.php create mode 100644 src/MongoDB/Monitoring/ServerChangedEvent_arginfo.h create mode 100644 src/MongoDB/Monitoring/ServerClosedEvent.stub.php create mode 100644 src/MongoDB/Monitoring/ServerClosedEvent_arginfo.h create mode 100644 src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.stub.php create mode 100644 src/MongoDB/Monitoring/ServerHeartbeatFailedEvent_arginfo.h create mode 100644 src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.stub.php create mode 100644 src/MongoDB/Monitoring/ServerHeartbeatStartedEvent_arginfo.h create mode 100644 src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.stub.php create mode 100644 src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent_arginfo.h create mode 100644 src/MongoDB/Monitoring/ServerOpeningEvent.stub.php create mode 100644 src/MongoDB/Monitoring/ServerOpeningEvent_arginfo.h create mode 100644 src/MongoDB/Monitoring/Subscriber.stub.php create mode 100644 src/MongoDB/Monitoring/Subscriber_arginfo.h create mode 100644 src/MongoDB/Monitoring/TopologyChangedEvent.stub.php create mode 100644 src/MongoDB/Monitoring/TopologyChangedEvent_arginfo.h create mode 100644 src/MongoDB/Monitoring/TopologyClosedEvent.stub.php create mode 100644 src/MongoDB/Monitoring/TopologyClosedEvent_arginfo.h create mode 100644 src/MongoDB/Monitoring/TopologyOpeningEvent.stub.php create mode 100644 src/MongoDB/Monitoring/TopologyOpeningEvent_arginfo.h diff --git a/src/MongoDB/Monitoring/CommandFailedEvent.c b/src/MongoDB/Monitoring/CommandFailedEvent.c index 117b7e0bf..5a11d6e88 100644 --- a/src/MongoDB/Monitoring/CommandFailedEvent.c +++ b/src/MongoDB/Monitoring/CommandFailedEvent.c @@ -25,12 +25,16 @@ #include "BSON/ObjectId.h" #include "MongoDB/Server.h" +#include "CommandFailedEvent_arginfo.h" zend_class_entry* php_phongo_commandfailedevent_ce; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_Monitoring_CommandFailedEvent) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Monitoring_CommandFailedEvent) + /* {{{ proto string CommandFailedEvent::getCommandName() Returns the command name for this event */ -PHP_METHOD(CommandFailedEvent, getCommandName) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getCommandName) { php_phongo_commandfailedevent_t* intern; @@ -43,7 +47,7 @@ PHP_METHOD(CommandFailedEvent, getCommandName) /* {{{ proto int CommandFailedEvent::getDurationMicros() Returns the event's duration in microseconds */ -PHP_METHOD(CommandFailedEvent, getDurationMicros) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getDurationMicros) { php_phongo_commandfailedevent_t* intern; @@ -56,7 +60,7 @@ PHP_METHOD(CommandFailedEvent, getDurationMicros) /* {{{ proto Exception CommandFailedEvent::getError() Returns the error document associated with the event */ -PHP_METHOD(CommandFailedEvent, getError) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getError) { php_phongo_commandfailedevent_t* intern; @@ -69,7 +73,7 @@ PHP_METHOD(CommandFailedEvent, getError) /* {{{ proto string CommandFailedEvent::getOperationId() Returns the event's operation ID */ -PHP_METHOD(CommandFailedEvent, getOperationId) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getOperationId) { php_phongo_commandfailedevent_t* intern; char int_as_string[20]; @@ -84,7 +88,7 @@ PHP_METHOD(CommandFailedEvent, getOperationId) /* {{{ proto stdClass CommandFailedEvent::getReply() Returns the reply document associated with the event */ -PHP_METHOD(CommandFailedEvent, getReply) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getReply) { php_phongo_commandfailedevent_t* intern; php_phongo_bson_state state; @@ -105,7 +109,7 @@ PHP_METHOD(CommandFailedEvent, getReply) /* {{{ proto string CommandFailedEvent::getRequestId() Returns the event's request ID */ -PHP_METHOD(CommandFailedEvent, getRequestId) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getRequestId) { php_phongo_commandfailedevent_t* intern; char int_as_string[20]; @@ -120,7 +124,7 @@ PHP_METHOD(CommandFailedEvent, getRequestId) /* {{{ proto MongoDB\Driver\Server CommandFailedEvent::getServer() Returns the Server from which the event originated */ -PHP_METHOD(CommandFailedEvent, getServer) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getServer) { php_phongo_commandfailedevent_t* intern; @@ -133,7 +137,7 @@ PHP_METHOD(CommandFailedEvent, getServer) /* {{{ proto MongoDB\BSON\ObjectId|null CommandFailedEvent::getServiceId() Returns the event's service ID */ -PHP_METHOD(CommandFailedEvent, getServiceId) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getServiceId) { php_phongo_commandfailedevent_t* intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis()); @@ -148,7 +152,7 @@ PHP_METHOD(CommandFailedEvent, getServiceId) /* {{{ proto int|null CommandFailedEvent::getServerConnectionId() Returns the event's server connection ID */ -PHP_METHOD(CommandFailedEvent, getServerConnectionId) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getServerConnectionId) { php_phongo_commandfailedevent_t* intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis()); @@ -168,28 +172,6 @@ PHP_METHOD(CommandFailedEvent, getServerConnectionId) * This class is only constructed internally. */ -/* {{{ MongoDB\Driver\Monitoring\CommandFailedEvent function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_CommandFailedEvent_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_commandfailedevent_me[] = { - /* clang-format off */ - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_CommandFailedEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_ME(CommandFailedEvent, getCommandName, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandFailedEvent, getError, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandFailedEvent, getDurationMicros, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandFailedEvent, getOperationId, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandFailedEvent, getReply, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandFailedEvent, getRequestId, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandFailedEvent, getServer, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandFailedEvent, getServiceId, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandFailedEvent, getServerConnectionId, ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_CommandFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Monitoring\CommandFailedEvent object handlers */ static zend_object_handlers php_phongo_handler_commandfailedevent; @@ -290,14 +272,8 @@ static HashTable* php_phongo_commandfailedevent_get_debug_info(phongo_compat_obj void php_phongo_commandfailedevent_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - (void) type; - (void) module_number; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "CommandFailedEvent", php_phongo_commandfailedevent_me); - php_phongo_commandfailedevent_ce = zend_register_internal_class(&ce); + php_phongo_commandfailedevent_ce = register_class_MongoDB_Driver_Monitoring_CommandFailedEvent(); php_phongo_commandfailedevent_ce->create_object = php_phongo_commandfailedevent_create_object; - PHONGO_CE_FINAL(php_phongo_commandfailedevent_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_commandfailedevent_ce); memcpy(&php_phongo_handler_commandfailedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/Monitoring/CommandFailedEvent.stub.php b/src/MongoDB/Monitoring/CommandFailedEvent.stub.php new file mode 100644 index 000000000..35cc819e6 --- /dev/null +++ b/src/MongoDB/Monitoring/CommandFailedEvent.stub.php @@ -0,0 +1,34 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Monitoring/CommandStartedEvent.c b/src/MongoDB/Monitoring/CommandStartedEvent.c index 18f7c6896..9a568450a 100644 --- a/src/MongoDB/Monitoring/CommandStartedEvent.c +++ b/src/MongoDB/Monitoring/CommandStartedEvent.c @@ -25,12 +25,16 @@ #include "BSON/ObjectId.h" #include "MongoDB/Server.h" +#include "CommandStartedEvent_arginfo.h" zend_class_entry* php_phongo_commandstartedevent_ce; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_Monitoring_CommandStartedEvent) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Monitoring_CommandStartedEvent) + /* {{{ proto stdClass CommandStartedEvent::getCommand() Returns the command document associated with the event */ -PHP_METHOD(CommandStartedEvent, getCommand) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getCommand) { php_phongo_commandstartedevent_t* intern; php_phongo_bson_state state; @@ -51,7 +55,7 @@ PHP_METHOD(CommandStartedEvent, getCommand) /* {{{ proto string CommandStartedEvent::getCommandName() Returns the command name for this event */ -PHP_METHOD(CommandStartedEvent, getCommandName) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getCommandName) { php_phongo_commandstartedevent_t* intern; @@ -64,7 +68,7 @@ PHP_METHOD(CommandStartedEvent, getCommandName) /* {{{ proto string CommandStartedEvent::getDatabaseName() Returns the database name for this event */ -PHP_METHOD(CommandStartedEvent, getDatabaseName) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getDatabaseName) { php_phongo_commandstartedevent_t* intern; @@ -77,7 +81,7 @@ PHP_METHOD(CommandStartedEvent, getDatabaseName) /* {{{ proto string CommandStartedEvent::getOperationId() Returns the event's operation ID */ -PHP_METHOD(CommandStartedEvent, getOperationId) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getOperationId) { php_phongo_commandstartedevent_t* intern; char int_as_string[20]; @@ -92,7 +96,7 @@ PHP_METHOD(CommandStartedEvent, getOperationId) /* {{{ proto string CommandStartedEvent::getRequestId() Returns the event's request ID */ -PHP_METHOD(CommandStartedEvent, getRequestId) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getRequestId) { php_phongo_commandstartedevent_t* intern; char int_as_string[20]; @@ -107,7 +111,7 @@ PHP_METHOD(CommandStartedEvent, getRequestId) /* {{{ proto MongoDB\Driver\Server CommandStartedEvent::getServer() Returns the Server from which the event originated */ -PHP_METHOD(CommandStartedEvent, getServer) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getServer) { php_phongo_commandstartedevent_t* intern; @@ -120,7 +124,7 @@ PHP_METHOD(CommandStartedEvent, getServer) /* {{{ proto MongoDB\BSON\ObjectId|null CommandStartedEvent::getServiceId() Returns the event's service ID */ -PHP_METHOD(CommandStartedEvent, getServiceId) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getServiceId) { php_phongo_commandstartedevent_t* intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis()); @@ -135,7 +139,7 @@ PHP_METHOD(CommandStartedEvent, getServiceId) /* {{{ proto int|null CommandStartedEvent::getServerConnectionId() Returns the event's server connection ID */ -PHP_METHOD(CommandStartedEvent, getServerConnectionId) +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getServerConnectionId) { php_phongo_commandstartedevent_t* intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis()); @@ -155,27 +159,6 @@ PHP_METHOD(CommandStartedEvent, getServerConnectionId) * This class is only constructed internally. */ -/* {{{ MongoDB\Driver\Monitoring\CommandStartedEvent function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_CommandStartedEvent_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_commandstartedevent_me[] = { - /* clang-format off */ - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_CommandStartedEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_ME(CommandStartedEvent, getCommand, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandStartedEvent, getCommandName, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandStartedEvent, getDatabaseName, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandStartedEvent, getOperationId, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandStartedEvent, getRequestId, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandStartedEvent, getServer, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandStartedEvent, getServiceId, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CommandStartedEvent, getServerConnectionId, ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_CommandStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Monitoring\CommandStartedEvent object handlers */ static zend_object_handlers php_phongo_handler_commandstartedevent; @@ -273,20 +256,12 @@ static HashTable* php_phongo_commandstartedevent_get_debug_info(phongo_compat_ob void php_phongo_commandstartedevent_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - (void) type; - (void) module_number; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "CommandStartedEvent", php_phongo_commandstartedevent_me); - php_phongo_commandstartedevent_ce = zend_register_internal_class(&ce); + php_phongo_commandstartedevent_ce = register_class_MongoDB_Driver_Monitoring_CommandStartedEvent(); php_phongo_commandstartedevent_ce->create_object = php_phongo_commandstartedevent_create_object; - PHONGO_CE_FINAL(php_phongo_commandstartedevent_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_commandstartedevent_ce); memcpy(&php_phongo_handler_commandstartedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_commandstartedevent.get_debug_info = php_phongo_commandstartedevent_get_debug_info; php_phongo_handler_commandstartedevent.free_obj = php_phongo_commandstartedevent_free_object; php_phongo_handler_commandstartedevent.offset = XtOffsetOf(php_phongo_commandstartedevent_t, std); - - return; } /* }}} */ diff --git a/src/MongoDB/Monitoring/CommandStartedEvent.stub.php b/src/MongoDB/Monitoring/CommandStartedEvent.stub.php new file mode 100644 index 000000000..557c7ba8c --- /dev/null +++ b/src/MongoDB/Monitoring/CommandStartedEvent.stub.php @@ -0,0 +1,32 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Monitoring/CommandSubscriber.c b/src/MongoDB/Monitoring/CommandSubscriber.c index 34d02eaa4..aaae6b469 100644 --- a/src/MongoDB/Monitoring/CommandSubscriber.c +++ b/src/MongoDB/Monitoring/CommandSubscriber.c @@ -17,41 +17,11 @@ #include #include "php_phongo.h" +#include "CommandSubscriber_arginfo.h" zend_class_entry* php_phongo_commandsubscriber_ce; -/* {{{ MongoDB\Driver\Monitoring\CommandSubscriber function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_CommandSubscriber_commandStarted, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\CommandStartedEvent, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_CommandSubscriber_commandSucceeded, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\CommandSucceededEvent, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_CommandSubscriber_commandFailed, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\CommandFailedEvent, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_commandsubscriber_me[] = { - /* clang-format off */ - ZEND_ABSTRACT_ME(CommandSubscriber, commandStarted, ai_CommandSubscriber_commandStarted) - ZEND_ABSTRACT_ME(CommandSubscriber, commandSucceeded, ai_CommandSubscriber_commandSucceeded) - ZEND_ABSTRACT_ME(CommandSubscriber, commandFailed, ai_CommandSubscriber_commandFailed) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - void php_phongo_commandsubscriber_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - (void) type; - (void) module_number; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "CommandSubscriber", php_phongo_commandsubscriber_me); - php_phongo_commandsubscriber_ce = zend_register_internal_interface(&ce); - zend_class_implements(php_phongo_commandsubscriber_ce, 1, php_phongo_subscriber_ce); - - return; + php_phongo_commandsubscriber_ce = register_class_MongoDB_Driver_Monitoring_CommandSubscriber(php_phongo_subscriber_ce); } /* }}} */ diff --git a/src/MongoDB/Monitoring/CommandSubscriber.stub.php b/src/MongoDB/Monitoring/CommandSubscriber.stub.php new file mode 100644 index 000000000..afbc5c6cb --- /dev/null +++ b/src/MongoDB/Monitoring/CommandSubscriber.stub.php @@ -0,0 +1,21 @@ +create_object = php_phongo_commandsucceededevent_create_object; - PHONGO_CE_FINAL(php_phongo_commandsucceededevent_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_commandsucceededevent_ce); memcpy(&php_phongo_handler_commandsucceededevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_commandsucceededevent.get_debug_info = php_phongo_commandsucceededevent_get_debug_info; php_phongo_handler_commandsucceededevent.free_obj = php_phongo_commandsucceededevent_free_object; php_phongo_handler_commandsucceededevent.offset = XtOffsetOf(php_phongo_commandsucceededevent_t, std); - - return; } /* }}} */ diff --git a/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php b/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php new file mode 100644 index 000000000..d60b5e148 --- /dev/null +++ b/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php @@ -0,0 +1,32 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Monitoring/SDAMSubscriber.c b/src/MongoDB/Monitoring/SDAMSubscriber.c index a2e2cba9f..cccf2d0b7 100644 --- a/src/MongoDB/Monitoring/SDAMSubscriber.c +++ b/src/MongoDB/Monitoring/SDAMSubscriber.c @@ -17,71 +17,11 @@ #include #include "php_phongo.h" +#include "SDAMSubscriber_arginfo.h" zend_class_entry* php_phongo_sdamsubscriber_ce; -/* {{{ MongoDB\Driver\Monitoring\SDAMSubscriber function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_SDAMSubscriber_serverChanged, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\ServerChangedEvent, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_SDAMSubscriber_serverClosed, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\ServerClosedEvent, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_SDAMSubscriber_serverOpening, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\ServerOpeningEvent, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_SDAMSubscriber_serverHeartbeatFailed, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\ServerHeartbeatFailedEvent, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_SDAMSubscriber_serverHeartbeatStarted, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\ServerHeartbeatStartedEvent, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_SDAMSubscriber_serverHeartbeatSucceeded, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\ServerHeartbeatSucceededEvent, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_SDAMSubscriber_topologyChanged, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\TopologyChangedEvent, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_SDAMSubscriber_topologyClosed, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\TopologyClosedEvent, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_SDAMSubscriber_topologyOpening, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\TopologyOpeningEvent, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_sdamsubscriber_me[] = { - /* clang-format off */ - ZEND_ABSTRACT_ME(SDAMSubscriber, serverChanged, ai_SDAMSubscriber_serverChanged) - ZEND_ABSTRACT_ME(SDAMSubscriber, serverClosed, ai_SDAMSubscriber_serverClosed) - ZEND_ABSTRACT_ME(SDAMSubscriber, serverOpening, ai_SDAMSubscriber_serverOpening) - ZEND_ABSTRACT_ME(SDAMSubscriber, serverHeartbeatFailed, ai_SDAMSubscriber_serverHeartbeatFailed) - ZEND_ABSTRACT_ME(SDAMSubscriber, serverHeartbeatStarted, ai_SDAMSubscriber_serverHeartbeatStarted) - ZEND_ABSTRACT_ME(SDAMSubscriber, serverHeartbeatSucceeded, ai_SDAMSubscriber_serverHeartbeatSucceeded) - ZEND_ABSTRACT_ME(SDAMSubscriber, topologyChanged, ai_SDAMSubscriber_topologyChanged) - ZEND_ABSTRACT_ME(SDAMSubscriber, topologyClosed, ai_SDAMSubscriber_topologyClosed) - ZEND_ABSTRACT_ME(SDAMSubscriber, topologyOpening, ai_SDAMSubscriber_topologyOpening) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - void php_phongo_sdamsubscriber_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - (void) type; - (void) module_number; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "SDAMSubscriber", php_phongo_sdamsubscriber_me); - php_phongo_sdamsubscriber_ce = zend_register_internal_interface(&ce); - zend_class_implements(php_phongo_sdamsubscriber_ce, 1, php_phongo_subscriber_ce); - - return; + php_phongo_sdamsubscriber_ce = register_class_MongoDB_Driver_Monitoring_SDAMSubscriber(php_phongo_subscriber_ce); } /* }}} */ diff --git a/src/MongoDB/Monitoring/SDAMSubscriber.stub.php b/src/MongoDB/Monitoring/SDAMSubscriber.stub.php new file mode 100644 index 000000000..110e3c30a --- /dev/null +++ b/src/MongoDB/Monitoring/SDAMSubscriber.stub.php @@ -0,0 +1,39 @@ +topology_id); } /* }}} */ -/* {{{ MongoDB\Driver\Monitoring\ServerChangedEvent function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_ServerChangedEvent_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_serverchangedevent_me[] = { - /* clang-format off */ - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_ServerChangedEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_ME(ServerChangedEvent, getHost, ai_ServerChangedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerChangedEvent, getPort, ai_ServerChangedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerChangedEvent, getNewDescription, ai_ServerChangedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerChangedEvent, getPreviousDescription, ai_ServerChangedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerChangedEvent, getTopologyId, ai_ServerChangedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_ServerChangedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Monitoring\ServerChangedEvent object handlers */ static zend_object_handlers php_phongo_handler_serverchangedevent; @@ -167,20 +153,12 @@ static HashTable* php_phongo_serverchangedevent_get_debug_info(phongo_compat_obj void php_phongo_serverchangedevent_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - (void) type; - (void) module_number; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "ServerChangedEvent", php_phongo_serverchangedevent_me); - php_phongo_serverchangedevent_ce = zend_register_internal_class(&ce); + php_phongo_serverchangedevent_ce = register_class_MongoDB_Driver_Monitoring_ServerChangedEvent(); php_phongo_serverchangedevent_ce->create_object = php_phongo_serverchangedevent_create_object; - PHONGO_CE_FINAL(php_phongo_serverchangedevent_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serverchangedevent_ce); memcpy(&php_phongo_handler_serverchangedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_serverchangedevent.get_debug_info = php_phongo_serverchangedevent_get_debug_info; php_phongo_handler_serverchangedevent.free_obj = php_phongo_serverchangedevent_free_object; php_phongo_handler_serverchangedevent.offset = XtOffsetOf(php_phongo_serverchangedevent_t, std); - - return; } /* }}} */ diff --git a/src/MongoDB/Monitoring/ServerChangedEvent.stub.php b/src/MongoDB/Monitoring/ServerChangedEvent.stub.php new file mode 100644 index 000000000..a18086473 --- /dev/null +++ b/src/MongoDB/Monitoring/ServerChangedEvent.stub.php @@ -0,0 +1,26 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Monitoring/ServerClosedEvent.c b/src/MongoDB/Monitoring/ServerClosedEvent.c index 132660c57..f391108c5 100644 --- a/src/MongoDB/Monitoring/ServerClosedEvent.c +++ b/src/MongoDB/Monitoring/ServerClosedEvent.c @@ -21,12 +21,16 @@ #include "phongo_error.h" #include "BSON/ObjectId.h" +#include "ServerClosedEvent_arginfo.h" zend_class_entry* php_phongo_serverclosedevent_ce; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_Monitoring_ServerClosedEvent) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Monitoring_ServerClosedEvent) + /* {{{ proto string ServerClosedEvent::getHost() Returns this event's host */ -static PHP_METHOD(ServerClosedEvent, getHost) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerClosedEvent, getHost) { php_phongo_serverclosedevent_t* intern = Z_SERVERCLOSEDEVENT_OBJ_P(getThis()); @@ -37,7 +41,7 @@ static PHP_METHOD(ServerClosedEvent, getHost) /* {{{ proto integer ServerClosedEvent::getPort() Returns this event's port */ -static PHP_METHOD(ServerClosedEvent, getPort) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerClosedEvent, getPort) { php_phongo_serverclosedevent_t* intern = Z_SERVERCLOSEDEVENT_OBJ_P(getThis()); @@ -48,7 +52,7 @@ static PHP_METHOD(ServerClosedEvent, getPort) /* {{{ proto MongoDB\BSON\ObjectId ServerClosedEvent::getTopologyId() Returns this event's topology id */ -static PHP_METHOD(ServerClosedEvent, getTopologyId) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerClosedEvent, getTopologyId) { php_phongo_serverclosedevent_t* intern = Z_SERVERCLOSEDEVENT_OBJ_P(getThis()); @@ -57,22 +61,6 @@ static PHP_METHOD(ServerClosedEvent, getTopologyId) phongo_objectid_init(return_value, &intern->topology_id); } /* }}} */ -/* {{{ MongoDB\Driver\Monitoring\ServerClosedEvent function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_ServerClosedEvent_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_serverclosedevent_me[] = { - /* clang-format off */ - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_ServerClosedEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_ME(ServerClosedEvent, getHost, ai_ServerClosedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerClosedEvent, getPort, ai_ServerClosedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerClosedEvent, getTopologyId, ai_ServerClosedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_ServerClosedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Monitoring\ServerClosedEvent object handlers */ static zend_object_handlers php_phongo_handler_serverclosedevent; @@ -119,20 +107,12 @@ static HashTable* php_phongo_serverclosedevent_get_debug_info(phongo_compat_obje void php_phongo_serverclosedevent_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - (void) type; - (void) module_number; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "ServerClosedEvent", php_phongo_serverclosedevent_me); - php_phongo_serverclosedevent_ce = zend_register_internal_class(&ce); + php_phongo_serverclosedevent_ce = register_class_MongoDB_Driver_Monitoring_ServerClosedEvent(); php_phongo_serverclosedevent_ce->create_object = php_phongo_serverclosedevent_create_object; - PHONGO_CE_FINAL(php_phongo_serverclosedevent_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serverclosedevent_ce); memcpy(&php_phongo_handler_serverclosedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_serverclosedevent.get_debug_info = php_phongo_serverclosedevent_get_debug_info; php_phongo_handler_serverclosedevent.free_obj = php_phongo_serverclosedevent_free_object; php_phongo_handler_serverclosedevent.offset = XtOffsetOf(php_phongo_serverclosedevent_t, std); - - return; } /* }}} */ diff --git a/src/MongoDB/Monitoring/ServerClosedEvent.stub.php b/src/MongoDB/Monitoring/ServerClosedEvent.stub.php new file mode 100644 index 000000000..fbcaaabf6 --- /dev/null +++ b/src/MongoDB/Monitoring/ServerClosedEvent.stub.php @@ -0,0 +1,22 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.c b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.c index 7339839a1..ebacff2be 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.c +++ b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.c @@ -19,12 +19,16 @@ #include "php_phongo.h" #include "phongo_error.h" +#include "ServerHeartbeatFailedEvent_arginfo.h" zend_class_entry* php_phongo_serverheartbeatfailedevent_ce; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_Monitoring_ServerHeartbeatFailedEvent) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Monitoring_ServerHeartbeatFailedEvent) + /* {{{ proto integer ServerHeartbeatFailedEvent::getDurationMicros() Returns this event's duration in microseconds */ -static PHP_METHOD(ServerHeartbeatFailedEvent, getDurationMicros) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatFailedEvent, getDurationMicros) { php_phongo_serverheartbeatfailedevent_t* intern = Z_SERVERHEARTBEATFAILEDEVENT_OBJ_P(getThis()); @@ -35,7 +39,7 @@ static PHP_METHOD(ServerHeartbeatFailedEvent, getDurationMicros) /* {{{ proto Exception ServerHeartbeatFailedEvent::getError() Returns the error associated with the event */ -PHP_METHOD(ServerHeartbeatFailedEvent, getError) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatFailedEvent, getError) { php_phongo_serverheartbeatfailedevent_t* intern = Z_SERVERHEARTBEATFAILEDEVENT_OBJ_P(getThis()); @@ -46,7 +50,7 @@ PHP_METHOD(ServerHeartbeatFailedEvent, getError) /* {{{ proto string ServerHeartbeatFailedEvent::getHost() Returns this event's host */ -static PHP_METHOD(ServerHeartbeatFailedEvent, getHost) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatFailedEvent, getHost) { php_phongo_serverheartbeatfailedevent_t* intern = Z_SERVERHEARTBEATFAILEDEVENT_OBJ_P(getThis()); @@ -57,7 +61,7 @@ static PHP_METHOD(ServerHeartbeatFailedEvent, getHost) /* {{{ proto integer ServerHeartbeatFailedEvent::getPort() Returns this event's port */ -static PHP_METHOD(ServerHeartbeatFailedEvent, getPort) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatFailedEvent, getPort) { php_phongo_serverheartbeatfailedevent_t* intern = Z_SERVERHEARTBEATFAILEDEVENT_OBJ_P(getThis()); @@ -68,7 +72,7 @@ static PHP_METHOD(ServerHeartbeatFailedEvent, getPort) /* {{{ proto boolean ServerHeartbeatFailedEvent::isAwaited() Returns whether this event came from an awaitable hello */ -static PHP_METHOD(ServerHeartbeatFailedEvent, isAwaited) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatFailedEvent, isAwaited) { php_phongo_serverheartbeatfailedevent_t* intern = Z_SERVERHEARTBEATFAILEDEVENT_OBJ_P(getThis()); @@ -77,24 +81,6 @@ static PHP_METHOD(ServerHeartbeatFailedEvent, isAwaited) RETVAL_BOOL(intern->awaited); } /* }}} */ -/* {{{ MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_ServerHeartbeatFailedEvent_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_serverheartbeatfailedevent_me[] = { - /* clang-format off */ - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_ServerHeartbeatFailedEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_ME(ServerHeartbeatFailedEvent, getDurationMicros, ai_ServerHeartbeatFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerHeartbeatFailedEvent, getError, ai_ServerHeartbeatFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerHeartbeatFailedEvent, getHost, ai_ServerHeartbeatFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerHeartbeatFailedEvent, getPort, ai_ServerHeartbeatFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerHeartbeatFailedEvent, isAwaited, ai_ServerHeartbeatFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_ServerHeartbeatFailedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent object handlers */ static zend_object_handlers php_phongo_handler_serverheartbeatfailedevent; @@ -144,20 +130,12 @@ static HashTable* php_phongo_serverheartbeatfailedevent_get_debug_info(phongo_co void php_phongo_serverheartbeatfailedevent_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - (void) type; - (void) module_number; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "ServerHeartbeatFailedEvent", php_phongo_serverheartbeatfailedevent_me); - php_phongo_serverheartbeatfailedevent_ce = zend_register_internal_class(&ce); + php_phongo_serverheartbeatfailedevent_ce = register_class_MongoDB_Driver_Monitoring_ServerHeartbeatFailedEvent(); php_phongo_serverheartbeatfailedevent_ce->create_object = php_phongo_serverheartbeatfailedevent_create_object; - PHONGO_CE_FINAL(php_phongo_serverheartbeatfailedevent_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serverheartbeatfailedevent_ce); memcpy(&php_phongo_handler_serverheartbeatfailedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_serverheartbeatfailedevent.get_debug_info = php_phongo_serverheartbeatfailedevent_get_debug_info; php_phongo_handler_serverheartbeatfailedevent.free_obj = php_phongo_serverheartbeatfailedevent_free_object; php_phongo_handler_serverheartbeatfailedevent.offset = XtOffsetOf(php_phongo_serverheartbeatfailedevent_t, std); - - return; } /* }}} */ diff --git a/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.stub.php b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.stub.php new file mode 100644 index 000000000..caa212fe8 --- /dev/null +++ b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.stub.php @@ -0,0 +1,26 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.c b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.c index b2de5c86b..488c9a959 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.c +++ b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.c @@ -19,12 +19,16 @@ #include "php_phongo.h" #include "phongo_error.h" +#include "ServerHeartbeatStartedEvent_arginfo.h" zend_class_entry* php_phongo_serverheartbeatstartedevent_ce; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_Monitoring_ServerHeartbeatStartedEvent) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Monitoring_ServerHeartbeatStartedEvent) + /* {{{ proto string ServerHeartbeatStartedEvent::getHost() Returns this event's host */ -static PHP_METHOD(ServerHeartbeatStartedEvent, getHost) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatStartedEvent, getHost) { php_phongo_serverheartbeatstartedevent_t* intern = Z_SERVERHEARTBEATSTARTEDEVENT_OBJ_P(getThis()); @@ -35,7 +39,7 @@ static PHP_METHOD(ServerHeartbeatStartedEvent, getHost) /* {{{ proto integer ServerHeartbeatStartedEvent::getPort() Returns this event's port */ -static PHP_METHOD(ServerHeartbeatStartedEvent, getPort) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatStartedEvent, getPort) { php_phongo_serverheartbeatstartedevent_t* intern = Z_SERVERHEARTBEATSTARTEDEVENT_OBJ_P(getThis()); @@ -46,7 +50,7 @@ static PHP_METHOD(ServerHeartbeatStartedEvent, getPort) /* {{{ proto boolean ServerHeartbeatStartedEvent::isAwaited() Returns whether this event came from an awaitable hello */ -static PHP_METHOD(ServerHeartbeatStartedEvent, isAwaited) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatStartedEvent, isAwaited) { php_phongo_serverheartbeatstartedevent_t* intern = Z_SERVERHEARTBEATSTARTEDEVENT_OBJ_P(getThis()); @@ -55,22 +59,6 @@ static PHP_METHOD(ServerHeartbeatStartedEvent, isAwaited) RETVAL_BOOL(intern->awaited); } /* }}} */ -/* {{{ MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_ServerHeartbeatStartedEvent_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_serverheartbeatstartedevent_me[] = { - /* clang-format off */ - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_ServerHeartbeatStartedEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_ME(ServerHeartbeatStartedEvent, getHost, ai_ServerHeartbeatStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerHeartbeatStartedEvent, getPort, ai_ServerHeartbeatStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerHeartbeatStartedEvent, isAwaited, ai_ServerHeartbeatStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_ServerHeartbeatStartedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent object handlers */ static zend_object_handlers php_phongo_handler_serverheartbeatstartedevent; @@ -112,14 +100,8 @@ static HashTable* php_phongo_serverheartbeatstartedevent_get_debug_info(phongo_c void php_phongo_serverheartbeatstartedevent_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - (void) type; - (void) module_number; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "ServerHeartbeatStartedEvent", php_phongo_serverheartbeatstartedevent_me); - php_phongo_serverheartbeatstartedevent_ce = zend_register_internal_class(&ce); + php_phongo_serverheartbeatstartedevent_ce = register_class_MongoDB_Driver_Monitoring_ServerHeartbeatStartedEvent(); php_phongo_serverheartbeatstartedevent_ce->create_object = php_phongo_serverheartbeatstartedevent_create_object; - PHONGO_CE_FINAL(php_phongo_serverheartbeatstartedevent_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serverheartbeatstartedevent_ce); memcpy(&php_phongo_handler_serverheartbeatstartedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.stub.php b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.stub.php new file mode 100644 index 000000000..75153cf4d --- /dev/null +++ b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.stub.php @@ -0,0 +1,22 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.c b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.c index 405392a58..182d82085 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.c +++ b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.c @@ -19,12 +19,16 @@ #include "php_phongo.h" #include "phongo_error.h" +#include "ServerHeartbeatSucceededEvent_arginfo.h" zend_class_entry* php_phongo_serverheartbeatsucceededevent_ce; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_Monitoring_ServerHeartbeatSucceededEvent) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Monitoring_ServerHeartbeatSucceededEvent) + /* {{{ proto integer ServerHeartbeatSucceededEvent::getDurationMicros() Returns this event's duration in microseconds */ -static PHP_METHOD(ServerHeartbeatSucceededEvent, getDurationMicros) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatSucceededEvent, getDurationMicros) { php_phongo_serverheartbeatsucceededevent_t* intern = Z_SERVERHEARTBEATSUCCEEDEDEVENT_OBJ_P(getThis()); @@ -35,7 +39,7 @@ static PHP_METHOD(ServerHeartbeatSucceededEvent, getDurationMicros) /* {{{ proto string ServerHeartbeatSucceededEvent::getHost() Returns this event's host */ -static PHP_METHOD(ServerHeartbeatSucceededEvent, getHost) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatSucceededEvent, getHost) { php_phongo_serverheartbeatsucceededevent_t* intern = Z_SERVERHEARTBEATSUCCEEDEDEVENT_OBJ_P(getThis()); @@ -46,7 +50,7 @@ static PHP_METHOD(ServerHeartbeatSucceededEvent, getHost) /* {{{ proto integer ServerHeartbeatSucceededEvent::getPort() Returns this event's port */ -static PHP_METHOD(ServerHeartbeatSucceededEvent, getPort) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatSucceededEvent, getPort) { php_phongo_serverheartbeatsucceededevent_t* intern = Z_SERVERHEARTBEATSUCCEEDEDEVENT_OBJ_P(getThis()); @@ -57,7 +61,7 @@ static PHP_METHOD(ServerHeartbeatSucceededEvent, getPort) /* {{{ proto stdClass ServerHeartbeatSucceededEvent::getReply() Returns this event's reply */ -static PHP_METHOD(ServerHeartbeatSucceededEvent, getReply) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatSucceededEvent, getReply) { php_phongo_serverheartbeatsucceededevent_t* intern = Z_SERVERHEARTBEATSUCCEEDEDEVENT_OBJ_P(getThis()); php_phongo_bson_state state; @@ -76,7 +80,7 @@ static PHP_METHOD(ServerHeartbeatSucceededEvent, getReply) /* {{{ proto boolean ServerHeartbeatSucceededEvent::isAwaited() Returns whether this event came from an awaitable hello */ -static PHP_METHOD(ServerHeartbeatSucceededEvent, isAwaited) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerHeartbeatSucceededEvent, isAwaited) { php_phongo_serverheartbeatsucceededevent_t* intern = Z_SERVERHEARTBEATSUCCEEDEDEVENT_OBJ_P(getThis()); @@ -85,24 +89,6 @@ static PHP_METHOD(ServerHeartbeatSucceededEvent, isAwaited) RETVAL_BOOL(intern->awaited); } /* }}} */ -/* {{{ MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_ServerHeartbeatSucceededEvent_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_serverheartbeatsucceededevent_me[] = { - /* clang-format off */ - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_ServerHeartbeatSucceededEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_ME(ServerHeartbeatSucceededEvent, getDurationMicros, ai_ServerHeartbeatSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerHeartbeatSucceededEvent, getHost, ai_ServerHeartbeatSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerHeartbeatSucceededEvent, getPort, ai_ServerHeartbeatSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerHeartbeatSucceededEvent, getReply, ai_ServerHeartbeatSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerHeartbeatSucceededEvent, isAwaited, ai_ServerHeartbeatSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_ServerHeartbeatSucceededEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent object handlers */ static zend_object_handlers php_phongo_handler_serverheartbeatsucceededevent; @@ -159,14 +145,8 @@ static HashTable* php_phongo_serverheartbeatsucceededevent_get_debug_info(phongo void php_phongo_serverheartbeatsucceededevent_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - (void) type; - (void) module_number; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "ServerHeartbeatSucceededEvent", php_phongo_serverheartbeatsucceededevent_me); - php_phongo_serverheartbeatsucceededevent_ce = zend_register_internal_class(&ce); + php_phongo_serverheartbeatsucceededevent_ce = register_class_MongoDB_Driver_Monitoring_ServerHeartbeatSucceededEvent(); php_phongo_serverheartbeatsucceededevent_ce->create_object = php_phongo_serverheartbeatsucceededevent_create_object; - PHONGO_CE_FINAL(php_phongo_serverheartbeatsucceededevent_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serverheartbeatsucceededevent_ce); memcpy(&php_phongo_handler_serverheartbeatsucceededevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.stub.php b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.stub.php new file mode 100644 index 000000000..f7fa3bb77 --- /dev/null +++ b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.stub.php @@ -0,0 +1,26 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Monitoring/ServerOpeningEvent.c b/src/MongoDB/Monitoring/ServerOpeningEvent.c index c378c7223..e4c1a17ea 100644 --- a/src/MongoDB/Monitoring/ServerOpeningEvent.c +++ b/src/MongoDB/Monitoring/ServerOpeningEvent.c @@ -21,12 +21,16 @@ #include "phongo_error.h" #include "BSON/ObjectId.h" +#include "ServerOpeningEvent_arginfo.h" zend_class_entry* php_phongo_serveropeningevent_ce; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_Monitoring_ServerOpeningEvent) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Monitoring_ServerOpeningEvent) + /* {{{ proto string ServerOpeningEvent::getHost() Returns this event's host */ -static PHP_METHOD(ServerOpeningEvent, getHost) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerOpeningEvent, getHost) { php_phongo_serveropeningevent_t* intern = Z_SERVEROPENINGEVENT_OBJ_P(getThis()); @@ -37,7 +41,7 @@ static PHP_METHOD(ServerOpeningEvent, getHost) /* {{{ proto integer ServerOpeningEvent::getPort() Returns this event's port */ -static PHP_METHOD(ServerOpeningEvent, getPort) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerOpeningEvent, getPort) { php_phongo_serveropeningevent_t* intern = Z_SERVEROPENINGEVENT_OBJ_P(getThis()); @@ -48,7 +52,7 @@ static PHP_METHOD(ServerOpeningEvent, getPort) /* {{{ proto MongoDB\BSON\ObjectId ServerOpeningEvent::getTopologyId() Returns this event's topology id */ -static PHP_METHOD(ServerOpeningEvent, getTopologyId) +static PHP_METHOD(MongoDB_Driver_Monitoring_ServerOpeningEvent, getTopologyId) { php_phongo_serveropeningevent_t* intern = Z_SERVEROPENINGEVENT_OBJ_P(getThis()); @@ -57,22 +61,6 @@ static PHP_METHOD(ServerOpeningEvent, getTopologyId) phongo_objectid_init(return_value, &intern->topology_id); } /* }}} */ -/* {{{ MongoDB\Driver\Monitoring\ServerOpeningEvent function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_ServerOpeningEvent_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_serveropeningevent_me[] = { - /* clang-format off */ - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_ServerOpeningEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_ME(ServerOpeningEvent, getHost, ai_ServerOpeningEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerOpeningEvent, getPort, ai_ServerOpeningEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerOpeningEvent, getTopologyId, ai_ServerOpeningEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_ServerOpeningEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Monitoring\ServerOpeningEvent object handlers */ static zend_object_handlers php_phongo_handler_serveropeningevent; @@ -119,20 +107,12 @@ static HashTable* php_phongo_serveropeningevent_get_debug_info(phongo_compat_obj void php_phongo_serveropeningevent_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - (void) type; - (void) module_number; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "ServerOpeningEvent", php_phongo_serveropeningevent_me); - php_phongo_serveropeningevent_ce = zend_register_internal_class(&ce); + php_phongo_serveropeningevent_ce = register_class_MongoDB_Driver_Monitoring_ServerOpeningEvent(); php_phongo_serveropeningevent_ce->create_object = php_phongo_serveropeningevent_create_object; - PHONGO_CE_FINAL(php_phongo_serveropeningevent_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serveropeningevent_ce); memcpy(&php_phongo_handler_serveropeningevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_serveropeningevent.get_debug_info = php_phongo_serveropeningevent_get_debug_info; php_phongo_handler_serveropeningevent.free_obj = php_phongo_serveropeningevent_free_object; php_phongo_handler_serveropeningevent.offset = XtOffsetOf(php_phongo_serveropeningevent_t, std); - - return; } /* }}} */ diff --git a/src/MongoDB/Monitoring/ServerOpeningEvent.stub.php b/src/MongoDB/Monitoring/ServerOpeningEvent.stub.php new file mode 100644 index 000000000..b32facb8a --- /dev/null +++ b/src/MongoDB/Monitoring/ServerOpeningEvent.stub.php @@ -0,0 +1,22 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Monitoring/Subscriber.c b/src/MongoDB/Monitoring/Subscriber.c index 54005f798..89b659c0b 100644 --- a/src/MongoDB/Monitoring/Subscriber.c +++ b/src/MongoDB/Monitoring/Subscriber.c @@ -17,23 +17,11 @@ #include #include "php_phongo.h" +#include "Subscriber_arginfo.h" zend_class_entry* php_phongo_subscriber_ce; -/* {{{ MongoDB\Driver\Monitoring\Subscriber function entries */ -static zend_function_entry php_phongo_subscriber_me[] = { - PHP_FE_END -}; -/* }}} */ - void php_phongo_subscriber_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - (void) type; - (void) module_number; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "Subscriber", php_phongo_subscriber_me); - php_phongo_subscriber_ce = zend_register_internal_interface(&ce); - - return; + php_phongo_subscriber_ce = register_class_MongoDB_Driver_Monitoring_Subscriber(); } /* }}} */ diff --git a/src/MongoDB/Monitoring/Subscriber.stub.php b/src/MongoDB/Monitoring/Subscriber.stub.php new file mode 100644 index 000000000..9a0052012 --- /dev/null +++ b/src/MongoDB/Monitoring/Subscriber.stub.php @@ -0,0 +1,13 @@ +topology_id); } /* }}} */ -/* {{{ MongoDB\Driver\Monitoring\TopologyChangedEvent function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_TopologyChangedEvent_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_topologychangedevent_me[] = { - /* clang-format off */ - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_TopologyChangedEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_ME(TopologyChangedEvent, getNewDescription, ai_TopologyChangedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(TopologyChangedEvent, getPreviousDescription, ai_TopologyChangedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(TopologyChangedEvent, getTopologyId, ai_TopologyChangedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_TopologyChangedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Monitoring\TopologyChangedEvent object handlers */ static zend_object_handlers php_phongo_handler_topologychangedevent; @@ -139,12 +127,8 @@ static HashTable* php_phongo_topologychangedevent_get_debug_info(phongo_compat_o void php_phongo_topologychangedevent_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "TopologyChangedEvent", php_phongo_topologychangedevent_me); - php_phongo_topologychangedevent_ce = zend_register_internal_class(&ce); + php_phongo_topologychangedevent_ce = register_class_MongoDB_Driver_Monitoring_TopologyChangedEvent(); php_phongo_topologychangedevent_ce->create_object = php_phongo_topologychangedevent_create_object; - PHONGO_CE_FINAL(php_phongo_topologychangedevent_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_topologychangedevent_ce); memcpy(&php_phongo_handler_topologychangedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/Monitoring/TopologyChangedEvent.stub.php b/src/MongoDB/Monitoring/TopologyChangedEvent.stub.php new file mode 100644 index 000000000..04fb950b7 --- /dev/null +++ b/src/MongoDB/Monitoring/TopologyChangedEvent.stub.php @@ -0,0 +1,22 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Monitoring/TopologyClosedEvent.c b/src/MongoDB/Monitoring/TopologyClosedEvent.c index dd4f18bb2..716e70a7a 100644 --- a/src/MongoDB/Monitoring/TopologyClosedEvent.c +++ b/src/MongoDB/Monitoring/TopologyClosedEvent.c @@ -21,12 +21,16 @@ #include "phongo_error.h" #include "BSON/ObjectId.h" +#include "TopologyClosedEvent_arginfo.h" zend_class_entry* php_phongo_topologyclosedevent_ce; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_Monitoring_TopologyClosedEvent) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Monitoring_TopologyClosedEvent) + /* {{{ proto MongoDB\BSON\ObjectId TopologyClosedEvent::getTopologyId() Returns this event's topology id */ -static PHP_METHOD(TopologyClosedEvent, getTopologyId) +static PHP_METHOD(MongoDB_Driver_Monitoring_TopologyClosedEvent, getTopologyId) { php_phongo_topologyclosedevent_t* intern = Z_TOPOLOGYCLOSEDEVENT_OBJ_P(getThis()); @@ -35,20 +39,6 @@ static PHP_METHOD(TopologyClosedEvent, getTopologyId) phongo_objectid_init(return_value, &intern->topology_id); } /* }}} */ -/* {{{ MongoDB\Driver\Monitoring\TopologyClosedEvent function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_TopologyClosedEvent_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_topologyclosedevent_me[] = { - /* clang-format off */ - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_TopologyClosedEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_ME(TopologyClosedEvent, getTopologyId, ai_TopologyClosedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_TopologyClosedEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Monitoring\TopologyClosedEvent object handlers */ static zend_object_handlers php_phongo_handler_topologyclosedevent; @@ -92,12 +82,8 @@ static HashTable* php_phongo_topologyclosedevent_get_debug_info(phongo_compat_ob void php_phongo_topologyclosedevent_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "TopologyClosedEvent", php_phongo_topologyclosedevent_me); - php_phongo_topologyclosedevent_ce = zend_register_internal_class(&ce); + php_phongo_topologyclosedevent_ce = register_class_MongoDB_Driver_Monitoring_TopologyClosedEvent(); php_phongo_topologyclosedevent_ce->create_object = php_phongo_topologyclosedevent_create_object; - PHONGO_CE_FINAL(php_phongo_topologyclosedevent_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_topologyclosedevent_ce); memcpy(&php_phongo_handler_topologyclosedevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/Monitoring/TopologyClosedEvent.stub.php b/src/MongoDB/Monitoring/TopologyClosedEvent.stub.php new file mode 100644 index 000000000..93f4dc596 --- /dev/null +++ b/src/MongoDB/Monitoring/TopologyClosedEvent.stub.php @@ -0,0 +1,18 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Monitoring/TopologyOpeningEvent.c b/src/MongoDB/Monitoring/TopologyOpeningEvent.c index db1315b56..22f345027 100644 --- a/src/MongoDB/Monitoring/TopologyOpeningEvent.c +++ b/src/MongoDB/Monitoring/TopologyOpeningEvent.c @@ -21,12 +21,16 @@ #include "phongo_error.h" #include "BSON/ObjectId.h" +#include "TopologyOpeningEvent_arginfo.h" zend_class_entry* php_phongo_topologyopeningevent_ce; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_Monitoring_TopologyOpeningEvent) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Monitoring_TopologyOpeningEvent) + /* {{{ proto MongoDB\BSON\ObjectId TopologyOpeningEvent::getTopologyId() Returns this event's topology id */ -static PHP_METHOD(TopologyOpeningEvent, getTopologyId) +static PHP_METHOD(MongoDB_Driver_Monitoring_TopologyOpeningEvent, getTopologyId) { php_phongo_topologyopeningevent_t* intern = Z_TOPOLOGYOPENINGEVENT_OBJ_P(getThis()); @@ -35,20 +39,6 @@ static PHP_METHOD(TopologyOpeningEvent, getTopologyId) phongo_objectid_init(return_value, &intern->topology_id); } /* }}} */ -/* {{{ MongoDB\Driver\Monitoring\TopologyOpeningEvent function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_TopologyOpeningEvent_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_topologyopeningevent_me[] = { - /* clang-format off */ - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_TopologyOpeningEvent_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_ME(TopologyOpeningEvent, getTopologyId, ai_TopologyOpeningEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_TopologyOpeningEvent_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Monitoring\TopologyOpeningEvent object handlers */ static zend_object_handlers php_phongo_handler_topologyopeningevent; @@ -92,12 +82,8 @@ static HashTable* php_phongo_topologyopeningevent_get_debug_info(phongo_compat_o void php_phongo_topologyopeningevent_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver\\Monitoring", "TopologyOpeningEvent", php_phongo_topologyopeningevent_me); - php_phongo_topologyopeningevent_ce = zend_register_internal_class(&ce); + php_phongo_topologyopeningevent_ce = register_class_MongoDB_Driver_Monitoring_TopologyOpeningEvent(); php_phongo_topologyopeningevent_ce->create_object = php_phongo_topologyopeningevent_create_object; - PHONGO_CE_FINAL(php_phongo_topologyopeningevent_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_topologyopeningevent_ce); memcpy(&php_phongo_handler_topologyopeningevent, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/Monitoring/TopologyOpeningEvent.stub.php b/src/MongoDB/Monitoring/TopologyOpeningEvent.stub.php new file mode 100644 index 000000000..3cdcb3c06 --- /dev/null +++ b/src/MongoDB/Monitoring/TopologyOpeningEvent.stub.php @@ -0,0 +1,18 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} From 0743d33945e1c1f675156bba5cdc1a8e92f0b078 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Wed, 27 Jul 2022 16:04:47 +0200 Subject: [PATCH 10/26] Fix wrong JsonSerializable class in BSON stubs --- src/BSON/Binary.stub.php | 2 +- src/BSON/Binary_arginfo.h | 6 +++--- src/BSON/DBPointer.stub.php | 2 +- src/BSON/DBPointer_arginfo.h | 6 +++--- src/BSON/Decimal128.stub.php | 2 +- src/BSON/Decimal128_arginfo.h | 6 +++--- src/BSON/Int64.stub.php | 2 +- src/BSON/Int64_arginfo.h | 6 +++--- src/BSON/Javascript.stub.php | 2 +- src/BSON/Javascript_arginfo.h | 6 +++--- src/BSON/MaxKey.stub.php | 2 +- src/BSON/MaxKey_arginfo.h | 6 +++--- src/BSON/MinKey.stub.php | 2 +- src/BSON/MinKey_arginfo.h | 6 +++--- src/BSON/ObjectId.stub.php | 2 +- src/BSON/ObjectId_arginfo.h | 6 +++--- src/BSON/Regex.stub.php | 2 +- src/BSON/Regex_arginfo.h | 6 +++--- src/BSON/Symbol.stub.php | 2 +- src/BSON/Symbol_arginfo.h | 6 +++--- src/BSON/Timestamp.stub.php | 2 +- src/BSON/Timestamp_arginfo.h | 6 +++--- src/BSON/UTCDateTime.stub.php | 2 +- src/BSON/UTCDateTime_arginfo.h | 6 +++--- src/BSON/Undefined.stub.php | 2 +- src/BSON/Undefined_arginfo.h | 6 +++--- 26 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/BSON/Binary.stub.php b/src/BSON/Binary.stub.php index 407260340..1fee479ef 100644 --- a/src/BSON/Binary.stub.php +++ b/src/BSON/Binary.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON { - final class Binary implements BinaryInterface, JsonSerializable, Type, \Serializable + final class Binary implements BinaryInterface, \JsonSerializable, Type, \Serializable { /** * @var int diff --git a/src/BSON/Binary_arginfo.h b/src/BSON/Binary_arginfo.h index 8b217acbc..a51d819a1 100644 --- a/src/BSON/Binary_arginfo.h +++ b/src/BSON/Binary_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: f39a96c515f56320c10cf27cdd6d94b008bfaf13 */ + * Stub hash: 068e51189d6dcd1e5ff0a50d0f0195b0a93f36da */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Binary___construct, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) @@ -78,14 +78,14 @@ static const zend_function_entry class_MongoDB_BSON_Binary_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Binary(zend_class_entry *class_entry_MongoDB_BSON_BinaryInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Binary(zend_class_entry *class_entry_MongoDB_BSON_BinaryInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Binary", class_MongoDB_BSON_Binary_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_BinaryInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_BinaryInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); zval const_TYPE_GENERIC_value; ZVAL_LONG(&const_TYPE_GENERIC_value, BSON_SUBTYPE_BINARY); diff --git a/src/BSON/DBPointer.stub.php b/src/BSON/DBPointer.stub.php index 1a72e3266..4bfa12fd7 100644 --- a/src/BSON/DBPointer.stub.php +++ b/src/BSON/DBPointer.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON { - final class DBPointer implements JsonSerializable, Type, \Serializable + final class DBPointer implements \JsonSerializable, Type, \Serializable { final private function __construct() {} diff --git a/src/BSON/DBPointer_arginfo.h b/src/BSON/DBPointer_arginfo.h index e0dd45a35..577fa4616 100644 --- a/src/BSON/DBPointer_arginfo.h +++ b/src/BSON/DBPointer_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: a94ec01497f3774574d202f16e68ef2f8b82a78d */ + * Stub hash: 9f87f398d061bfa61312f34693a7e1a47a6803d5 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_DBPointer___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -61,14 +61,14 @@ static const zend_function_entry class_MongoDB_BSON_DBPointer_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_DBPointer(zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_DBPointer(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "DBPointer", class_MongoDB_BSON_DBPointer_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 3, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 3, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); return class_entry; } diff --git a/src/BSON/Decimal128.stub.php b/src/BSON/Decimal128.stub.php index 5a9f5b918..52be3e7d0 100644 --- a/src/BSON/Decimal128.stub.php +++ b/src/BSON/Decimal128.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON { - final class Decimal128 implements Decimal128Interface, JsonSerializable, Type, \Serializable + final class Decimal128 implements Decimal128Interface, \JsonSerializable, Type, \Serializable { final public function __construct(string $value = '') {} diff --git a/src/BSON/Decimal128_arginfo.h b/src/BSON/Decimal128_arginfo.h index 471144c86..ccca807db 100644 --- a/src/BSON/Decimal128_arginfo.h +++ b/src/BSON/Decimal128_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 4c1e3632473dbcaefb87254e586aa38be2a080b1 */ + * Stub hash: db92ad0b12a6766c9d1fd5591e296f1686b4f613 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Decimal128___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, value, IS_STRING, 0, "\'\'") @@ -68,14 +68,14 @@ static const zend_function_entry class_MongoDB_BSON_Decimal128_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Decimal128(zend_class_entry *class_entry_MongoDB_BSON_Decimal128Interface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Decimal128(zend_class_entry *class_entry_MongoDB_BSON_Decimal128Interface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Decimal128", class_MongoDB_BSON_Decimal128_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_Decimal128Interface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_Decimal128Interface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); return class_entry; } diff --git a/src/BSON/Int64.stub.php b/src/BSON/Int64.stub.php index 7a5ccd937..487f9b7af 100644 --- a/src/BSON/Int64.stub.php +++ b/src/BSON/Int64.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON { - final class Int64 implements JsonSerializable, Type, \Serializable + final class Int64 implements \JsonSerializable, Type, \Serializable { private final function __construct() {} diff --git a/src/BSON/Int64_arginfo.h b/src/BSON/Int64_arginfo.h index c9a4dee42..c8d00fef3 100644 --- a/src/BSON/Int64_arginfo.h +++ b/src/BSON/Int64_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 2196fd5c38e59b30587dc65cb69dba383754fc3e */ + * Stub hash: c6215d669e84919bca49dc8a770c29037cb390d5 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Int64___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -61,14 +61,14 @@ static const zend_function_entry class_MongoDB_BSON_Int64_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Int64(zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Int64(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Int64", class_MongoDB_BSON_Int64_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 3, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 3, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); return class_entry; } diff --git a/src/BSON/Javascript.stub.php b/src/BSON/Javascript.stub.php index b9cfa2b4c..decbfecfa 100644 --- a/src/BSON/Javascript.stub.php +++ b/src/BSON/Javascript.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON { - final class Javascript implements JavascriptInterface, JsonSerializable, Type, \Serializable + final class Javascript implements JavascriptInterface, \JsonSerializable, Type, \Serializable { #if PHP_VERSION_ID >= 80000 final public function __construct(string $code, array|object|null $scope = null) {} diff --git a/src/BSON/Javascript_arginfo.h b/src/BSON/Javascript_arginfo.h index a1ac15ef1..bb659582d 100644 --- a/src/BSON/Javascript_arginfo.h +++ b/src/BSON/Javascript_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c74b5558cce763493ae3164f170341049aa0d983 */ + * Stub hash: a9028fe55d0bc6cdbfeec5007ce13cbc1887435a */ #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Javascript___construct, 0, 0, 1) @@ -97,14 +97,14 @@ static const zend_function_entry class_MongoDB_BSON_Javascript_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Javascript(zend_class_entry *class_entry_MongoDB_BSON_JavascriptInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Javascript(zend_class_entry *class_entry_MongoDB_BSON_JavascriptInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Javascript", class_MongoDB_BSON_Javascript_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_JavascriptInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_JavascriptInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); return class_entry; } diff --git a/src/BSON/MaxKey.stub.php b/src/BSON/MaxKey.stub.php index 9125c1b6b..ac17bfd51 100644 --- a/src/BSON/MaxKey.stub.php +++ b/src/BSON/MaxKey.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON { - final class MaxKey implements MaxKeyInterface, JsonSerializable, Type, \Serializable + final class MaxKey implements MaxKeyInterface, \JsonSerializable, Type, \Serializable { public static function __set_state(array $properties): MaxKey {} diff --git a/src/BSON/MaxKey_arginfo.h b/src/BSON/MaxKey_arginfo.h index 6334f43b6..d493d2aa4 100644 --- a/src/BSON/MaxKey_arginfo.h +++ b/src/BSON/MaxKey_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 2579462a1a642d39121225a30e4ef68c08678b2b */ + * Stub hash: a68f1540c10abe02af741956e530794ee69aa027 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_MaxKey___set_state, 0, 1, MongoDB\\BSON\\MaxKey, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) @@ -58,14 +58,14 @@ static const zend_function_entry class_MongoDB_BSON_MaxKey_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_MaxKey(zend_class_entry *class_entry_MongoDB_BSON_MaxKeyInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_MaxKey(zend_class_entry *class_entry_MongoDB_BSON_MaxKeyInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MaxKey", class_MongoDB_BSON_MaxKey_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_MaxKeyInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_MaxKeyInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); return class_entry; } diff --git a/src/BSON/MinKey.stub.php b/src/BSON/MinKey.stub.php index 001902412..514f640a5 100644 --- a/src/BSON/MinKey.stub.php +++ b/src/BSON/MinKey.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON { - final class MinKey implements MinKeyInterface, JsonSerializable, Type, \Serializable + final class MinKey implements MinKeyInterface, \JsonSerializable, Type, \Serializable { public static function __set_state(array $properties): MinKey {} diff --git a/src/BSON/MinKey_arginfo.h b/src/BSON/MinKey_arginfo.h index af3d70368..c74ec7b52 100644 --- a/src/BSON/MinKey_arginfo.h +++ b/src/BSON/MinKey_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ccbe52d22d2b051ce0f99e42054f45b0127f0327 */ + * Stub hash: 8f749d167d9e76d878732d4df179c930fc3b70e6 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_BSON_MinKey___set_state, 0, 1, MongoDB\\BSON\\MinKey, 0) ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) @@ -58,14 +58,14 @@ static const zend_function_entry class_MongoDB_BSON_MinKey_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_MinKey(zend_class_entry *class_entry_MongoDB_BSON_MinKeyInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_MinKey(zend_class_entry *class_entry_MongoDB_BSON_MinKeyInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "MinKey", class_MongoDB_BSON_MinKey_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_MinKeyInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_MinKeyInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); return class_entry; } diff --git a/src/BSON/ObjectId.stub.php b/src/BSON/ObjectId.stub.php index 763f30428..ededaa840 100644 --- a/src/BSON/ObjectId.stub.php +++ b/src/BSON/ObjectId.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON { - final class ObjectId implements ObjectIdInterface, JsonSerializable, Type, \Serializable + final class ObjectId implements ObjectIdInterface, \JsonSerializable, Type, \Serializable { public final function __construct(?string $id = null) {} diff --git a/src/BSON/ObjectId_arginfo.h b/src/BSON/ObjectId_arginfo.h index bb0a18e69..f691d14aa 100644 --- a/src/BSON/ObjectId_arginfo.h +++ b/src/BSON/ObjectId_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 733a20286e57b618c91ff0b12cc5bf8110df458f */ + * Stub hash: 9a0fe843331b06e904cd938cf1240bd527fd93a0 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_ObjectId___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, id, IS_STRING, 1, "null") @@ -73,14 +73,14 @@ static const zend_function_entry class_MongoDB_BSON_ObjectId_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_ObjectId(zend_class_entry *class_entry_MongoDB_BSON_ObjectIdInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_ObjectId(zend_class_entry *class_entry_MongoDB_BSON_ObjectIdInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "ObjectId", class_MongoDB_BSON_ObjectId_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_ObjectIdInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_ObjectIdInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); return class_entry; } diff --git a/src/BSON/Regex.stub.php b/src/BSON/Regex.stub.php index fa58b61a4..f37dbf64c 100644 --- a/src/BSON/Regex.stub.php +++ b/src/BSON/Regex.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON { - final class Regex implements RegexInterface, JsonSerializable, Type, \Serializable + final class Regex implements RegexInterface, \JsonSerializable, Type, \Serializable { public final function __construct(string $pattern, string $flags = '') {} diff --git a/src/BSON/Regex_arginfo.h b/src/BSON/Regex_arginfo.h index 84a95d447..867506ae5 100644 --- a/src/BSON/Regex_arginfo.h +++ b/src/BSON/Regex_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ffb74d37076682939a327888c60d4d401f32e49d */ + * Stub hash: f6764f122c47c9071ba8fce92e46ba862f695a4e */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Regex___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0) @@ -77,14 +77,14 @@ static const zend_function_entry class_MongoDB_BSON_Regex_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Regex(zend_class_entry *class_entry_MongoDB_BSON_RegexInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Regex(zend_class_entry *class_entry_MongoDB_BSON_RegexInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Regex", class_MongoDB_BSON_Regex_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_RegexInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_RegexInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); return class_entry; } diff --git a/src/BSON/Symbol.stub.php b/src/BSON/Symbol.stub.php index 180acd14c..278aa5b23 100644 --- a/src/BSON/Symbol.stub.php +++ b/src/BSON/Symbol.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON { - final class Symbol implements JsonSerializable, Type, \Serializable + final class Symbol implements \JsonSerializable, Type, \Serializable { final private function __construct() {} diff --git a/src/BSON/Symbol_arginfo.h b/src/BSON/Symbol_arginfo.h index 04adbdca0..eaac6d630 100644 --- a/src/BSON/Symbol_arginfo.h +++ b/src/BSON/Symbol_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: fd3ecf7c374f749c81ec20ee048f0622979c697b */ + * Stub hash: 2e833687b33ec7a6e25da5be58d2a483b63bac18 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Symbol___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -61,14 +61,14 @@ static const zend_function_entry class_MongoDB_BSON_Symbol_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Symbol(zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Symbol(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Symbol", class_MongoDB_BSON_Symbol_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 3, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 3, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); return class_entry; } diff --git a/src/BSON/Timestamp.stub.php b/src/BSON/Timestamp.stub.php index 0f81e3c7b..2b99a13d4 100644 --- a/src/BSON/Timestamp.stub.php +++ b/src/BSON/Timestamp.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON { - final class Timestamp implements TimestampInterface, JsonSerializable, Type, \Serializable + final class Timestamp implements TimestampInterface, \JsonSerializable, Type, \Serializable { #if PHP_VERSION_ID >= 80000 public final function __construct(int|string $increment, int|string $timestamp) {} diff --git a/src/BSON/Timestamp_arginfo.h b/src/BSON/Timestamp_arginfo.h index 3b2018427..799d6ae48 100644 --- a/src/BSON/Timestamp_arginfo.h +++ b/src/BSON/Timestamp_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ec5da53824d120685c74e74221e919dba39bc0f3 */ + * Stub hash: 3937f3fb9265b88474d71408bf3dc5323054a743 */ #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Timestamp___construct, 0, 0, 2) @@ -97,14 +97,14 @@ static const zend_function_entry class_MongoDB_BSON_Timestamp_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Timestamp(zend_class_entry *class_entry_MongoDB_BSON_TimestampInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Timestamp(zend_class_entry *class_entry_MongoDB_BSON_TimestampInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Timestamp", class_MongoDB_BSON_Timestamp_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_TimestampInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_TimestampInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); return class_entry; } diff --git a/src/BSON/UTCDateTime.stub.php b/src/BSON/UTCDateTime.stub.php index 264d0aba0..4a856952a 100644 --- a/src/BSON/UTCDateTime.stub.php +++ b/src/BSON/UTCDateTime.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON { - final class UTCDateTime implements UTCDateTimeInterface, JsonSerializable, Type, \Serializable + final class UTCDateTime implements UTCDateTimeInterface, \JsonSerializable, Type, \Serializable { #if PHP_VERSION_ID >= 80000 public final function __construct(int|string|float|\DateTime|\DateTimeImmutable|null $milliseconds = null) {} diff --git a/src/BSON/UTCDateTime_arginfo.h b/src/BSON/UTCDateTime_arginfo.h index 541022d86..0a3bd1be7 100644 --- a/src/BSON/UTCDateTime_arginfo.h +++ b/src/BSON/UTCDateTime_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 20b80ad0636d3d0726362f2183eceb560c169f4c */ + * Stub hash: dede7bbc4a90386a2fe9b891d1c3c7f1d19d4de9 */ #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___construct, 0, 0, 0) @@ -91,14 +91,14 @@ static const zend_function_entry class_MongoDB_BSON_UTCDateTime_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_UTCDateTime(zend_class_entry *class_entry_MongoDB_BSON_UTCDateTimeInterface, zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_UTCDateTime(zend_class_entry *class_entry_MongoDB_BSON_UTCDateTimeInterface, zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "UTCDateTime", class_MongoDB_BSON_UTCDateTime_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_UTCDateTimeInterface, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 4, class_entry_MongoDB_BSON_UTCDateTimeInterface, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); return class_entry; } diff --git a/src/BSON/Undefined.stub.php b/src/BSON/Undefined.stub.php index 6399a897a..b70ea012a 100644 --- a/src/BSON/Undefined.stub.php +++ b/src/BSON/Undefined.stub.php @@ -7,7 +7,7 @@ namespace MongoDB\BSON { - final class Undefined implements JsonSerializable, Type, \Serializable + final class Undefined implements \JsonSerializable, Type, \Serializable { final private function __construct() {} diff --git a/src/BSON/Undefined_arginfo.h b/src/BSON/Undefined_arginfo.h index 4b851ef92..451ddcd4e 100644 --- a/src/BSON/Undefined_arginfo.h +++ b/src/BSON/Undefined_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 1cc6cb289e6976eb093f98a98ed0a2b5c11ee098 */ + * Stub hash: 25ffea1990a4c900470860c9fe80eccbbc05df39 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_Undefined___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -61,14 +61,14 @@ static const zend_function_entry class_MongoDB_BSON_Undefined_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_MongoDB_BSON_Undefined(zend_class_entry *class_entry_MongoDB_BSON_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) +static zend_class_entry *register_class_MongoDB_BSON_Undefined(zend_class_entry *class_entry_JsonSerializable, zend_class_entry *class_entry_MongoDB_BSON_Type, zend_class_entry *class_entry_Serializable) { zend_class_entry ce, *class_entry; INIT_NS_CLASS_ENTRY(ce, "MongoDB\\BSON", "Undefined", class_MongoDB_BSON_Undefined_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL; - zend_class_implements(class_entry, 3, class_entry_MongoDB_BSON_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); + zend_class_implements(class_entry, 3, class_entry_JsonSerializable, class_entry_MongoDB_BSON_Type, class_entry_Serializable); return class_entry; } From 6a32dfbc74f6c55d597bf1f7eb38aca31e644da8 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Thu, 28 Jul 2022 08:17:07 +0200 Subject: [PATCH 11/26] Disable declaration-after-statement This is necessary to let the generated arginfo files compile --- config.m4 | 1 - 1 file changed, 1 deletion(-) diff --git a/config.m4 b/config.m4 index 454f57c05..aca144bd1 100644 --- a/config.m4 +++ b/config.m4 @@ -66,7 +66,6 @@ if test "$PHP_MONGODB" != "no"; then AX_CHECK_COMPILE_FLAG(-Wenum-compare, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wenum-compare" ,, -Werror) AX_CHECK_COMPILE_FLAG(-Wempty-body, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wempty-body" ,, -Werror) AX_CHECK_COMPILE_FLAG(-Wparentheses, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wparentheses" ,, -Werror) - AX_CHECK_COMPILE_FLAG(-Wdeclaration-after-statement, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wdeclaration-after-statement" ,, -Werror) AX_CHECK_COMPILE_FLAG(-Wmaybe-uninitialized, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wmaybe-uninitialized" ,, -Werror) AX_CHECK_COMPILE_FLAG(-Wimplicit-fallthrough, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wimplicit-fallthrough" ,, -Werror) AX_CHECK_COMPILE_FLAG(-Werror, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Werror" ,, -Werror) From 71644db55b8dee39464490d6b63bf1d681a9e36e Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Thu, 28 Jul 2022 10:46:03 +0200 Subject: [PATCH 12/26] Use stubs for driver classes --- src/MongoDB/BulkWrite.c | 58 +---- src/MongoDB/BulkWrite.stub.php | 39 ++++ src/MongoDB/BulkWrite_arginfo.h | 110 ++++++++++ src/MongoDB/ClientEncryption.c | 54 +---- src/MongoDB/ClientEncryption.stub.php | 58 +++++ src/MongoDB/ClientEncryption_arginfo.h | 118 +++++++++++ src/MongoDB/Command.c | 27 +-- src/MongoDB/Command.stub.php | 19 ++ src/MongoDB/Command_arginfo.h | 46 ++++ src/MongoDB/Cursor.c | 75 ++----- src/MongoDB/Cursor.stub.php | 39 ++++ src/MongoDB/CursorId.c | 54 +---- src/MongoDB/CursorId.stub.php | 27 +++ src/MongoDB/CursorId_arginfo.h | 58 +++++ src/MongoDB/CursorInterface.c | 28 +-- src/MongoDB/CursorInterface.stub.php | 27 +++ src/MongoDB/CursorInterface_arginfo.h | 41 ++++ src/MongoDB/Cursor_arginfo.h | 92 ++++++++ src/MongoDB/Manager.c | 124 ++--------- src/MongoDB/Manager.stub.php | 64 ++++++ src/MongoDB/Manager_arginfo.h | 203 ++++++++++++++++++ src/MongoDB/Query.c | 29 +-- src/MongoDB/Query.stub.php | 21 ++ src/MongoDB/Query_arginfo.h | 51 +++++ src/MongoDB/ReadConcern.c | 70 +------ src/MongoDB/ReadConcern.stub.php | 67 ++++++ src/MongoDB/ReadConcern_arginfo.h | 122 +++++++++++ src/MongoDB/ReadPreference.c | 95 ++------- src/MongoDB/ReadPreference.h | 6 + src/MongoDB/ReadPreference.stub.php | 119 +++++++++++ src/MongoDB/ReadPreference_arginfo.h | 198 ++++++++++++++++++ src/MongoDB/Server.c | 112 ++-------- src/MongoDB/Server.stub.php | 123 +++++++++++ src/MongoDB/ServerApi.c | 66 +----- src/MongoDB/ServerApi.stub.php | 35 ++++ src/MongoDB/ServerApi_arginfo.h | 86 ++++++++ src/MongoDB/ServerDescription.c | 63 +----- src/MongoDB/ServerDescription.h | 13 ++ src/MongoDB/ServerDescription.stub.php | 86 ++++++++ src/MongoDB/ServerDescription_arginfo.h | 123 +++++++++++ src/MongoDB/Server_arginfo.h | 244 ++++++++++++++++++++++ src/MongoDB/Session.c | 89 ++------ src/MongoDB/Session.h | 6 + src/MongoDB/Session.stub.php | 79 +++++++ src/MongoDB/Session_arginfo.h | 152 ++++++++++++++ src/MongoDB/TopologyDescription.c | 51 +---- src/MongoDB/TopologyDescription.h | 9 + src/MongoDB/TopologyDescription.stub.php | 58 +++++ src/MongoDB/TopologyDescription_arginfo.h | 88 ++++++++ src/MongoDB/WriteConcern.c | 74 ++----- src/MongoDB/WriteConcern.stub.php | 57 +++++ src/MongoDB/WriteConcernError.c | 32 +-- src/MongoDB/WriteConcernError.stub.php | 22 ++ src/MongoDB/WriteConcernError_arginfo.h | 45 ++++ src/MongoDB/WriteConcern_arginfo.h | 142 +++++++++++++ src/MongoDB/WriteError.c | 35 +--- src/MongoDB/WriteError.stub.php | 24 +++ src/MongoDB/WriteError_arginfo.h | 49 +++++ src/MongoDB/WriteResult.c | 53 ++--- src/MongoDB/WriteResult.stub.php | 36 ++++ src/MongoDB/WriteResult_arginfo.h | 75 +++++++ 61 files changed, 3286 insertions(+), 980 deletions(-) create mode 100644 src/MongoDB/BulkWrite.stub.php create mode 100644 src/MongoDB/BulkWrite_arginfo.h create mode 100644 src/MongoDB/ClientEncryption.stub.php create mode 100644 src/MongoDB/ClientEncryption_arginfo.h create mode 100644 src/MongoDB/Command.stub.php create mode 100644 src/MongoDB/Command_arginfo.h create mode 100644 src/MongoDB/Cursor.stub.php create mode 100644 src/MongoDB/CursorId.stub.php create mode 100644 src/MongoDB/CursorId_arginfo.h create mode 100644 src/MongoDB/CursorInterface.stub.php create mode 100644 src/MongoDB/CursorInterface_arginfo.h create mode 100644 src/MongoDB/Cursor_arginfo.h create mode 100644 src/MongoDB/Manager.stub.php create mode 100644 src/MongoDB/Manager_arginfo.h create mode 100644 src/MongoDB/Query.stub.php create mode 100644 src/MongoDB/Query_arginfo.h create mode 100644 src/MongoDB/ReadConcern.stub.php create mode 100644 src/MongoDB/ReadConcern_arginfo.h create mode 100644 src/MongoDB/ReadPreference.stub.php create mode 100644 src/MongoDB/ReadPreference_arginfo.h create mode 100644 src/MongoDB/Server.stub.php create mode 100644 src/MongoDB/ServerApi.stub.php create mode 100644 src/MongoDB/ServerApi_arginfo.h create mode 100644 src/MongoDB/ServerDescription.stub.php create mode 100644 src/MongoDB/ServerDescription_arginfo.h create mode 100644 src/MongoDB/Server_arginfo.h create mode 100644 src/MongoDB/Session.stub.php create mode 100644 src/MongoDB/Session_arginfo.h create mode 100644 src/MongoDB/TopologyDescription.stub.php create mode 100644 src/MongoDB/TopologyDescription_arginfo.h create mode 100644 src/MongoDB/WriteConcern.stub.php create mode 100644 src/MongoDB/WriteConcernError.stub.php create mode 100644 src/MongoDB/WriteConcernError_arginfo.h create mode 100644 src/MongoDB/WriteConcern_arginfo.h create mode 100644 src/MongoDB/WriteError.stub.php create mode 100644 src/MongoDB/WriteError_arginfo.h create mode 100644 src/MongoDB/WriteResult.stub.php create mode 100644 src/MongoDB/WriteResult_arginfo.h diff --git a/src/MongoDB/BulkWrite.c b/src/MongoDB/BulkWrite.c index 7bc2fad19..de6210199 100644 --- a/src/MongoDB/BulkWrite.c +++ b/src/MongoDB/BulkWrite.c @@ -25,6 +25,7 @@ #include "php_phongo.h" #include "phongo_bson_encode.h" #include "phongo_error.h" +#include "BulkWrite_arginfo.h" #include "MongoDB/WriteConcern.h" @@ -311,7 +312,7 @@ static bool php_phongo_bulkwrite_delete_apply_options(bson_t* boptions, zval* zo /* {{{ proto void MongoDB\Driver\BulkWrite::__construct([array $options = array()]) Constructs a new BulkWrite */ -static PHP_METHOD(BulkWrite, __construct) +static PHP_METHOD(MongoDB_Driver_BulkWrite, __construct) { php_phongo_bulkwrite_t* intern; zval* options = NULL; @@ -376,7 +377,7 @@ static PHP_METHOD(BulkWrite, __construct) /* {{{ proto mixed MongoDB\Driver\BulkWrite::insert(array|object $document) Adds an insert operation to the BulkWrite */ -static PHP_METHOD(BulkWrite, insert) +static PHP_METHOD(MongoDB_Driver_BulkWrite, insert) { php_phongo_bulkwrite_t* intern; zval* zdocument; @@ -421,7 +422,7 @@ static PHP_METHOD(BulkWrite, insert) /* {{{ proto void MongoDB\Driver\BulkWrite::update(array|object $query, array|object $newObj[, array $updateOptions = array()]) Adds an update operation to the BulkWrite */ -static PHP_METHOD(BulkWrite, update) +static PHP_METHOD(MongoDB_Driver_BulkWrite, update) { php_phongo_bulkwrite_t* intern; zval * zquery, *zupdate, *zoptions = NULL; @@ -487,7 +488,7 @@ static PHP_METHOD(BulkWrite, update) /* {{{ proto void MongoDB\Driver\BulkWrite::delete(array|object $query[, array $deleteOptions = array()]) Adds a delete operation to the BulkWrite */ -static PHP_METHOD(BulkWrite, delete) +static PHP_METHOD(MongoDB_Driver_BulkWrite, delete) { php_phongo_bulkwrite_t* intern; zval * zquery, *zoptions = NULL; @@ -533,7 +534,7 @@ static PHP_METHOD(BulkWrite, delete) /* {{{ proto integer MongoDB\Driver\BulkWrite::count() Returns the number of operations that have been added to the BulkWrite */ -static PHP_METHOD(BulkWrite, count) +static PHP_METHOD(MongoDB_Driver_BulkWrite, count) { php_phongo_bulkwrite_t* intern; @@ -544,44 +545,7 @@ static PHP_METHOD(BulkWrite, count) RETURN_LONG(intern->num_ops); } /* }}} */ -/* {{{ MongoDB\Driver\BulkWrite function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite___construct, 0, 0, 0) - ZEND_ARG_ARRAY_INFO(0, options, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_BulkWrite_count, 0, 0, IS_LONG, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite_insert, 0, 0, 1) - ZEND_ARG_INFO(0, document) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite_update, 0, 0, 2) - ZEND_ARG_INFO(0, query) - ZEND_ARG_INFO(0, newObj) - ZEND_ARG_ARRAY_INFO(0, updateOptions, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite_delete, 0, 0, 1) - ZEND_ARG_INFO(0, query) - ZEND_ARG_ARRAY_INFO(0, deleteOptions, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_BulkWrite_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_bulkwrite_me[] = { - PHP_ME(BulkWrite, __construct, ai_BulkWrite___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(BulkWrite, insert, ai_BulkWrite_insert, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(BulkWrite, update, ai_BulkWrite_update, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(BulkWrite, delete, ai_BulkWrite_delete, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(BulkWrite, count, ai_BulkWrite_count, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_BulkWrite_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_BulkWrite) /* {{{ MongoDB\Driver\BulkWrite object handlers */ static zend_object_handlers php_phongo_handler_bulkwrite; @@ -707,18 +671,12 @@ static HashTable* php_phongo_bulkwrite_get_debug_info(phongo_compat_object_handl void php_phongo_bulkwrite_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "BulkWrite", php_phongo_bulkwrite_me); - php_phongo_bulkwrite_ce = zend_register_internal_class(&ce); + php_phongo_bulkwrite_ce = register_class_MongoDB_Driver_BulkWrite(zend_ce_countable); php_phongo_bulkwrite_ce->create_object = php_phongo_bulkwrite_create_object; - PHONGO_CE_FINAL(php_phongo_bulkwrite_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_bulkwrite_ce); memcpy(&php_phongo_handler_bulkwrite, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_bulkwrite.get_debug_info = php_phongo_bulkwrite_get_debug_info; php_phongo_handler_bulkwrite.free_obj = php_phongo_bulkwrite_free_object; php_phongo_handler_bulkwrite.offset = XtOffsetOf(php_phongo_bulkwrite_t, std); - - zend_class_implements(php_phongo_bulkwrite_ce, 1, zend_ce_countable); } /* }}} */ diff --git a/src/MongoDB/BulkWrite.stub.php b/src/MongoDB/BulkWrite.stub.php new file mode 100644 index 000000000..e4a4ebd0e --- /dev/null +++ b/src/MongoDB/BulkWrite.stub.php @@ -0,0 +1,39 @@ += 80000 + public function delete(array|object $filter, array $deleteOptions = []): void {} + + public final function insert(array|object $document): mixed {} + + public function update(array|object $filter, array|object $newObj, array $updateOptions = []): void {} +#else + /** @param array|object $filter */ + public function delete($filter, array $deleteOptions = []): void {} + + /** + * @param array|object $document + * @return mixed + */ + public final function insert($document) {} + + /** + * @param array|object $filter + * @param array|object $newObj + */ + public function update($filter, $newObj, array $updateOptions = []): void {} +#endif + } +} diff --git a/src/MongoDB/BulkWrite_arginfo.h b/src/MongoDB/BulkWrite_arginfo.h new file mode 100644 index 000000000..291cfa7cd --- /dev/null +++ b/src/MongoDB/BulkWrite_arginfo.h @@ -0,0 +1,110 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: ec9c23a8afe93c3ae9cd3c78733e67f808b48bcb */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite___construct, 0, 0, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_count, 0, 0, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_delete, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_MASK(0, filter, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, deleteOptions, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() +#endif + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_insert, 0, 1, IS_MIXED, 0) + ZEND_ARG_TYPE_MASK(0, document, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) +ZEND_END_ARG_INFO() +#endif + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_update, 0, 2, IS_VOID, 0) + ZEND_ARG_TYPE_MASK(0, filter, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) + ZEND_ARG_TYPE_MASK(0, newObj, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, updateOptions, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_delete, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, filter) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, deleteOptions, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_insert, 0, 0, 1) + ZEND_ARG_INFO(0, document) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_update, 0, 2, IS_VOID, 0) + ZEND_ARG_INFO(0, filter) + ZEND_ARG_INFO(0, newObj) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, updateOptions, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() +#endif + + +static ZEND_METHOD(MongoDB_Driver_BulkWrite, __construct); +static ZEND_METHOD(MongoDB_Driver_BulkWrite, count); +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_BulkWrite, delete); +#endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_BulkWrite, insert); +#endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_BulkWrite, update); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_BulkWrite, delete); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_BulkWrite, insert); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_BulkWrite, update); +#endif + + +static const zend_function_entry class_MongoDB_Driver_BulkWrite_methods[] = { + ZEND_ME(MongoDB_Driver_BulkWrite, __construct, arginfo_class_MongoDB_Driver_BulkWrite___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_BulkWrite, count, arginfo_class_MongoDB_Driver_BulkWrite_count, ZEND_ACC_PUBLIC) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_BulkWrite, delete, arginfo_class_MongoDB_Driver_BulkWrite_delete, ZEND_ACC_PUBLIC) +#endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_BulkWrite, insert, arginfo_class_MongoDB_Driver_BulkWrite_insert, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_BulkWrite, update, arginfo_class_MongoDB_Driver_BulkWrite_update, ZEND_ACC_PUBLIC) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_BulkWrite, delete, arginfo_class_MongoDB_Driver_BulkWrite_delete, ZEND_ACC_PUBLIC) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_BulkWrite, insert, arginfo_class_MongoDB_Driver_BulkWrite_insert, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_BulkWrite, update, arginfo_class_MongoDB_Driver_BulkWrite_update, ZEND_ACC_PUBLIC) +#endif + ZEND_FE_END +}; + +static zend_class_entry *register_class_MongoDB_Driver_BulkWrite(zend_class_entry *class_entry_Countable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "BulkWrite", class_MongoDB_Driver_BulkWrite_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 1, class_entry_Countable); + + return class_entry; +} diff --git a/src/MongoDB/ClientEncryption.c b/src/MongoDB/ClientEncryption.c index 65c215ae3..e4fe1c089 100644 --- a/src/MongoDB/ClientEncryption.c +++ b/src/MongoDB/ClientEncryption.c @@ -28,6 +28,7 @@ #include "phongo_util.h" #include "MongoDB/ClientEncryption.h" +#include "ClientEncryption_arginfo.h" zend_class_entry* php_phongo_clientencryption_ce; @@ -38,7 +39,7 @@ static void phongo_clientencryption_decrypt(php_phongo_clientencryption_t* clien /* {{{ proto void MongoDB\Driver\ClientEncryption::__construct(array $options) Constructs a new ClientEncryption */ -static PHP_METHOD(ClientEncryption, __construct) +static PHP_METHOD(MongoDB_Driver_ClientEncryption, __construct) { zval* options; @@ -52,7 +53,7 @@ static PHP_METHOD(ClientEncryption, __construct) /* {{{ proto MongoDB\BSON\Binary MongoDB\Driver\ClientEncryption::createDataKey(string $kmsProvider[, array $options]) Creates a new key document and inserts into the key vault collection. */ -static PHP_METHOD(ClientEncryption, createDataKey) +static PHP_METHOD(MongoDB_Driver_ClientEncryption, createDataKey) { char* kms_provider = NULL; size_t kms_provider_len = 0; @@ -72,7 +73,7 @@ static PHP_METHOD(ClientEncryption, createDataKey) /* {{{ proto MongoDB\BSON\Binary MongoDB\Driver\ClientEncryption::encrypt(mixed $value[, array $options]) Encrypts a value with a given key and algorithm */ -static PHP_METHOD(ClientEncryption, encrypt) +static PHP_METHOD(MongoDB_Driver_ClientEncryption, encrypt) { zval* value = NULL; zval* options = NULL; @@ -91,7 +92,7 @@ static PHP_METHOD(ClientEncryption, encrypt) /* {{{ proto mixed MongoDB\Driver\ClientEncryption::decrypt(MongoDB\BSON\BinaryInterface $value) Decrypts an encrypted value (BSON binary of subtype 6). Returns the original BSON value */ -static PHP_METHOD(ClientEncryption, decrypt) +static PHP_METHOD(MongoDB_Driver_ClientEncryption, decrypt) { zval* ciphertext; php_phongo_clientencryption_t* intern; @@ -105,38 +106,7 @@ static PHP_METHOD(ClientEncryption, decrypt) phongo_clientencryption_decrypt(intern, ciphertext, return_value); } /* }}} */ -ZEND_BEGIN_ARG_INFO_EX(ai_ClientEncryption___construct, 0, 0, 0) - ZEND_ARG_ARRAY_INFO(0, options, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ClientEncryption_createDataKey, 0, 0, 1) - ZEND_ARG_INFO(0, kmsProvider) - ZEND_ARG_ARRAY_INFO(0, options, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ClientEncryption_encrypt, 0, 0, 1) - ZEND_ARG_INFO(0, value) - ZEND_ARG_ARRAY_INFO(0, options, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ClientEncryption_decrypt, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, keyVaultClient, MongoDB\\BSON\\BinaryInterface, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ClientEncryption_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_clientencryption_me[] = { - /* clang-format off */ - PHP_ME(ClientEncryption, __construct, ai_ClientEncryption___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ClientEncryption, createDataKey, ai_ClientEncryption_createDataKey, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ClientEncryption, encrypt, ai_ClientEncryption_encrypt, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ClientEncryption, decrypt, ai_ClientEncryption_decrypt, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_ClientEncryption_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_ClientEncryption) /* {{{ MongoDB\Driver\ClientEncryption object handlers */ static zend_object_handlers php_phongo_handler_clientencryption; @@ -186,24 +156,14 @@ static HashTable* php_phongo_clientencryption_get_debug_info(phongo_compat_objec void php_phongo_clientencryption_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ClientEncryption", php_phongo_clientencryption_me); - php_phongo_clientencryption_ce = zend_register_internal_class(&ce); + php_phongo_clientencryption_ce = register_class_MongoDB_Driver_ClientEncryption(); php_phongo_clientencryption_ce->create_object = php_phongo_clientencryption_create_object; - PHONGO_CE_FINAL(php_phongo_clientencryption_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_clientencryption_ce); memcpy(&php_phongo_handler_clientencryption, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_clientencryption.get_debug_info = php_phongo_clientencryption_get_debug_info; php_phongo_handler_clientencryption.free_obj = php_phongo_clientencryption_free_object; php_phongo_handler_clientencryption.offset = XtOffsetOf(php_phongo_clientencryption_t, std); - - zend_declare_class_constant_string(php_phongo_clientencryption_ce, ZEND_STRL("AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC"), MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC); - zend_declare_class_constant_string(php_phongo_clientencryption_ce, ZEND_STRL("AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM"), MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM); - zend_declare_class_constant_string(php_phongo_clientencryption_ce, ZEND_STRL("ALGORITHM_INDEXED"), MONGOC_ENCRYPT_ALGORITHM_INDEXED); - zend_declare_class_constant_string(php_phongo_clientencryption_ce, ZEND_STRL("ALGORITHM_UNINDEXED"), MONGOC_ENCRYPT_ALGORITHM_UNINDEXED); - zend_declare_class_constant_string(php_phongo_clientencryption_ce, ZEND_STRL("QUERY_TYPE_EQUALITY"), MONGOC_ENCRYPT_QUERY_TYPE_EQUALITY); } /* }}} */ #ifdef MONGOC_ENABLE_CLIENT_SIDE_ENCRYPTION diff --git a/src/MongoDB/ClientEncryption.stub.php b/src/MongoDB/ClientEncryption.stub.php new file mode 100644 index 000000000..9d30eb31c --- /dev/null +++ b/src/MongoDB/ClientEncryption.stub.php @@ -0,0 +1,58 @@ += 80000 + final public function decrypt(\MongoDB\BSON\Binary $value): mixed {} + + final public function encrypt(mixed $value, array $options = []): \MongoDB\BSON\Binary {} +#else + /** @return mixed */ + final public function decrypt(\MongoDB\BSON\Binary $value) {} + + /** @param mixed $value */ + final public function encrypt($value, array $options = []): \MongoDB\BSON\Binary {} +#endif + } +} diff --git a/src/MongoDB/ClientEncryption_arginfo.h b/src/MongoDB/ClientEncryption_arginfo.h new file mode 100644 index 000000000..8b3e42051 --- /dev/null +++ b/src/MongoDB/ClientEncryption_arginfo.h @@ -0,0 +1,118 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 9ed4be3589f4aa9597adfc7104ab9c0f923d4c20 */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption___construct, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_createDataKey, 0, 1, MongoDB\\BSON\\Binary, 0) + ZEND_ARG_TYPE_INFO(0, kmsProvider, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_decrypt, 0, 1, IS_MIXED, 0) + ZEND_ARG_OBJ_INFO(0, value, MongoDB\\BSON\\Binary, 0) +ZEND_END_ARG_INFO() +#endif + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, 0, 1, MongoDB\\BSON\\Binary, 0) + ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_decrypt, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, value, MongoDB\\BSON\\Binary, 0) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, 0, 1, MongoDB\\BSON\\Binary, 0) + ZEND_ARG_INFO(0, value) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() +#endif + + +static ZEND_METHOD(MongoDB_Driver_ClientEncryption, __construct); +static ZEND_METHOD(MongoDB_Driver_ClientEncryption, createDataKey); +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_ClientEncryption, decrypt); +#endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_ClientEncryption, encrypt); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_ClientEncryption, decrypt); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_ClientEncryption, encrypt); +#endif + + +static const zend_function_entry class_MongoDB_Driver_ClientEncryption_methods[] = { + ZEND_ME(MongoDB_Driver_ClientEncryption, __construct, arginfo_class_MongoDB_Driver_ClientEncryption___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ClientEncryption, createDataKey, arginfo_class_MongoDB_Driver_ClientEncryption_createDataKey, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_ClientEncryption, decrypt, arginfo_class_MongoDB_Driver_ClientEncryption_decrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_ClientEncryption, encrypt, arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_ClientEncryption, decrypt, arginfo_class_MongoDB_Driver_ClientEncryption_decrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_ClientEncryption, encrypt, arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; + +static zend_class_entry *register_class_MongoDB_Driver_ClientEncryption(void) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ClientEncryption", class_MongoDB_Driver_ClientEncryption_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + zval const_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC_value; + zend_string *const_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC_value_str = zend_string_init(MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC, sizeof(MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC) - 1, 1); + ZVAL_STR(&const_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC_value, const_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC_value_str); + zend_string *const_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC_name = zend_string_init_interned("AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC", sizeof("AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC_name, &const_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC_name); + + zval const_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM_value; + zend_string *const_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM_value_str = zend_string_init(MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM, sizeof(MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM) - 1, 1); + ZVAL_STR(&const_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM_value, const_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM_value_str); + zend_string *const_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM_name = zend_string_init_interned("AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM", sizeof("AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM_name, &const_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM_name); + + zval const_ALGORITHM_INDEXED_value; + zend_string *const_ALGORITHM_INDEXED_value_str = zend_string_init(MONGOC_ENCRYPT_ALGORITHM_INDEXED, sizeof(MONGOC_ENCRYPT_ALGORITHM_INDEXED) - 1, 1); + ZVAL_STR(&const_ALGORITHM_INDEXED_value, const_ALGORITHM_INDEXED_value_str); + zend_string *const_ALGORITHM_INDEXED_name = zend_string_init_interned("ALGORITHM_INDEXED", sizeof("ALGORITHM_INDEXED") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_ALGORITHM_INDEXED_name, &const_ALGORITHM_INDEXED_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_ALGORITHM_INDEXED_name); + + zval const_ALGORITHM_UNINDEXED_value; + zend_string *const_ALGORITHM_UNINDEXED_value_str = zend_string_init(MONGOC_ENCRYPT_ALGORITHM_UNINDEXED, sizeof(MONGOC_ENCRYPT_ALGORITHM_UNINDEXED) - 1, 1); + ZVAL_STR(&const_ALGORITHM_UNINDEXED_value, const_ALGORITHM_UNINDEXED_value_str); + zend_string *const_ALGORITHM_UNINDEXED_name = zend_string_init_interned("ALGORITHM_UNINDEXED", sizeof("ALGORITHM_UNINDEXED") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_ALGORITHM_UNINDEXED_name, &const_ALGORITHM_UNINDEXED_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_ALGORITHM_UNINDEXED_name); + + zval const_QUERY_TYPE_EQUALITY_value; + zend_string *const_QUERY_TYPE_EQUALITY_value_str = zend_string_init(MONGOC_ENCRYPT_QUERY_TYPE_EQUALITY, sizeof(MONGOC_ENCRYPT_QUERY_TYPE_EQUALITY) - 1, 1); + ZVAL_STR(&const_QUERY_TYPE_EQUALITY_value, const_QUERY_TYPE_EQUALITY_value_str); + zend_string *const_QUERY_TYPE_EQUALITY_name = zend_string_init_interned("QUERY_TYPE_EQUALITY", sizeof("QUERY_TYPE_EQUALITY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_QUERY_TYPE_EQUALITY_name, &const_QUERY_TYPE_EQUALITY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_QUERY_TYPE_EQUALITY_name); + + return class_entry; +} diff --git a/src/MongoDB/Command.c b/src/MongoDB/Command.c index d0c3f2333..424e154e7 100644 --- a/src/MongoDB/Command.c +++ b/src/MongoDB/Command.c @@ -24,6 +24,7 @@ #include "php_phongo.h" #include "phongo_bson_encode.h" #include "phongo_error.h" +#include "Command_arginfo.h" zend_class_entry* php_phongo_command_ce; @@ -98,7 +99,7 @@ static bool php_phongo_command_init(php_phongo_command_t* intern, zval* filter, /* {{{ proto void MongoDB\Driver\Command::__construct(array|object $document[, array $options = array()]) Constructs a new Command */ -static PHP_METHOD(Command, __construct) +static PHP_METHOD(MongoDB_Driver_Command, __construct) { php_phongo_command_t* intern; zval* document; @@ -115,23 +116,7 @@ static PHP_METHOD(Command, __construct) php_phongo_command_init(intern, document, options); } /* }}} */ -/* {{{ MongoDB\Driver\Command function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_Command___construct, 0, 0, 1) - ZEND_ARG_INFO(0, document) - ZEND_ARG_ARRAY_INFO(0, options, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Command_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_command_me[] = { - /* clang-format off */ - PHP_ME(Command, __construct, ai_Command___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Command_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Command) /* {{{ MongoDB\Driver\Command object handlers */ static zend_object_handlers php_phongo_handler_command; @@ -190,12 +175,8 @@ static HashTable* php_phongo_command_get_debug_info(phongo_compat_object_handler void php_phongo_command_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Command", php_phongo_command_me); - php_phongo_command_ce = zend_register_internal_class(&ce); + php_phongo_command_ce = register_class_MongoDB_Driver_Command(); php_phongo_command_ce->create_object = php_phongo_command_create_object; - PHONGO_CE_FINAL(php_phongo_command_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_command_ce); memcpy(&php_phongo_handler_command, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/Command.stub.php b/src/MongoDB/Command.stub.php new file mode 100644 index 000000000..0d53d38ae --- /dev/null +++ b/src/MongoDB/Command.stub.php @@ -0,0 +1,19 @@ += 80000 + final public function __construct(array|object $document, array $commandOptions = []) {} +#else + /** @param array|object $document */ + final public function __construct($document, array $commandOptions = []) {} +#endif + } +} diff --git a/src/MongoDB/Command_arginfo.h b/src/MongoDB/Command_arginfo.h new file mode 100644 index 000000000..24b37309e --- /dev/null +++ b/src/MongoDB/Command_arginfo.h @@ -0,0 +1,46 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 4a6cf8ddc65e71bb5ba6f061b5129701ed49934f */ + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Command___construct, 0, 0, 1) + ZEND_ARG_TYPE_MASK(0, document, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, commandOptions, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Command___construct, 0, 0, 1) + ZEND_ARG_INFO(0, document) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, commandOptions, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() +#endif + + +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Command, __construct); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_Command, __construct); +#endif + + +static const zend_function_entry class_MongoDB_Driver_Command_methods[] = { +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Command, __construct, arginfo_class_MongoDB_Driver_Command___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_Command, __construct, arginfo_class_MongoDB_Driver_Command___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_FE_END +}; + +static zend_class_entry *register_class_MongoDB_Driver_Command(void) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Command", class_MongoDB_Driver_Command_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Cursor.c b/src/MongoDB/Cursor.c index 4778e45c1..573346147 100644 --- a/src/MongoDB/Cursor.c +++ b/src/MongoDB/Cursor.c @@ -25,6 +25,7 @@ #include "MongoDB/Cursor.h" #include "MongoDB/Server.h" +#include "Cursor_arginfo.h" zend_class_entry* php_phongo_cursor_ce; @@ -54,7 +55,7 @@ static void php_phongo_cursor_free_current(php_phongo_cursor_t* cursor) /* {{{ * /* {{{ proto void MongoDB\Driver\Cursor::setTypeMap(array $typemap) Sets a type map to use for BSON unserialization */ -static PHP_METHOD(Cursor, setTypeMap) +static PHP_METHOD(MongoDB_Driver_Cursor, setTypeMap) { php_phongo_cursor_t* intern; php_phongo_bson_state state; @@ -127,7 +128,7 @@ static void php_phongo_cursor_id_new_from_id(zval* object, int64_t cursorid) /* /* {{{ proto array MongoDB\Driver\Cursor::toArray() Returns an array of all result documents for this cursor */ -static PHP_METHOD(Cursor, toArray) +static PHP_METHOD(MongoDB_Driver_Cursor, toArray) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -141,7 +142,7 @@ static PHP_METHOD(Cursor, toArray) /* {{{ proto MongoDB\Driver\CursorId MongoDB\Driver\Cursor::getId() Returns the CursorId for this cursor */ -static PHP_METHOD(Cursor, getId) +static PHP_METHOD(MongoDB_Driver_Cursor, getId) { php_phongo_cursor_t* intern; @@ -154,7 +155,7 @@ static PHP_METHOD(Cursor, getId) /* {{{ proto MongoDB\Driver\Server MongoDB\Driver\Cursor::getServer() Returns the Server object to which this cursor is attached */ -static PHP_METHOD(Cursor, getServer) +static PHP_METHOD(MongoDB_Driver_Cursor, getServer) { php_phongo_cursor_t* intern; @@ -167,7 +168,7 @@ static PHP_METHOD(Cursor, getServer) /* {{{ proto boolean MongoDB\Driver\Cursor::isDead() Checks if a cursor is still alive */ -static PHP_METHOD(Cursor, isDead) +static PHP_METHOD(MongoDB_Driver_Cursor, isDead) { php_phongo_cursor_t* intern; @@ -178,7 +179,7 @@ static PHP_METHOD(Cursor, isDead) RETURN_BOOL(!mongoc_cursor_more(intern->cursor)); } /* }}} */ -PHP_METHOD(Cursor, current) +static PHP_METHOD(MongoDB_Driver_Cursor, current) { php_phongo_cursor_t* intern = Z_CURSOR_OBJ_P(getThis()); zval* data; @@ -194,7 +195,7 @@ PHP_METHOD(Cursor, current) } } -PHP_METHOD(Cursor, key) +static PHP_METHOD(MongoDB_Driver_Cursor, key) { php_phongo_cursor_t* intern = Z_CURSOR_OBJ_P(getThis()); @@ -207,7 +208,7 @@ PHP_METHOD(Cursor, key) RETURN_LONG(intern->current); } -PHP_METHOD(Cursor, next) +static PHP_METHOD(MongoDB_Driver_Cursor, next) { php_phongo_cursor_t* intern = Z_CURSOR_OBJ_P(getThis()); const bson_t* doc; @@ -245,7 +246,7 @@ PHP_METHOD(Cursor, next) php_phongo_cursor_free_session_if_exhausted(intern); } -PHP_METHOD(Cursor, valid) +static PHP_METHOD(MongoDB_Driver_Cursor, valid) { php_phongo_cursor_t* intern = Z_CURSOR_OBJ_P(getThis()); @@ -254,7 +255,7 @@ PHP_METHOD(Cursor, valid) RETURN_BOOL(!Z_ISUNDEF(intern->visitor_data.zchild)); } -PHP_METHOD(Cursor, rewind) +static PHP_METHOD(MongoDB_Driver_Cursor, rewind) { php_phongo_cursor_t* intern = Z_CURSOR_OBJ_P(getThis()); const bson_t* doc; @@ -291,49 +292,8 @@ PHP_METHOD(Cursor, rewind) php_phongo_cursor_free_session_if_exhausted(intern); } -/* {{{ MongoDB\Driver\Cursor function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_Cursor_current, 0, 0, IS_MIXED, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_Cursor_key, 0, 0, IS_MIXED, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_Cursor_next, 0, 0, IS_VOID, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_Cursor_valid, 0, 0, _IS_BOOL, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_Cursor_rewind, 0, 0, IS_VOID, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Cursor_setTypeMap, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, typemap, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Cursor_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_cursor_me[] = { - PHP_ME(Cursor, setTypeMap, ai_Cursor_setTypeMap, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Cursor, toArray, ai_Cursor_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Cursor, getId, ai_Cursor_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Cursor, getServer, ai_Cursor_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Cursor, isDead, ai_Cursor_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - - PHP_ME(Cursor, current, ai_Cursor_current, ZEND_ACC_PUBLIC) - PHP_ME(Cursor, key, ai_Cursor_key, ZEND_ACC_PUBLIC) - PHP_ME(Cursor, next, ai_Cursor_next, ZEND_ACC_PUBLIC) - PHP_ME(Cursor, valid, ai_Cursor_valid, ZEND_ACC_PUBLIC) - PHP_ME(Cursor, rewind, ai_Cursor_rewind, ZEND_ACC_PUBLIC) - - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Cursor_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Cursor_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_Cursor) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Cursor) /* {{{ MongoDB\Driver\Cursor object handlers */ static zend_object_handlers php_phongo_handler_cursor; @@ -475,17 +435,10 @@ static HashTable* php_phongo_cursor_get_debug_info(phongo_compat_object_handler_ void php_phongo_cursor_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Cursor", php_phongo_cursor_me); - php_phongo_cursor_ce = zend_register_internal_class(&ce); + php_phongo_cursor_ce = register_class_MongoDB_Driver_Cursor(zend_ce_iterator, php_phongo_cursor_interface_ce); php_phongo_cursor_ce->create_object = php_phongo_cursor_create_object; - PHONGO_CE_FINAL(php_phongo_cursor_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_cursor_ce); - zend_class_implements(php_phongo_cursor_ce, 1, zend_ce_iterator); - zend_class_implements(php_phongo_cursor_ce, 1, php_phongo_cursor_interface_ce); - memcpy(&php_phongo_handler_cursor, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_cursor.get_debug_info = php_phongo_cursor_get_debug_info; php_phongo_handler_cursor.free_obj = php_phongo_cursor_free_object; diff --git a/src/MongoDB/Cursor.stub.php b/src/MongoDB/Cursor.stub.php new file mode 100644 index 000000000..4166e7a7d --- /dev/null +++ b/src/MongoDB/Cursor.stub.php @@ -0,0 +1,39 @@ += 80000 + public function current(): array|object|null {} +#else + /** @return array|object|null */ + public function current() {} +#endif + + final public function getId(): CursorId {} + + final public function getServer(): Server {} + + final public function isDead(): bool {} + + public function key(): ?int {} + + public function next(): void {} + + public function rewind(): void {} + + final public function setTypeMap(array $typemap): void {} + + final public function toArray(): array {} + + public function valid(): bool {} + } +} diff --git a/src/MongoDB/CursorId.c b/src/MongoDB/CursorId.c index e9730a855..1368e4663 100644 --- a/src/MongoDB/CursorId.c +++ b/src/MongoDB/CursorId.c @@ -22,6 +22,7 @@ #include "php_phongo.h" #include "phongo_error.h" #include "phongo_util.h" +#include "CursorId_arginfo.h" zend_class_entry* php_phongo_cursorid_ce; @@ -92,7 +93,7 @@ static HashTable* php_phongo_cursorid_get_properties_hash(phongo_compat_object_h /* {{{ proto MongoDB\Driver\CursorId MongoDB\Driver\CursorId::__set_state(array $properties) */ -static PHP_METHOD(CursorId, __set_state) +PHP_METHOD(MongoDB_Driver_CursorId, __set_state) { php_phongo_cursorid_t* intern; HashTable* props; @@ -112,7 +113,7 @@ static PHP_METHOD(CursorId, __set_state) /* {{{ proto string MongoDB\Driver\CursorId::__toString() Returns the string representation of the CursorId */ -static PHP_METHOD(CursorId, __toString) +PHP_METHOD(MongoDB_Driver_CursorId, __toString) { php_phongo_cursorid_t* intern; char* tmp; @@ -129,7 +130,7 @@ static PHP_METHOD(CursorId, __toString) /* {{{ proto string MongoDB\Driver\CursorId::serialize() */ -static PHP_METHOD(CursorId, serialize) +PHP_METHOD(MongoDB_Driver_CursorId, serialize) { php_phongo_cursorid_t* intern; zval retval; @@ -156,7 +157,7 @@ static PHP_METHOD(CursorId, serialize) /* {{{ proto void MongoDB\Driver\CursorId::unserialize(string $serialized) */ -static PHP_METHOD(CursorId, unserialize) +PHP_METHOD(MongoDB_Driver_CursorId, unserialize) { php_phongo_cursorid_t* intern; char* serialized; @@ -186,7 +187,7 @@ static PHP_METHOD(CursorId, unserialize) /* {{{ proto array MongoDB\Driver\CursorId::__serialize() */ -static PHP_METHOD(CursorId, __serialize) +PHP_METHOD(MongoDB_Driver_CursorId, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -195,7 +196,7 @@ static PHP_METHOD(CursorId, __serialize) /* {{{ proto void MongoDB\Driver\CursorId::__unserialize(array $data) */ -static PHP_METHOD(CursorId, __unserialize) +PHP_METHOD(MongoDB_Driver_CursorId, __unserialize) { zval* data; @@ -206,38 +207,7 @@ static PHP_METHOD(CursorId, __unserialize) php_phongo_cursorid_init_from_hash(Z_CURSORID_OBJ_P(getThis()), Z_ARRVAL_P(data)); } /* }}} */ -/* {{{ MongoDB\Driver\CursorId function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_INFO_EX(ai_CursorId___set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, properties, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_CursorId___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_CursorId___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_CursorId_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -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, __serialize, ai_CursorId_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CursorId, __set_state, ai_CursorId___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(CursorId, __toString, ai_CursorId___toString, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CursorId, __unserialize, ai_CursorId___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CursorId, serialize, ai_CursorId_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(CursorId, unserialize, ai_CursorId_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_CursorId_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_CursorId) /* {{{ MongoDB\Driver\CursorId object handlers */ static zend_object_handlers php_phongo_handler_cursorid; @@ -280,14 +250,8 @@ static HashTable* php_phongo_cursorid_get_properties(phongo_compat_object_handle 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); - php_phongo_cursorid_ce = zend_register_internal_class(&ce); + php_phongo_cursorid_ce = register_class_MongoDB_Driver_CursorId(zend_ce_serializable); php_phongo_cursorid_ce->create_object = php_phongo_cursorid_create_object; - PHONGO_CE_FINAL(php_phongo_cursorid_ce); - - zend_class_implements(php_phongo_cursorid_ce, 1, zend_ce_serializable); #if PHP_VERSION_ID >= 80000 zend_class_implements(php_phongo_cursorid_ce, 1, zend_ce_stringable); diff --git a/src/MongoDB/CursorId.stub.php b/src/MongoDB/CursorId.stub.php new file mode 100644 index 000000000..5270bc2d3 --- /dev/null +++ b/src/MongoDB/CursorId.stub.php @@ -0,0 +1,27 @@ +ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 1, class_entry_Serializable); + + return class_entry; +} diff --git a/src/MongoDB/CursorInterface.c b/src/MongoDB/CursorInterface.c index 23797ae53..53c747ea3 100644 --- a/src/MongoDB/CursorInterface.c +++ b/src/MongoDB/CursorInterface.c @@ -18,35 +18,11 @@ #include #include "php_phongo.h" +#include "CursorInterface_arginfo.h" zend_class_entry* php_phongo_cursor_interface_ce; -/* {{{ MongoDB\BSON\CursorInterface function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_CursorInterface_setTypeMap, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, typemap, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_CursorInterface_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_cursor_interface_me[] = { - /* clang-format off */ - ZEND_ABSTRACT_ME(CursorInterface, getId, ai_CursorInterface_void) - ZEND_ABSTRACT_ME(CursorInterface, getServer, ai_CursorInterface_void) - ZEND_ABSTRACT_ME(CursorInterface, isDead, ai_CursorInterface_void) - ZEND_ABSTRACT_ME(CursorInterface, setTypeMap, ai_CursorInterface_setTypeMap) - ZEND_ABSTRACT_ME(CursorInterface, toArray, ai_CursorInterface_void) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - void php_phongo_cursor_interface_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "CursorInterface", php_phongo_cursor_interface_me); - php_phongo_cursor_interface_ce = zend_register_internal_interface(&ce); - - zend_class_implements(php_phongo_cursor_interface_ce, 1, zend_ce_traversable); + php_phongo_cursor_interface_ce = register_class_MongoDB_Driver_CursorInterface(zend_ce_traversable); } /* }}} */ diff --git a/src/MongoDB/CursorInterface.stub.php b/src/MongoDB/CursorInterface.stub.php new file mode 100644 index 000000000..9ba9c07f7 --- /dev/null +++ b/src/MongoDB/CursorInterface.stub.php @@ -0,0 +1,27 @@ += 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_Cursor_current, 0, 0, MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_NULL) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Cursor_current, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Cursor_getId, 0, 0, MongoDB\\Driver\\CursorId, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Cursor_getServer, 0, 0, MongoDB\\Driver\\Server, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Cursor_isDead, 0, 0, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Cursor_key, 0, 0, IS_LONG, 1) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Cursor_next, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_Driver_Cursor_rewind arginfo_class_MongoDB_Driver_Cursor_next + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Cursor_setTypeMap, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, typemap, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Cursor_toArray, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_Driver_Cursor_valid arginfo_class_MongoDB_Driver_Cursor_isDead + + +static ZEND_METHOD(MongoDB_Driver_Cursor, __construct); +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Cursor, current); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_Cursor, current); +#endif +static ZEND_METHOD(MongoDB_Driver_Cursor, getId); +static ZEND_METHOD(MongoDB_Driver_Cursor, getServer); +static ZEND_METHOD(MongoDB_Driver_Cursor, isDead); +static ZEND_METHOD(MongoDB_Driver_Cursor, key); +static ZEND_METHOD(MongoDB_Driver_Cursor, next); +static ZEND_METHOD(MongoDB_Driver_Cursor, rewind); +static ZEND_METHOD(MongoDB_Driver_Cursor, setTypeMap); +static ZEND_METHOD(MongoDB_Driver_Cursor, toArray); +static ZEND_METHOD(MongoDB_Driver_Cursor, valid); + + +static const zend_function_entry class_MongoDB_Driver_Cursor_methods[] = { + ZEND_ME(MongoDB_Driver_Cursor, __construct, arginfo_class_MongoDB_Driver_Cursor___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Cursor, current, arginfo_class_MongoDB_Driver_Cursor_current, ZEND_ACC_PUBLIC) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_Cursor, current, arginfo_class_MongoDB_Driver_Cursor_current, ZEND_ACC_PUBLIC) +#endif + ZEND_ME(MongoDB_Driver_Cursor, getId, arginfo_class_MongoDB_Driver_Cursor_getId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Cursor, getServer, arginfo_class_MongoDB_Driver_Cursor_getServer, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Cursor, isDead, arginfo_class_MongoDB_Driver_Cursor_isDead, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Cursor, key, arginfo_class_MongoDB_Driver_Cursor_key, ZEND_ACC_PUBLIC) + ZEND_ME(MongoDB_Driver_Cursor, next, arginfo_class_MongoDB_Driver_Cursor_next, ZEND_ACC_PUBLIC) + ZEND_ME(MongoDB_Driver_Cursor, rewind, arginfo_class_MongoDB_Driver_Cursor_rewind, ZEND_ACC_PUBLIC) + ZEND_ME(MongoDB_Driver_Cursor, setTypeMap, arginfo_class_MongoDB_Driver_Cursor_setTypeMap, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Cursor, toArray, arginfo_class_MongoDB_Driver_Cursor_toArray, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Cursor, valid, arginfo_class_MongoDB_Driver_Cursor_valid, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + +static zend_class_entry *register_class_MongoDB_Driver_Cursor(zend_class_entry *class_entry_Iterator, zend_class_entry *class_entry_MongoDB_Driver_CursorInterface) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Cursor", class_MongoDB_Driver_Cursor_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 2, class_entry_Iterator, class_entry_MongoDB_Driver_CursorInterface); + + return class_entry; +} diff --git a/src/MongoDB/Manager.c b/src/MongoDB/Manager.c index e43bcef5e..b825a010e 100644 --- a/src/MongoDB/Manager.c +++ b/src/MongoDB/Manager.c @@ -36,6 +36,7 @@ #include "MongoDB/Server.h" #include "MongoDB/Session.h" #include "MongoDB/WriteConcern.h" +#include "Manager_arginfo.h" #define PHONGO_MANAGER_URI_DEFAULT "mongodb://127.0.0.1/" @@ -241,9 +242,11 @@ static bool php_phongo_manager_select_server(bool for_writes, bool inherit_read_ return false; } /* }}} */ +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Manager) + /* {{{ proto void MongoDB\Driver\Manager::__construct([string $uri = "mongodb://127.0.0.1/"[, array $options = array()[, array $driverOptions = array()]]]) Constructs a new Manager */ -static PHP_METHOD(Manager, __construct) +static PHP_METHOD(MongoDB_Driver_Manager, __construct) { php_phongo_manager_t* intern; char* uri_string = NULL; @@ -286,7 +289,7 @@ static PHP_METHOD(Manager, __construct) /* {{{ proto void MongoDB\Driver\Manager::addSubscriber(MongoDB\Driver\Monitoring\Subscriber $subscriber) Registers an event subscriber for this Manager */ -static PHP_METHOD(Manager, addSubscriber) +static PHP_METHOD(MongoDB_Driver_Manager, addSubscriber) { php_phongo_manager_t* intern; zval* subscriber; @@ -308,7 +311,7 @@ static PHP_METHOD(Manager, addSubscriber) /* {{{ proto MongoDB\Driver\ClientEncryption MongoDB\Driver\Manager::createClientEncryption(array $options) Return a ClientEncryption instance */ -static PHP_METHOD(Manager, createClientEncryption) +static PHP_METHOD(MongoDB_Driver_Manager, createClientEncryption) { zval* options; @@ -324,7 +327,7 @@ static PHP_METHOD(Manager, createClientEncryption) /* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeCommand(string $db, MongoDB\Driver\Command $command[, array $options = null]) Execute a Command */ -static PHP_METHOD(Manager, executeCommand) +static PHP_METHOD(MongoDB_Driver_Manager, executeCommand) { php_phongo_manager_t* intern; char* db; @@ -377,7 +380,7 @@ static PHP_METHOD(Manager, executeCommand) /* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeReadCommand(string $db, MongoDB\Driver\Command $command[, array $options = null]) Execute a ReadCommand */ -static PHP_METHOD(Manager, executeReadCommand) +static PHP_METHOD(MongoDB_Driver_Manager, executeReadCommand) { php_phongo_manager_t* intern; char* db; @@ -422,7 +425,7 @@ static PHP_METHOD(Manager, executeReadCommand) /* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeWriteCommand(string $db, MongoDB\Driver\Command $command[, array $options = null]) Execute a WriteCommand */ -static PHP_METHOD(Manager, executeWriteCommand) +static PHP_METHOD(MongoDB_Driver_Manager, executeWriteCommand) { php_phongo_manager_t* intern; char* db; @@ -461,7 +464,7 @@ static PHP_METHOD(Manager, executeWriteCommand) /* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeReadWriteCommand(string $db, MongoDB\Driver\Command $command[, array $options = null]) Execute a ReadWriteCommand */ -static PHP_METHOD(Manager, executeReadWriteCommand) +static PHP_METHOD(MongoDB_Driver_Manager, executeReadWriteCommand) { php_phongo_manager_t* intern; char* db; @@ -500,7 +503,7 @@ static PHP_METHOD(Manager, executeReadWriteCommand) /* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeQuery(string $namespace, MongoDB\Driver\Query $query[, array $options = null]) Execute a Query */ -static PHP_METHOD(Manager, executeQuery) +static PHP_METHOD(MongoDB_Driver_Manager, executeQuery) { php_phongo_manager_t* intern; char* namespace; @@ -553,7 +556,7 @@ static PHP_METHOD(Manager, executeQuery) /* {{{ proto MongoDB\Driver\WriteResult MongoDB\Driver\Manager::executeBulkWrite(string $namespace, MongoDB\Driver\BulkWrite $zbulk[, array $options = null]) Executes a BulkWrite (i.e. any number of insert, update, and delete ops) */ -static PHP_METHOD(Manager, executeBulkWrite) +static PHP_METHOD(MongoDB_Driver_Manager, executeBulkWrite) { php_phongo_manager_t* intern; char* namespace; @@ -601,7 +604,7 @@ static PHP_METHOD(Manager, executeBulkWrite) /* {{{ proto array|object|null MongoDB\Driver\Manager::getEncryptedFieldsMap() Returns the autoEncryption.encryptedFieldsMap driver option */ -static PHP_METHOD(Manager, getEncryptedFieldsMap) +static PHP_METHOD(MongoDB_Driver_Manager, getEncryptedFieldsMap) { php_phongo_manager_t* intern; @@ -616,7 +619,7 @@ static PHP_METHOD(Manager, getEncryptedFieldsMap) /* {{{ proto MongoDB\Driver\ReadConcern MongoDB\Driver\Manager::getReadConcern() Returns the ReadConcern associated with this Manager */ -static PHP_METHOD(Manager, getReadConcern) +static PHP_METHOD(MongoDB_Driver_Manager, getReadConcern) { php_phongo_manager_t* intern; @@ -629,7 +632,7 @@ static PHP_METHOD(Manager, getReadConcern) /* {{{ proto MongoDB\Driver\ReadPreference MongoDB\Driver\Manager::getReadPreference() Returns the ReadPreference associated with this Manager */ -static PHP_METHOD(Manager, getReadPreference) +static PHP_METHOD(MongoDB_Driver_Manager, getReadPreference) { php_phongo_manager_t* intern; @@ -642,7 +645,7 @@ static PHP_METHOD(Manager, getReadPreference) /* {{{ proto MongoDB\Driver\Server[] MongoDB\Driver\Manager::getServers() Returns the Servers associated with this Manager */ -static PHP_METHOD(Manager, getServers) +static PHP_METHOD(MongoDB_Driver_Manager, getServers) { php_phongo_manager_t* intern; mongoc_server_description_t** sds; @@ -667,7 +670,7 @@ static PHP_METHOD(Manager, getServers) /* {{{ proto MongoDB\Driver\WriteConcern MongoDB\Driver\Manager::getWriteConcern() Returns the WriteConcern associated with this Manager */ -static PHP_METHOD(Manager, getWriteConcern) +static PHP_METHOD(MongoDB_Driver_Manager, getWriteConcern) { php_phongo_manager_t* intern; @@ -680,7 +683,7 @@ static PHP_METHOD(Manager, getWriteConcern) /* {{{ proto void MongoDB\Driver\Manager::removeSubscriber(MongoDB\Driver\Monitoring\Subscriber $subscriber) Unregisters an event subscriber for this Manager */ -static PHP_METHOD(Manager, removeSubscriber) +static PHP_METHOD(MongoDB_Driver_Manager, removeSubscriber) { php_phongo_manager_t* intern; zval* subscriber; @@ -699,9 +702,9 @@ static PHP_METHOD(Manager, removeSubscriber) phongo_apm_remove_subscriber(intern->subscribers, subscriber); } /* }}} */ -/* {{{ proto MongoDB\Driver\Server MongoDB\Driver\Manager::selectServers([MongoDB\Driver\ReadPreference $readPreference = null]) +/* {{{ proto MongoDB\Driver\Server MongoDB\Driver\Manager::selectServer([MongoDB\Driver\ReadPreference $readPreference = null]) Selects a Server for the given ReadPreference (default: primary). */ -static PHP_METHOD(Manager, selectServer) +static PHP_METHOD(MongoDB_Driver_Manager, selectServer) { php_phongo_manager_t* intern; zval* zreadPreference = NULL; @@ -724,7 +727,7 @@ static PHP_METHOD(Manager, selectServer) /* {{{ proto MongoDB\Driver\Session MongoDB\Driver\Manager::startSession([array $options = null]) Returns a new client session */ -static PHP_METHOD(Manager, startSession) +static PHP_METHOD(MongoDB_Driver_Manager, startSession) { php_phongo_manager_t* intern; zval* options = NULL; @@ -808,85 +811,6 @@ static PHP_METHOD(Manager, startSession) } } /* }}} */ -/* {{{ MongoDB\Driver\Manager function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_Manager___construct, 0, 0, 0) - ZEND_ARG_INFO(0, uri) - ZEND_ARG_ARRAY_INFO(0, options, 0) - ZEND_ARG_ARRAY_INFO(0, driverOptions, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Manager_addSubscriber, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, subscriber, MongoDB\\Driver\\Monitoring\\Subscriber, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Manager_createClientEncryption, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, options, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Manager_executeCommand, 0, 0, 2) - ZEND_ARG_INFO(0, db) - ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) - ZEND_ARG_INFO(0, options) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Manager_executeRWCommand, 0, 0, 2) - ZEND_ARG_INFO(0, db) - ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) - ZEND_ARG_ARRAY_INFO(0, options, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Manager_executeQuery, 0, 0, 2) - ZEND_ARG_INFO(0, namespace) - ZEND_ARG_OBJ_INFO(0, zquery, MongoDB\\Driver\\Query, 0) - ZEND_ARG_INFO(0, options) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Manager_executeBulkWrite, 0, 0, 2) - ZEND_ARG_INFO(0, namespace) - ZEND_ARG_OBJ_INFO(0, zbulk, MongoDB\\Driver\\BulkWrite, 0) - ZEND_ARG_INFO(0, options) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Manager_removeSubscriber, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, subscriber, MongoDB\\Driver\\Monitoring\\Subscriber, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Manager_selectServer, 0, 0, 0) - ZEND_ARG_OBJ_INFO(0, readPreference, MongoDB\\Driver\\ReadPreference, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Manager_startSession, 0, 0, 0) - ZEND_ARG_ARRAY_INFO(0, options, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Manager_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_manager_me[] = { - /* clang-format off */ - PHP_ME(Manager, __construct, ai_Manager___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, addSubscriber, ai_Manager_addSubscriber, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, createClientEncryption, ai_Manager_createClientEncryption, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, executeCommand, ai_Manager_executeCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, executeReadCommand, ai_Manager_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, executeWriteCommand, ai_Manager_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, executeReadWriteCommand, ai_Manager_executeCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, executeQuery, ai_Manager_executeQuery, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, executeBulkWrite, ai_Manager_executeBulkWrite, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, getEncryptedFieldsMap, ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, getReadConcern, ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, getReadPreference, ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, getServers, ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, getWriteConcern, ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, removeSubscriber, ai_Manager_removeSubscriber, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, selectServer, ai_Manager_selectServer, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Manager, startSession, ai_Manager_startSession, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Manager_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Manager object handlers */ static zend_object_handlers php_phongo_handler_manager; @@ -991,12 +915,8 @@ static HashTable* php_phongo_manager_get_debug_info(phongo_compat_object_handler void php_phongo_manager_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Manager", php_phongo_manager_me); - php_phongo_manager_ce = zend_register_internal_class(&ce); + php_phongo_manager_ce = register_class_MongoDB_Driver_Manager(); php_phongo_manager_ce->create_object = php_phongo_manager_create_object; - PHONGO_CE_FINAL(php_phongo_manager_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_manager_ce); memcpy(&php_phongo_handler_manager, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/Manager.stub.php b/src/MongoDB/Manager.stub.php new file mode 100644 index 000000000..37702b21e --- /dev/null +++ b/src/MongoDB/Manager.stub.php @@ -0,0 +1,64 @@ += 80000 + final public function executeBulkWrite(string $namespace, BulkWrite $bulk, array|WriteConcern|null $options = null): WriteResult {} + + final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): Cursor {} + + final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} +#else + /** @param array|WriteConcern|null $options */ + final public function executeBulkWrite(string $namespace, BulkWrite $bulk, $options = null): WriteResult {} + + /** @param array|ReadPreference|null $options */ + final public function executeCommand(string $db, Command $command, $options = null): Cursor {} + + /** @param array|ReadPreference|null $options */ + final public function executeQuery(string $namespace, Query $query, $options = null): Cursor {} +#endif + + final public function executeReadCommand(string $db, Command $command, array $options = []): Cursor {} + + final public function executeReadWriteCommand(string $db, Command $command, array $options = []): Cursor {} + + final public function executeWriteCommand(string $db, Command $command, array $options = []): Cursor {} + +#if PHP_VERSION_ID >= 80000 + final public function getEncryptedFieldsMap(): array|object|null {} +#else + /** @return array|object|null */ + final public function getEncryptedFieldsMap() {} +#endif + + final public function getReadConcern(): ReadConcern {} + + final public function getReadPreference(): ReadPreference {} + + final public function getServers(): array {} + + final public function getWriteConcern(): WriteConcern {} + + final public function removeSubscriber(Monitoring\Subscriber $subscriber): void {} + + final public function selectServer(?ReadPreference $readPreference = null): Server {} + + final public function startSession(array $options = []): Session {} + + final public function __wakeup(): void {} + } +} diff --git a/src/MongoDB/Manager_arginfo.h b/src/MongoDB/Manager_arginfo.h new file mode 100644 index 000000000..50aa26ad7 --- /dev/null +++ b/src/MongoDB/Manager_arginfo.h @@ -0,0 +1,203 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 7e357d21edd6839a1a7d80d75271be4b3c50231f */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Manager___construct, 0, 0, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, uri, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, uriOptions, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, driverOptions, IS_ARRAY, 1, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Manager_addSubscriber, 0, 1, IS_VOID, 0) + ZEND_ARG_OBJ_INFO(0, subscriber, MongoDB\\Driver\\Monitoring\\Subscriber, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_createClientEncryption, 0, 1, MongoDB\\Driver\\ClientEncryption, 0) + ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) + ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, bulk, MongoDB\\Driver\\BulkWrite, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\WriteConcern, MAY_BE_ARRAY|MAY_BE_NULL, "null") +ZEND_END_ARG_INFO() +#endif + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") +ZEND_END_ARG_INFO() +#endif + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) + ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, bulk, MongoDB\\Driver\\BulkWrite, 0) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeReadCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_Driver_Manager_executeReadWriteCommand arginfo_class_MongoDB_Driver_Manager_executeReadCommand + +#define arginfo_class_MongoDB_Driver_Manager_executeWriteCommand arginfo_class_MongoDB_Driver_Manager_executeReadCommand + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_Manager_getEncryptedFieldsMap, 0, 0, MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_NULL) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Manager_getEncryptedFieldsMap, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_getReadConcern, 0, 0, MongoDB\\Driver\\ReadConcern, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_getReadPreference, 0, 0, MongoDB\\Driver\\ReadPreference, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Manager_getServers, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_getWriteConcern, 0, 0, MongoDB\\Driver\\WriteConcern, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_Driver_Manager_removeSubscriber arginfo_class_MongoDB_Driver_Manager_addSubscriber + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_selectServer, 0, 0, MongoDB\\Driver\\Server, 0) + ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, readPreference, MongoDB\\Driver\\ReadPreference, 1, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_startSession, 0, 0, MongoDB\\Driver\\Session, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Manager___wakeup, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + + +static ZEND_METHOD(MongoDB_Driver_Manager, __construct); +static ZEND_METHOD(MongoDB_Driver_Manager, addSubscriber); +static ZEND_METHOD(MongoDB_Driver_Manager, createClientEncryption); +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Manager, executeBulkWrite); +#endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Manager, executeCommand); +#endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Manager, executeQuery); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_Manager, executeBulkWrite); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_Manager, executeCommand); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_Manager, executeQuery); +#endif +static ZEND_METHOD(MongoDB_Driver_Manager, executeReadCommand); +static ZEND_METHOD(MongoDB_Driver_Manager, executeReadWriteCommand); +static ZEND_METHOD(MongoDB_Driver_Manager, executeWriteCommand); +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Manager, getEncryptedFieldsMap); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_Manager, getEncryptedFieldsMap); +#endif +static ZEND_METHOD(MongoDB_Driver_Manager, getReadConcern); +static ZEND_METHOD(MongoDB_Driver_Manager, getReadPreference); +static ZEND_METHOD(MongoDB_Driver_Manager, getServers); +static ZEND_METHOD(MongoDB_Driver_Manager, getWriteConcern); +static ZEND_METHOD(MongoDB_Driver_Manager, removeSubscriber); +static ZEND_METHOD(MongoDB_Driver_Manager, selectServer); +static ZEND_METHOD(MongoDB_Driver_Manager, startSession); +static ZEND_METHOD(MongoDB_Driver_Manager, __wakeup); + + +static const zend_function_entry class_MongoDB_Driver_Manager_methods[] = { + ZEND_ME(MongoDB_Driver_Manager, __construct, arginfo_class_MongoDB_Driver_Manager___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Manager, addSubscriber, arginfo_class_MongoDB_Driver_Manager_addSubscriber, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Manager, createClientEncryption, arginfo_class_MongoDB_Driver_Manager_createClientEncryption, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Manager, executeBulkWrite, arginfo_class_MongoDB_Driver_Manager_executeBulkWrite, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Manager, executeCommand, arginfo_class_MongoDB_Driver_Manager_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Manager, executeQuery, arginfo_class_MongoDB_Driver_Manager_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_Manager, executeBulkWrite, arginfo_class_MongoDB_Driver_Manager_executeBulkWrite, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_Manager, executeCommand, arginfo_class_MongoDB_Driver_Manager_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_Manager, executeQuery, arginfo_class_MongoDB_Driver_Manager_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_Driver_Manager, executeReadCommand, arginfo_class_MongoDB_Driver_Manager_executeReadCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Manager, executeReadWriteCommand, arginfo_class_MongoDB_Driver_Manager_executeReadWriteCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Manager, executeWriteCommand, arginfo_class_MongoDB_Driver_Manager_executeWriteCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Manager, getEncryptedFieldsMap, arginfo_class_MongoDB_Driver_Manager_getEncryptedFieldsMap, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_Manager, getEncryptedFieldsMap, arginfo_class_MongoDB_Driver_Manager_getEncryptedFieldsMap, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_Driver_Manager, getReadConcern, arginfo_class_MongoDB_Driver_Manager_getReadConcern, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Manager, getReadPreference, arginfo_class_MongoDB_Driver_Manager_getReadPreference, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Manager, getServers, arginfo_class_MongoDB_Driver_Manager_getServers, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Manager, getWriteConcern, arginfo_class_MongoDB_Driver_Manager_getWriteConcern, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Manager, removeSubscriber, arginfo_class_MongoDB_Driver_Manager_removeSubscriber, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Manager, selectServer, arginfo_class_MongoDB_Driver_Manager_selectServer, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Manager, startSession, arginfo_class_MongoDB_Driver_Manager_startSession, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Manager, __wakeup, arginfo_class_MongoDB_Driver_Manager___wakeup, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_FE_END +}; + +static zend_class_entry *register_class_MongoDB_Driver_Manager(void) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Manager", class_MongoDB_Driver_Manager_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/Query.c b/src/MongoDB/Query.c index 338b90158..ca611ecf8 100644 --- a/src/MongoDB/Query.c +++ b/src/MongoDB/Query.c @@ -27,6 +27,7 @@ #include "phongo_error.h" #include "MongoDB/ReadConcern.h" +#include "Query_arginfo.h" zend_class_entry* php_phongo_query_ce; @@ -387,9 +388,11 @@ static bool php_phongo_query_init(php_phongo_query_t* intern, zval* filter, zval #undef PHONGO_QUERY_OPT_INT64_DEPRECATED #undef PHONGO_QUERY_OPT_STRING +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Query) + /* {{{ proto void MongoDB\Driver\Query::__construct(array|object $filter[, array $options = array()]) Constructs a new Query */ -static PHP_METHOD(Query, __construct) +static PHP_METHOD(MongoDB_Driver_Query, __construct) { php_phongo_query_t* intern; zval* filter; @@ -406,24 +409,6 @@ static PHP_METHOD(Query, __construct) php_phongo_query_init(intern, filter, options); } /* }}} */ -/* {{{ MongoDB\Driver\Query function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_Query___construct, 0, 0, 1) - ZEND_ARG_INFO(0, filter) - ZEND_ARG_ARRAY_INFO(0, options, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Query_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_query_me[] = { - /* clang-format off */ - PHP_ME(Query, __construct, ai_Query___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Query_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Query object handlers */ static zend_object_handlers php_phongo_handler_query; @@ -513,12 +498,8 @@ static HashTable* php_phongo_query_get_debug_info(phongo_compat_object_handler_t void php_phongo_query_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Query", php_phongo_query_me); - php_phongo_query_ce = zend_register_internal_class(&ce); + php_phongo_query_ce = register_class_MongoDB_Driver_Query(); php_phongo_query_ce->create_object = php_phongo_query_create_object; - PHONGO_CE_FINAL(php_phongo_query_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_query_ce); memcpy(&php_phongo_handler_query, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/Query.stub.php b/src/MongoDB/Query.stub.php new file mode 100644 index 000000000..143554aee --- /dev/null +++ b/src/MongoDB/Query.stub.php @@ -0,0 +1,21 @@ += 80000 + final public function __construct(array|object $filter, array $queryOptions = []) {} +#else + /** @param array|object $filter */ + final public function __construct($filter, array $queryOptions = []) {} +#endif + + final public function __wakeup(): void {} + } +} diff --git a/src/MongoDB/Query_arginfo.h b/src/MongoDB/Query_arginfo.h new file mode 100644 index 000000000..3576ace0b --- /dev/null +++ b/src/MongoDB/Query_arginfo.h @@ -0,0 +1,51 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 4c8de9c6f7a77a5428000f1843395a950c97f279 */ + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Query___construct, 0, 0, 1) + ZEND_ARG_TYPE_MASK(0, filter, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, queryOptions, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Query___construct, 0, 0, 1) + ZEND_ARG_INFO(0, filter) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, queryOptions, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Query___wakeup, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + + +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Query, __construct); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_Query, __construct); +#endif +static ZEND_METHOD(MongoDB_Driver_Query, __wakeup); + + +static const zend_function_entry class_MongoDB_Driver_Query_methods[] = { +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Query, __construct, arginfo_class_MongoDB_Driver_Query___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_Query, __construct, arginfo_class_MongoDB_Driver_Query___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_Driver_Query, __wakeup, arginfo_class_MongoDB_Driver_Query___wakeup, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_FE_END +}; + +static zend_class_entry *register_class_MongoDB_Driver_Query(void) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Query", class_MongoDB_Driver_Query_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/ReadConcern.c b/src/MongoDB/ReadConcern.c index 087ebee86..dbecc2afb 100644 --- a/src/MongoDB/ReadConcern.c +++ b/src/MongoDB/ReadConcern.c @@ -23,6 +23,7 @@ #include "php_phongo.h" #include "phongo_error.h" +#include "ReadConcern_arginfo.h" zend_class_entry* php_phongo_readconcern_ce; @@ -54,7 +55,7 @@ static bool php_phongo_readconcern_init_from_hash(php_phongo_readconcern_t* inte /* {{{ proto void MongoDB\Driver\ReadConcern::__construct([string $level]) Constructs a new ReadConcern */ -static PHP_METHOD(ReadConcern, __construct) +static PHP_METHOD(MongoDB_Driver_ReadConcern, __construct) { php_phongo_readconcern_t* intern; char* level = NULL; @@ -76,7 +77,7 @@ static PHP_METHOD(ReadConcern, __construct) /* {{{ proto MongoDB\Driver\ReadConcern MongoDB\Driver\ReadConcern::__set_state(array $properties) */ -static PHP_METHOD(ReadConcern, __set_state) +static PHP_METHOD(MongoDB_Driver_ReadConcern, __set_state) { php_phongo_readconcern_t* intern; HashTable* props; @@ -96,7 +97,7 @@ static PHP_METHOD(ReadConcern, __set_state) /* {{{ proto string|null MongoDB\Driver\ReadConcern::getLevel() Returns the ReadConcern "level" option */ -static PHP_METHOD(ReadConcern, getLevel) +static PHP_METHOD(MongoDB_Driver_ReadConcern, getLevel) { php_phongo_readconcern_t* intern; const char* level; @@ -117,7 +118,7 @@ static PHP_METHOD(ReadConcern, getLevel) /* {{{ proto boolean MongoDB\Driver\ReadConcern::isDefault() Returns whether the read concern has not been modified (i.e. constructed without a level or from a Manager with no read concern URI options). */ -static PHP_METHOD(ReadConcern, isDefault) +static PHP_METHOD(MongoDB_Driver_ReadConcern, isDefault) { php_phongo_readconcern_t* intern; @@ -156,7 +157,7 @@ static HashTable* php_phongo_readconcern_get_properties_hash(phongo_compat_objec /* {{{ proto array MongoDB\Driver\ReadConcern::bsonSerialize() */ -static PHP_METHOD(ReadConcern, bsonSerialize) +static PHP_METHOD(MongoDB_Driver_ReadConcern, bsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -166,7 +167,7 @@ static PHP_METHOD(ReadConcern, bsonSerialize) /* {{{ proto string MongoDB\Driver\ReadConcern::serialize() */ -static PHP_METHOD(ReadConcern, serialize) +static PHP_METHOD(MongoDB_Driver_ReadConcern, serialize) { php_phongo_readconcern_t* intern; zval retval; @@ -204,7 +205,7 @@ static PHP_METHOD(ReadConcern, serialize) /* {{{ proto void MongoDB\Driver\ReadConcern::unserialize(string $serialized) */ -static PHP_METHOD(ReadConcern, unserialize) +static PHP_METHOD(MongoDB_Driver_ReadConcern, unserialize) { php_phongo_readconcern_t* intern; char* serialized; @@ -238,7 +239,7 @@ static PHP_METHOD(ReadConcern, unserialize) /* {{{ proto array MongoDB\Driver\ReadConcern::__serialize() */ -static PHP_METHOD(ReadConcern, __serialize) +static PHP_METHOD(MongoDB_Driver_ReadConcern, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -247,7 +248,7 @@ static PHP_METHOD(ReadConcern, __serialize) /* {{{ proto void MongoDB\Driver\ReadConcern::__unserialize(array $data) */ -static PHP_METHOD(ReadConcern, __unserialize) +static PHP_METHOD(MongoDB_Driver_ReadConcern, __unserialize) { zval* data; @@ -258,42 +259,6 @@ static PHP_METHOD(ReadConcern, __unserialize) php_phongo_readconcern_init_from_hash(Z_READCONCERN_OBJ_P(getThis()), Z_ARRVAL_P(data)); } /* }}} */ -/* {{{ MongoDB\Driver\ReadConcern function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_ReadConcern___construct, 0, 0, 0) - ZEND_ARG_INFO(0, level) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ReadConcern___set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, properties, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ReadConcern___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ReadConcern_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ReadConcern_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_readconcern_me[] = { - /* clang-format off */ - PHP_ME(ReadConcern, __construct, ai_ReadConcern___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadConcern, __serialize, ai_ReadConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadConcern, __set_state, ai_ReadConcern___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(ReadConcern, __unserialize, ai_ReadConcern___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadConcern, getLevel, ai_ReadConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadConcern, isDefault, ai_ReadConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadConcern, bsonSerialize, ai_ReadConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadConcern, serialize, ai_ReadConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadConcern, unserialize, ai_ReadConcern_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\ReadConcern object handlers */ static zend_object_handlers php_phongo_handler_readconcern; @@ -338,27 +303,14 @@ static HashTable* php_phongo_readconcern_get_properties(phongo_compat_object_han void php_phongo_readconcern_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ReadConcern", php_phongo_readconcern_me); - php_phongo_readconcern_ce = zend_register_internal_class(&ce); + php_phongo_readconcern_ce = register_class_MongoDB_Driver_ReadConcern(php_phongo_serializable_ce, zend_ce_serializable); php_phongo_readconcern_ce->create_object = php_phongo_readconcern_create_object; - PHONGO_CE_FINAL(php_phongo_readconcern_ce); - - zend_class_implements(php_phongo_readconcern_ce, 1, php_phongo_serializable_ce); - zend_class_implements(php_phongo_readconcern_ce, 1, zend_ce_serializable); memcpy(&php_phongo_handler_readconcern, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_readconcern.get_debug_info = php_phongo_readconcern_get_debug_info; php_phongo_handler_readconcern.get_properties = php_phongo_readconcern_get_properties; php_phongo_handler_readconcern.free_obj = php_phongo_readconcern_free_object; php_phongo_handler_readconcern.offset = XtOffsetOf(php_phongo_readconcern_t, std); - - zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("LOCAL"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_LOCAL)); - zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("MAJORITY"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_MAJORITY)); - zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("LINEARIZABLE"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_LINEARIZABLE)); - zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("AVAILABLE"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_AVAILABLE)); - zend_declare_class_constant_stringl(php_phongo_readconcern_ce, ZEND_STRL("SNAPSHOT"), ZEND_STRL(MONGOC_READ_CONCERN_LEVEL_SNAPSHOT)); } /* }}} */ void phongo_readconcern_init(zval* return_value, const mongoc_read_concern_t* read_concern) /* {{{ */ diff --git a/src/MongoDB/ReadConcern.stub.php b/src/MongoDB/ReadConcern.stub.php new file mode 100644 index 000000000..7584eb1da --- /dev/null +++ b/src/MongoDB/ReadConcern.stub.php @@ -0,0 +1,67 @@ += 80000 + final public function bsonSerialize(): array|object {} +#else + /** @return array|object */ + final public function bsonSerialize() {} +#endif + + final public function serialize(): string {} + + /** @param string $serialized */ + final public function unserialize($serialized): void {} + + final public function __unserialize(array $data): void {} + + final public function __serialize(): array {} + + } +} diff --git a/src/MongoDB/ReadConcern_arginfo.h b/src/MongoDB/ReadConcern_arginfo.h new file mode 100644 index 000000000..6094d465b --- /dev/null +++ b/src/MongoDB/ReadConcern_arginfo.h @@ -0,0 +1,122 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 2b46ec105aab22bdcad264fa797d7f59a60aec22 */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern___construct, 0, 0, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, level, IS_STRING, 1, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern_getLevel, 0, 0, IS_STRING, 1) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern_isDefault, 0, 0, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern___set_state, 0, 1, MongoDB\\Driver\\ReadConcern, 0) + ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_ReadConcern_bsonSerialize, 0, 0, MAY_BE_ARRAY|MAY_BE_OBJECT) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern_bsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern_serialize, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern___unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern___serialize, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + + +static ZEND_METHOD(MongoDB_Driver_ReadConcern, __construct); +static ZEND_METHOD(MongoDB_Driver_ReadConcern, getLevel); +static ZEND_METHOD(MongoDB_Driver_ReadConcern, isDefault); +static ZEND_METHOD(MongoDB_Driver_ReadConcern, __set_state); +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_ReadConcern, bsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_ReadConcern, bsonSerialize); +#endif +static ZEND_METHOD(MongoDB_Driver_ReadConcern, serialize); +static ZEND_METHOD(MongoDB_Driver_ReadConcern, unserialize); +static ZEND_METHOD(MongoDB_Driver_ReadConcern, __unserialize); +static ZEND_METHOD(MongoDB_Driver_ReadConcern, __serialize); + + +static const zend_function_entry class_MongoDB_Driver_ReadConcern_methods[] = { + ZEND_ME(MongoDB_Driver_ReadConcern, __construct, arginfo_class_MongoDB_Driver_ReadConcern___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadConcern, getLevel, arginfo_class_MongoDB_Driver_ReadConcern_getLevel, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadConcern, isDefault, arginfo_class_MongoDB_Driver_ReadConcern_isDefault, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadConcern, __set_state, arginfo_class_MongoDB_Driver_ReadConcern___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_ReadConcern, bsonSerialize, arginfo_class_MongoDB_Driver_ReadConcern_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_ReadConcern, bsonSerialize, arginfo_class_MongoDB_Driver_ReadConcern_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_Driver_ReadConcern, serialize, arginfo_class_MongoDB_Driver_ReadConcern_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadConcern, unserialize, arginfo_class_MongoDB_Driver_ReadConcern_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadConcern, __unserialize, arginfo_class_MongoDB_Driver_ReadConcern___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadConcern, __serialize, arginfo_class_MongoDB_Driver_ReadConcern___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_FE_END +}; + +static zend_class_entry *register_class_MongoDB_Driver_ReadConcern(zend_class_entry *class_entry_MongoDB_BSON_Serializable, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ReadConcern", class_MongoDB_Driver_ReadConcern_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 2, class_entry_MongoDB_BSON_Serializable, class_entry_Serializable); + + zval const_LINEARIZABLE_value; + zend_string *const_LINEARIZABLE_value_str = zend_string_init(MONGOC_READ_CONCERN_LEVEL_LINEARIZABLE, sizeof(MONGOC_READ_CONCERN_LEVEL_LINEARIZABLE) - 1, 1); + ZVAL_STR(&const_LINEARIZABLE_value, const_LINEARIZABLE_value_str); + zend_string *const_LINEARIZABLE_name = zend_string_init_interned("LINEARIZABLE", sizeof("LINEARIZABLE") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_LINEARIZABLE_name, &const_LINEARIZABLE_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_LINEARIZABLE_name); + + zval const_LOCAL_value; + zend_string *const_LOCAL_value_str = zend_string_init(MONGOC_READ_CONCERN_LEVEL_LOCAL, sizeof(MONGOC_READ_CONCERN_LEVEL_LOCAL) - 1, 1); + ZVAL_STR(&const_LOCAL_value, const_LOCAL_value_str); + zend_string *const_LOCAL_name = zend_string_init_interned("LOCAL", sizeof("LOCAL") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_LOCAL_name, &const_LOCAL_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_LOCAL_name); + + zval const_MAJORITY_value; + zend_string *const_MAJORITY_value_str = zend_string_init(MONGOC_READ_CONCERN_LEVEL_MAJORITY, sizeof(MONGOC_READ_CONCERN_LEVEL_MAJORITY) - 1, 1); + ZVAL_STR(&const_MAJORITY_value, const_MAJORITY_value_str); + zend_string *const_MAJORITY_name = zend_string_init_interned("MAJORITY", sizeof("MAJORITY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_MAJORITY_name, &const_MAJORITY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_MAJORITY_name); + + zval const_AVAILABLE_value; + zend_string *const_AVAILABLE_value_str = zend_string_init(MONGOC_READ_CONCERN_LEVEL_AVAILABLE, sizeof(MONGOC_READ_CONCERN_LEVEL_AVAILABLE) - 1, 1); + ZVAL_STR(&const_AVAILABLE_value, const_AVAILABLE_value_str); + zend_string *const_AVAILABLE_name = zend_string_init_interned("AVAILABLE", sizeof("AVAILABLE") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_AVAILABLE_name, &const_AVAILABLE_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_AVAILABLE_name); + + zval const_SNAPSHOT_value; + zend_string *const_SNAPSHOT_value_str = zend_string_init(MONGOC_READ_CONCERN_LEVEL_SNAPSHOT, sizeof(MONGOC_READ_CONCERN_LEVEL_SNAPSHOT) - 1, 1); + ZVAL_STR(&const_SNAPSHOT_value, const_SNAPSHOT_value_str); + zend_string *const_SNAPSHOT_name = zend_string_init_interned("SNAPSHOT", sizeof("SNAPSHOT") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_SNAPSHOT_name, &const_SNAPSHOT_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_SNAPSHOT_name); + + return class_entry; +} diff --git a/src/MongoDB/ReadPreference.c b/src/MongoDB/ReadPreference.c index 6b3a216e5..73d614c77 100644 --- a/src/MongoDB/ReadPreference.c +++ b/src/MongoDB/ReadPreference.c @@ -29,15 +29,10 @@ #include "phongo_error.h" #include "MongoDB/ReadPreference.h" +#include "ReadPreference_arginfo.h" zend_class_entry* php_phongo_readpreference_ce; -#define PHONGO_READ_PRIMARY "primary" -#define PHONGO_READ_PRIMARY_PREFERRED "primaryPreferred" -#define PHONGO_READ_SECONDARY "secondary" -#define PHONGO_READ_SECONDARY_PREFERRED "secondaryPreferred" -#define PHONGO_READ_NEAREST "nearest" - /* Initialize the object from a HashTable and return whether it was successful. * An exception will be thrown on error. */ static bool php_phongo_readpreference_init_from_hash(php_phongo_readpreference_t* intern, HashTable* props) /* {{{ */ @@ -182,7 +177,7 @@ static const char* php_phongo_readpreference_get_mode_string(mongoc_read_mode_t /* {{{ proto void MongoDB\Driver\ReadPreference::__construct(int|string $mode[, array $tagSets = array()[, array $options = array()]]) Constructs a new ReadPreference */ -static PHP_METHOD(ReadPreference, __construct) +static PHP_METHOD(MongoDB_Driver_ReadPreference, __construct) { php_phongo_readpreference_t* intern; zval* mode; @@ -311,7 +306,7 @@ static PHP_METHOD(ReadPreference, __construct) /* {{{ proto MongoDB\Driver\ReadPreference MongoDB\Driver\ReadPreference::__set_state(array $properties) */ -static PHP_METHOD(ReadPreference, __set_state) +static PHP_METHOD(MongoDB_Driver_ReadPreference, __set_state) { php_phongo_readpreference_t* intern; HashTable* props; @@ -334,7 +329,7 @@ static PHP_METHOD(ReadPreference, __set_state) /* {{{ proto array|null MongoDB\Driver\ReadPreference::getHedge() Returns the ReadPreference hedge document */ -static PHP_METHOD(ReadPreference, getHedge) +static PHP_METHOD(MongoDB_Driver_ReadPreference, getHedge) { php_phongo_readpreference_t* intern; const bson_t* hedge; @@ -363,7 +358,7 @@ static PHP_METHOD(ReadPreference, getHedge) /* {{{ proto integer MongoDB\Driver\ReadPreference::getMaxStalenessSeconds() Returns the ReadPreference maxStalenessSeconds value */ -static PHP_METHOD(ReadPreference, getMaxStalenessSeconds) +static PHP_METHOD(MongoDB_Driver_ReadPreference, getMaxStalenessSeconds) { php_phongo_readpreference_t* intern; @@ -376,7 +371,7 @@ static PHP_METHOD(ReadPreference, getMaxStalenessSeconds) /* {{{ proto integer MongoDB\Driver\ReadPreference::getMode() Returns the ReadPreference mode */ -static PHP_METHOD(ReadPreference, getMode) +static PHP_METHOD(MongoDB_Driver_ReadPreference, getMode) { php_phongo_readpreference_t* intern; @@ -389,7 +384,7 @@ static PHP_METHOD(ReadPreference, getMode) /* {{{ proto string MongoDB\Driver\ReadPreference::getModeString() Returns the ReadPreference mode as string */ -static PHP_METHOD(ReadPreference, getModeString) +static PHP_METHOD(MongoDB_Driver_ReadPreference, getModeString) { php_phongo_readpreference_t* intern; const char* mode_string; @@ -409,7 +404,7 @@ static PHP_METHOD(ReadPreference, getModeString) /* {{{ proto array MongoDB\Driver\ReadPreference::getTagSets() Returns the ReadPreference tag sets */ -static PHP_METHOD(ReadPreference, getTagSets) +static PHP_METHOD(MongoDB_Driver_ReadPreference, getTagSets) { php_phongo_readpreference_t* intern; const bson_t* tags; @@ -510,7 +505,7 @@ static HashTable* php_phongo_readpreference_get_properties_hash(phongo_compat_ob /* {{{ proto array MongoDB\Driver\ReadPreference::bsonSerialize() */ -static PHP_METHOD(ReadPreference, bsonSerialize) +static PHP_METHOD(MongoDB_Driver_ReadPreference, bsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -520,7 +515,7 @@ static PHP_METHOD(ReadPreference, bsonSerialize) /* {{{ proto string MongoDB\Driver\ReadPreference::serialize() */ -static PHP_METHOD(ReadPreference, serialize) +static PHP_METHOD(MongoDB_Driver_ReadPreference, serialize) { php_phongo_readpreference_t* intern; zval retval; @@ -595,7 +590,7 @@ static PHP_METHOD(ReadPreference, serialize) /* {{{ proto void MongoDB\Driver\ReadPreference::unserialize(string $serialized) */ -static PHP_METHOD(ReadPreference, unserialize) +static PHP_METHOD(MongoDB_Driver_ReadPreference, unserialize) { php_phongo_readpreference_t* intern; char* serialized; @@ -629,7 +624,7 @@ static PHP_METHOD(ReadPreference, unserialize) /* {{{ proto array MongoDB\Driver\ReadPreference::__serialize() */ -static PHP_METHOD(ReadPreference, __serialize) +static PHP_METHOD(MongoDB_Driver_ReadPreference, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -638,7 +633,7 @@ static PHP_METHOD(ReadPreference, __serialize) /* {{{ proto void MongoDB\Driver\ReadPreference::__unserialize(array $data) */ -static PHP_METHOD(ReadPreference, __unserialize) +static PHP_METHOD(MongoDB_Driver_ReadPreference, __unserialize) { zval* data; @@ -649,47 +644,6 @@ static PHP_METHOD(ReadPreference, __unserialize) php_phongo_readpreference_init_from_hash(Z_READPREFERENCE_OBJ_P(getThis()), Z_ARRVAL_P(data)); } /* }}} */ -/* {{{ MongoDB\Driver\ReadPreference function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_ReadPreference___construct, 0, 0, 1) - ZEND_ARG_INFO(0, mode) - ZEND_ARG_ARRAY_INFO(0, tagSets, 1) - ZEND_ARG_ARRAY_INFO(0, options, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ReadPreference___set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, properties, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ReadPreference___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ReadPreference_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ReadPreference_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_readpreference_me[] = { - /* clang-format off */ - PHP_ME(ReadPreference, __construct, ai_ReadPreference___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadPreference, __serialize, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadPreference, __set_state, ai_ReadPreference___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(ReadPreference, __unserialize, ai_ReadPreference___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadPreference, getHedge, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadPreference, getMaxStalenessSeconds, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadPreference, getMode, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadPreference, getModeString, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadPreference, getTagSets, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadPreference, bsonSerialize, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadPreference, serialize, ai_ReadPreference_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ReadPreference, unserialize, ai_ReadPreference_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\ReadPreference object handlers */ static zend_object_handlers php_phongo_handler_readpreference; @@ -735,35 +689,14 @@ static HashTable* php_phongo_readpreference_get_properties(phongo_compat_object_ void php_phongo_readpreference_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ReadPreference", php_phongo_readpreference_me); - php_phongo_readpreference_ce = zend_register_internal_class(&ce); + php_phongo_readpreference_ce = register_class_MongoDB_Driver_ReadPreference(php_phongo_serializable_ce, zend_ce_serializable); php_phongo_readpreference_ce->create_object = php_phongo_readpreference_create_object; - PHONGO_CE_FINAL(php_phongo_readpreference_ce); - - zend_class_implements(php_phongo_readpreference_ce, 1, php_phongo_serializable_ce); - zend_class_implements(php_phongo_readpreference_ce, 1, zend_ce_serializable); memcpy(&php_phongo_handler_readpreference, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_readpreference.get_debug_info = php_phongo_readpreference_get_debug_info; php_phongo_handler_readpreference.get_properties = php_phongo_readpreference_get_properties; php_phongo_handler_readpreference.free_obj = php_phongo_readpreference_free_object; php_phongo_handler_readpreference.offset = XtOffsetOf(php_phongo_readpreference_t, std); - - zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_PRIMARY"), MONGOC_READ_PRIMARY); - zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_PRIMARY_PREFERRED"), MONGOC_READ_PRIMARY_PREFERRED); - zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_SECONDARY"), MONGOC_READ_SECONDARY); - zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_SECONDARY_PREFERRED"), MONGOC_READ_SECONDARY_PREFERRED); - zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("RP_NEAREST"), MONGOC_READ_NEAREST); - zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("NO_MAX_STALENESS"), MONGOC_NO_MAX_STALENESS); - zend_declare_class_constant_long(php_phongo_readpreference_ce, ZEND_STRL("SMALLEST_MAX_STALENESS_SECONDS"), MONGOC_SMALLEST_MAX_STALENESS_SECONDS); - - zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("PRIMARY"), PHONGO_READ_PRIMARY); - zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("PRIMARY_PREFERRED"), PHONGO_READ_PRIMARY_PREFERRED); - zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("SECONDARY"), PHONGO_READ_SECONDARY); - zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("SECONDARY_PREFERRED"), PHONGO_READ_SECONDARY_PREFERRED); - zend_declare_class_constant_string(php_phongo_readpreference_ce, ZEND_STRL("NEAREST"), PHONGO_READ_NEAREST); } /* }}} */ void phongo_readpreference_init(zval* return_value, const mongoc_read_prefs_t* read_prefs) /* {{{ */ diff --git a/src/MongoDB/ReadPreference.h b/src/MongoDB/ReadPreference.h index 9ede1819e..0a078b0e5 100644 --- a/src/MongoDB/ReadPreference.h +++ b/src/MongoDB/ReadPreference.h @@ -22,6 +22,12 @@ #include +#define PHONGO_READ_PRIMARY "primary" +#define PHONGO_READ_PRIMARY_PREFERRED "primaryPreferred" +#define PHONGO_READ_SECONDARY "secondary" +#define PHONGO_READ_SECONDARY_PREFERRED "secondaryPreferred" +#define PHONGO_READ_NEAREST "nearest" + void phongo_readpreference_init(zval* return_value, const mongoc_read_prefs_t* read_prefs); const mongoc_read_prefs_t* phongo_read_preference_from_zval(zval* zread_preference); diff --git a/src/MongoDB/ReadPreference.stub.php b/src/MongoDB/ReadPreference.stub.php new file mode 100644 index 000000000..843209c15 --- /dev/null +++ b/src/MongoDB/ReadPreference.stub.php @@ -0,0 +1,119 @@ += 80000 + final public function __construct(string|int $mode, ?array $tagSets = null, ?array $options = null) {} +#else + /** @param string|int $mode */ + final public function __construct($mode, ?array $tagSets = null, ?array $options = null) {} +#endif + + final public function getHedge(): ?object {} + + final public function getMaxStalenessSeconds(): int {} + + final public function getMode(): int {} + + final public function getModeString(): string {} + + final public function getTagSets(): array {} + + public static function __set_state(array $properties): ReadPreference {} + +#if PHP_VERSION_ID >= 80000 + final public function bsonSerialize(): array|object {} +#else + /** @return array|object */ + final public function bsonSerialize() {} +#endif + + final public function serialize(): string {} + + /** @param string $serialized */ + final public function unserialize($serialized): void {} + + final public function __unserialize(array $data): void {} + + final public function __serialize(): array {} + } +} diff --git a/src/MongoDB/ReadPreference_arginfo.h b/src/MongoDB/ReadPreference_arginfo.h new file mode 100644 index 000000000..b828653cc --- /dev/null +++ b/src/MongoDB/ReadPreference_arginfo.h @@ -0,0 +1,198 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 6b082596f6c7ba630d8b1dca86c89dff94968691 */ + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference___construct, 0, 0, 1) + ZEND_ARG_TYPE_MASK(0, mode, MAY_BE_STRING|MAY_BE_LONG, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tagSets, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference___construct, 0, 0, 1) + ZEND_ARG_INFO(0, mode) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, tagSets, IS_ARRAY, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null") +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference_getHedge, 0, 0, IS_OBJECT, 1) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference_getMaxStalenessSeconds, 0, 0, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_Driver_ReadPreference_getMode arginfo_class_MongoDB_Driver_ReadPreference_getMaxStalenessSeconds + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference_getModeString, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference_getTagSets, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference___set_state, 0, 1, MongoDB\\Driver\\ReadPreference, 0) + ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_ReadPreference_bsonSerialize, 0, 0, MAY_BE_ARRAY|MAY_BE_OBJECT) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference_bsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + +#define arginfo_class_MongoDB_Driver_ReadPreference_serialize arginfo_class_MongoDB_Driver_ReadPreference_getModeString + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference___unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_Driver_ReadPreference___serialize arginfo_class_MongoDB_Driver_ReadPreference_getTagSets + + +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_ReadPreference, __construct); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_ReadPreference, __construct); +#endif +static ZEND_METHOD(MongoDB_Driver_ReadPreference, getHedge); +static ZEND_METHOD(MongoDB_Driver_ReadPreference, getMaxStalenessSeconds); +static ZEND_METHOD(MongoDB_Driver_ReadPreference, getMode); +static ZEND_METHOD(MongoDB_Driver_ReadPreference, getModeString); +static ZEND_METHOD(MongoDB_Driver_ReadPreference, getTagSets); +static ZEND_METHOD(MongoDB_Driver_ReadPreference, __set_state); +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_ReadPreference, bsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_ReadPreference, bsonSerialize); +#endif +static ZEND_METHOD(MongoDB_Driver_ReadPreference, serialize); +static ZEND_METHOD(MongoDB_Driver_ReadPreference, unserialize); +static ZEND_METHOD(MongoDB_Driver_ReadPreference, __unserialize); +static ZEND_METHOD(MongoDB_Driver_ReadPreference, __serialize); + + +static const zend_function_entry class_MongoDB_Driver_ReadPreference_methods[] = { +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_ReadPreference, __construct, arginfo_class_MongoDB_Driver_ReadPreference___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_ReadPreference, __construct, arginfo_class_MongoDB_Driver_ReadPreference___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_Driver_ReadPreference, getHedge, arginfo_class_MongoDB_Driver_ReadPreference_getHedge, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadPreference, getMaxStalenessSeconds, arginfo_class_MongoDB_Driver_ReadPreference_getMaxStalenessSeconds, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadPreference, getMode, arginfo_class_MongoDB_Driver_ReadPreference_getMode, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadPreference, getModeString, arginfo_class_MongoDB_Driver_ReadPreference_getModeString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadPreference, getTagSets, arginfo_class_MongoDB_Driver_ReadPreference_getTagSets, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadPreference, __set_state, arginfo_class_MongoDB_Driver_ReadPreference___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_ReadPreference, bsonSerialize, arginfo_class_MongoDB_Driver_ReadPreference_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_ReadPreference, bsonSerialize, arginfo_class_MongoDB_Driver_ReadPreference_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_Driver_ReadPreference, serialize, arginfo_class_MongoDB_Driver_ReadPreference_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadPreference, unserialize, arginfo_class_MongoDB_Driver_ReadPreference_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadPreference, __unserialize, arginfo_class_MongoDB_Driver_ReadPreference___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ReadPreference, __serialize, arginfo_class_MongoDB_Driver_ReadPreference___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_FE_END +}; + +static zend_class_entry *register_class_MongoDB_Driver_ReadPreference(zend_class_entry *class_entry_MongoDB_BSON_Serializable, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ReadPreference", class_MongoDB_Driver_ReadPreference_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 2, class_entry_MongoDB_BSON_Serializable, class_entry_Serializable); + + zval const_RP_PRIMARY_value; + ZVAL_LONG(&const_RP_PRIMARY_value, MONGOC_READ_PRIMARY); + zend_string *const_RP_PRIMARY_name = zend_string_init_interned("RP_PRIMARY", sizeof("RP_PRIMARY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_RP_PRIMARY_name, &const_RP_PRIMARY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_RP_PRIMARY_name); + + zval const_RP_PRIMARY_PREFERRED_value; + ZVAL_LONG(&const_RP_PRIMARY_PREFERRED_value, MONGOC_READ_PRIMARY_PREFERRED); + zend_string *const_RP_PRIMARY_PREFERRED_name = zend_string_init_interned("RP_PRIMARY_PREFERRED", sizeof("RP_PRIMARY_PREFERRED") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_RP_PRIMARY_PREFERRED_name, &const_RP_PRIMARY_PREFERRED_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_RP_PRIMARY_PREFERRED_name); + + zval const_RP_SECONDARY_value; + ZVAL_LONG(&const_RP_SECONDARY_value, MONGOC_READ_SECONDARY); + zend_string *const_RP_SECONDARY_name = zend_string_init_interned("RP_SECONDARY", sizeof("RP_SECONDARY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_RP_SECONDARY_name, &const_RP_SECONDARY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_RP_SECONDARY_name); + + zval const_RP_SECONDARY_PREFERRED_value; + ZVAL_LONG(&const_RP_SECONDARY_PREFERRED_value, MONGOC_READ_SECONDARY_PREFERRED); + zend_string *const_RP_SECONDARY_PREFERRED_name = zend_string_init_interned("RP_SECONDARY_PREFERRED", sizeof("RP_SECONDARY_PREFERRED") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_RP_SECONDARY_PREFERRED_name, &const_RP_SECONDARY_PREFERRED_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_RP_SECONDARY_PREFERRED_name); + + zval const_RP_NEAREST_value; + ZVAL_LONG(&const_RP_NEAREST_value, MONGOC_READ_NEAREST); + zend_string *const_RP_NEAREST_name = zend_string_init_interned("RP_NEAREST", sizeof("RP_NEAREST") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_RP_NEAREST_name, &const_RP_NEAREST_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_RP_NEAREST_name); + + zval const_PRIMARY_value; + zend_string *const_PRIMARY_value_str = zend_string_init(PHONGO_READ_PRIMARY, sizeof(PHONGO_READ_PRIMARY) - 1, 1); + ZVAL_STR(&const_PRIMARY_value, const_PRIMARY_value_str); + zend_string *const_PRIMARY_name = zend_string_init_interned("PRIMARY", sizeof("PRIMARY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_PRIMARY_name, &const_PRIMARY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_PRIMARY_name); + + zval const_PRIMARY_PREFERRED_value; + zend_string *const_PRIMARY_PREFERRED_value_str = zend_string_init(PHONGO_READ_PRIMARY_PREFERRED, sizeof(PHONGO_READ_PRIMARY_PREFERRED) - 1, 1); + ZVAL_STR(&const_PRIMARY_PREFERRED_value, const_PRIMARY_PREFERRED_value_str); + zend_string *const_PRIMARY_PREFERRED_name = zend_string_init_interned("PRIMARY_PREFERRED", sizeof("PRIMARY_PREFERRED") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_PRIMARY_PREFERRED_name, &const_PRIMARY_PREFERRED_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_PRIMARY_PREFERRED_name); + + zval const_SECONDARY_value; + zend_string *const_SECONDARY_value_str = zend_string_init(PHONGO_READ_SECONDARY, sizeof(PHONGO_READ_SECONDARY) - 1, 1); + ZVAL_STR(&const_SECONDARY_value, const_SECONDARY_value_str); + zend_string *const_SECONDARY_name = zend_string_init_interned("SECONDARY", sizeof("SECONDARY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_SECONDARY_name, &const_SECONDARY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_SECONDARY_name); + + zval const_SECONDARY_PREFERRED_value; + zend_string *const_SECONDARY_PREFERRED_value_str = zend_string_init(PHONGO_READ_SECONDARY_PREFERRED, sizeof(PHONGO_READ_SECONDARY_PREFERRED) - 1, 1); + ZVAL_STR(&const_SECONDARY_PREFERRED_value, const_SECONDARY_PREFERRED_value_str); + zend_string *const_SECONDARY_PREFERRED_name = zend_string_init_interned("SECONDARY_PREFERRED", sizeof("SECONDARY_PREFERRED") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_SECONDARY_PREFERRED_name, &const_SECONDARY_PREFERRED_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_SECONDARY_PREFERRED_name); + + zval const_NEAREST_value; + zend_string *const_NEAREST_value_str = zend_string_init(PHONGO_READ_NEAREST, sizeof(PHONGO_READ_NEAREST) - 1, 1); + ZVAL_STR(&const_NEAREST_value, const_NEAREST_value_str); + zend_string *const_NEAREST_name = zend_string_init_interned("NEAREST", sizeof("NEAREST") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_NEAREST_name, &const_NEAREST_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_NEAREST_name); + + zval const_NO_MAX_STALENESS_value; + ZVAL_LONG(&const_NO_MAX_STALENESS_value, MONGOC_NO_MAX_STALENESS); + zend_string *const_NO_MAX_STALENESS_name = zend_string_init_interned("NO_MAX_STALENESS", sizeof("NO_MAX_STALENESS") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_NO_MAX_STALENESS_name, &const_NO_MAX_STALENESS_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_NO_MAX_STALENESS_name); + + zval const_SMALLEST_MAX_STALENESS_SECONDS_value; + ZVAL_LONG(&const_SMALLEST_MAX_STALENESS_SECONDS_value, MONGOC_SMALLEST_MAX_STALENESS_SECONDS); + zend_string *const_SMALLEST_MAX_STALENESS_SECONDS_name = zend_string_init_interned("SMALLEST_MAX_STALENESS_SECONDS", sizeof("SMALLEST_MAX_STALENESS_SECONDS") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_SMALLEST_MAX_STALENESS_SECONDS_name, &const_SMALLEST_MAX_STALENESS_SECONDS_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_SMALLEST_MAX_STALENESS_SECONDS_name); + + return class_entry; +} diff --git a/src/MongoDB/Server.c b/src/MongoDB/Server.c index 9b4476982..9adbcc40f 100644 --- a/src/MongoDB/Server.c +++ b/src/MongoDB/Server.c @@ -29,12 +29,16 @@ #include "MongoDB/Server.h" #include "MongoDB/ServerDescription.h" +#include "Server_arginfo.h" zend_class_entry* php_phongo_server_ce; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_Server) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Server) + /* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeCommand(string $db, MongoDB\Driver\Command $command[, array $options = null])) Executes a Command on this Server */ -static PHP_METHOD(Server, executeCommand) +static PHP_METHOD(MongoDB_Driver_Server, executeCommand) { php_phongo_server_t* intern; char* db; @@ -68,7 +72,7 @@ static PHP_METHOD(Server, executeCommand) /* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeReadCommand(string $db, MongoDB\Driver\Command $command[, array $options = null])) Executes a ReadCommand on this Server */ -static PHP_METHOD(Server, executeReadCommand) +static PHP_METHOD(MongoDB_Driver_Server, executeReadCommand) { php_phongo_server_t* intern; char* db; @@ -95,7 +99,7 @@ static PHP_METHOD(Server, executeReadCommand) /* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeWriteCommand(string $db, MongoDB\Driver\Command $command[, array $options = null])) Executes a WriteCommand on this Server */ -static PHP_METHOD(Server, executeWriteCommand) +static PHP_METHOD(MongoDB_Driver_Server, executeWriteCommand) { php_phongo_server_t* intern; char* db; @@ -122,7 +126,7 @@ static PHP_METHOD(Server, executeWriteCommand) /* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeReadWriteCommand(string $db, MongoDB\Driver\Command $command[, array $options = null])) Executes a ReadWriteCommand on this Server */ -static PHP_METHOD(Server, executeReadWriteCommand) +static PHP_METHOD(MongoDB_Driver_Server, executeReadWriteCommand) { php_phongo_server_t* intern; char* db; @@ -149,7 +153,7 @@ static PHP_METHOD(Server, executeReadWriteCommand) /* {{{ proto MongoDB\Driver\Cursor MongoDB\Driver\Server::executeQuery(string $namespace, MongoDB\Driver\Query $query[, array $options = null])) Executes a Query on this Server */ -static PHP_METHOD(Server, executeQuery) +static PHP_METHOD(MongoDB_Driver_Server, executeQuery) { php_phongo_server_t* intern; char* namespace; @@ -184,7 +188,7 @@ static PHP_METHOD(Server, executeQuery) /* {{{ proto MongoDB\Driver\WriteResult MongoDB\Driver\Server::executeBulkWrite(string $namespace, MongoDB\Driver\BulkWrite $zbulk[, array $options = null]) Executes a BulkWrite (i.e. any number of insert, update, and delete ops) on this Server */ -static PHP_METHOD(Server, executeBulkWrite) +static PHP_METHOD(MongoDB_Driver_Server, executeBulkWrite) { php_phongo_server_t* intern; char* namespace; @@ -220,7 +224,7 @@ static PHP_METHOD(Server, executeBulkWrite) /* {{{ proto string MongoDB\Driver\Server::getHost() Returns the hostname for this Server */ -static PHP_METHOD(Server, getHost) +static PHP_METHOD(MongoDB_Driver_Server, getHost) { php_phongo_server_t* intern; mongoc_server_description_t* sd; @@ -240,7 +244,7 @@ static PHP_METHOD(Server, getHost) /* {{{ proto array MongoDB\Driver\Server::getTags() Returns the currently configured tags for this Server */ -static PHP_METHOD(Server, getTags) +static PHP_METHOD(MongoDB_Driver_Server, getTags) { php_phongo_server_t* intern; mongoc_server_description_t* sd; @@ -284,7 +288,7 @@ static PHP_METHOD(Server, getTags) /* {{{ proto array MongoDB\Driver\Server::getInfo() Returns the last hello response for this Server or, in the case of a load balancer, the initial handshake response. */ -static PHP_METHOD(Server, getInfo) +static PHP_METHOD(MongoDB_Driver_Server, getInfo) { php_phongo_server_t* intern; mongoc_client_t* client; @@ -340,7 +344,7 @@ static PHP_METHOD(Server, getInfo) /* {{{ proto integer|null MongoDB\Driver\Server::getLatency() Returns the measured latency (i.e. round trip time in milliseconds) for this Server, or null if unset. */ -static PHP_METHOD(Server, getLatency) +static PHP_METHOD(MongoDB_Driver_Server, getLatency) { php_phongo_server_t* intern; mongoc_server_description_t* sd; @@ -366,7 +370,7 @@ static PHP_METHOD(Server, getLatency) /* {{{ proto integer MongoDB\Driver\Server::getPort() Returns the port for this Server */ -static PHP_METHOD(Server, getPort) +static PHP_METHOD(MongoDB_Driver_Server, getPort) { php_phongo_server_t* intern; mongoc_server_description_t* sd; @@ -386,7 +390,7 @@ static PHP_METHOD(Server, getPort) /* {{{ proto MongoDB\Driver\ServerDescription MongoDB\Driver\Server::getServerDescription() Returns the server description for this Server */ -static PHP_METHOD(Server, getServerDescription) +static PHP_METHOD(MongoDB_Driver_Server, getServerDescription) { mongoc_server_description_t* server_description; php_phongo_server_t* intern = Z_SERVER_OBJ_P(getThis()); @@ -401,7 +405,7 @@ static PHP_METHOD(Server, getServerDescription) /* {{{ proto integer MongoDB\Driver\Server::getType() Returns the node type of this Server */ -static PHP_METHOD(Server, getType) +static PHP_METHOD(MongoDB_Driver_Server, getType) { php_phongo_server_t* intern; mongoc_server_description_t* sd; @@ -421,7 +425,7 @@ static PHP_METHOD(Server, getType) /* {{{ proto boolean MongoDB\Driver\Server::isPrimary() Returns whether this Server is a primary member of a replica set */ -static PHP_METHOD(Server, isPrimary) +static PHP_METHOD(MongoDB_Driver_Server, isPrimary) { php_phongo_server_t* intern; mongoc_server_description_t* sd; @@ -441,7 +445,7 @@ static PHP_METHOD(Server, isPrimary) /* {{{ proto boolean MongoDB\Driver\Server::isSecondary() Returns whether this Server is a secondary member of a replica set */ -static PHP_METHOD(Server, isSecondary) +static PHP_METHOD(MongoDB_Driver_Server, isSecondary) { php_phongo_server_t* intern; mongoc_server_description_t* sd; @@ -461,7 +465,7 @@ static PHP_METHOD(Server, isSecondary) /* {{{ proto boolean MongoDB\Driver\Server::isArbiter() Returns whether this Server is an arbiter member of a replica set */ -static PHP_METHOD(Server, isArbiter) +static PHP_METHOD(MongoDB_Driver_Server, isArbiter) { php_phongo_server_t* intern; mongoc_server_description_t* sd; @@ -481,7 +485,7 @@ static PHP_METHOD(Server, isArbiter) /* {{{ proto boolean MongoDB\Driver\Server::isHidden() Returns whether this Server is a hidden member of a replica set */ -static PHP_METHOD(Server, isHidden) +static PHP_METHOD(MongoDB_Driver_Server, isHidden) { php_phongo_server_t* intern; mongoc_server_description_t* sd; @@ -503,7 +507,7 @@ static PHP_METHOD(Server, isHidden) /* {{{ proto boolean MongoDB\Driver\Server::isPassive() Returns whether this Server is a passive member of a replica set */ -static PHP_METHOD(Server, isPassive) +static PHP_METHOD(MongoDB_Driver_Server, isPassive) { php_phongo_server_t* intern; mongoc_server_description_t* sd; @@ -523,61 +527,6 @@ static PHP_METHOD(Server, isPassive) phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Failed to get server description"); } /* }}} */ -/* {{{ MongoDB\Driver\Server function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_Server_executeCommand, 0, 0, 2) - ZEND_ARG_INFO(0, db) - ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) - ZEND_ARG_INFO(0, options) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Server_executeRWCommand, 0, 0, 2) - ZEND_ARG_INFO(0, db) - ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) - ZEND_ARG_ARRAY_INFO(0, options, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Server_executeQuery, 0, 0, 2) - ZEND_ARG_INFO(0, namespace) - ZEND_ARG_OBJ_INFO(0, zquery, MongoDB\\Driver\\Query, 0) - ZEND_ARG_INFO(0, options) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Server_executeBulkWrite, 0, 0, 2) - ZEND_ARG_INFO(0, namespace) - ZEND_ARG_OBJ_INFO(0, zbulk, MongoDB\\Driver\\BulkWrite, 0) - ZEND_ARG_INFO(0, options) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Server_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_server_me[] = { - /* clang-format off */ - PHP_ME(Server, executeCommand, ai_Server_executeCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, executeReadCommand, ai_Server_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, executeWriteCommand, ai_Server_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, executeReadWriteCommand, ai_Server_executeRWCommand, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, executeQuery, ai_Server_executeQuery, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, executeBulkWrite, ai_Server_executeBulkWrite, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, getHost, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, getTags, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, getInfo, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, getLatency, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, getPort, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, getServerDescription, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, getType, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, isPrimary, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, isSecondary, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, isArbiter, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, isHidden, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Server, isPassive, ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Server_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Server_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Server object handlers */ static zend_object_handlers php_phongo_handler_server; @@ -663,12 +612,8 @@ static HashTable* php_phongo_server_get_debug_info(phongo_compat_object_handler_ void php_phongo_server_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Server", php_phongo_server_me); - php_phongo_server_ce = zend_register_internal_class(&ce); + php_phongo_server_ce = register_class_MongoDB_Driver_Server(); php_phongo_server_ce->create_object = php_phongo_server_create_object; - PHONGO_CE_FINAL(php_phongo_server_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_server_ce); memcpy(&php_phongo_handler_server, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -676,17 +621,6 @@ void php_phongo_server_init_ce(INIT_FUNC_ARGS) /* {{{ */ php_phongo_handler_server.get_debug_info = php_phongo_server_get_debug_info; php_phongo_handler_server.free_obj = php_phongo_server_free_object; php_phongo_handler_server.offset = XtOffsetOf(php_phongo_server_t, std); - - zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_UNKNOWN"), PHONGO_SERVER_UNKNOWN); - zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_STANDALONE"), PHONGO_SERVER_STANDALONE); - zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_MONGOS"), PHONGO_SERVER_MONGOS); - zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_POSSIBLE_PRIMARY"), PHONGO_SERVER_POSSIBLE_PRIMARY); - zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_PRIMARY"), PHONGO_SERVER_RS_PRIMARY); - zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_SECONDARY"), PHONGO_SERVER_RS_SECONDARY); - zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_ARBITER"), PHONGO_SERVER_RS_ARBITER); - zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_OTHER"), PHONGO_SERVER_RS_OTHER); - zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_RS_GHOST"), PHONGO_SERVER_RS_GHOST); - zend_declare_class_constant_long(php_phongo_server_ce, ZEND_STRL("TYPE_LOAD_BALANCER"), PHONGO_SERVER_LOAD_BALANCER); } /* }}} */ void phongo_server_init(zval* return_value, zval* manager, uint32_t server_id) /* {{{ */ diff --git a/src/MongoDB/Server.stub.php b/src/MongoDB/Server.stub.php new file mode 100644 index 000000000..6ed1b81f8 --- /dev/null +++ b/src/MongoDB/Server.stub.php @@ -0,0 +1,123 @@ += 80000 + final public function executeBulkWrite(string $namespace, BulkWrite $zwrite, array|WriteConcern|null $options = null): WriteResult {} + + final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): Cursor {} + + final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} +#else + /** @param array|WriteConcern|null $options */ + final public function executeBulkWrite(string $namespace, BulkWrite $zwrite, $options = null): WriteResult {} + + /** @param array|ReadPreference|null $options */ + final public function executeCommand(string $db, Command $command, $options = null): Cursor {} + + /** @param array|ReadPreference|null $options */ + final public function executeQuery(string $namespace, Query $query, $options = null): Cursor {} +#endif + + final public function executeReadCommand(string $db, Command $command, array $options = []): Cursor {} + + final public function executeReadWriteCommand(string $db, Command $command, array $options = []): Cursor {} + + final public function executeWriteCommand(string $db, Command $command, array $options = []): Cursor {} + + final public function getHost(): string {} + + final public function getInfo(): array {} + + final public function getLatency(): ?int {} + + final public function getPort(): int {} + + final public function getServerDescription(): ServerDescription {} + + final public function getTags(): array {} + + final public function getType(): int {} + + final public function isArbiter(): bool {} + + final public function isHidden(): bool {} + + final public function isPassive(): bool {} + + final public function isPrimary(): bool {} + + final public function isSecondary(): bool {} + + final public function __wakeup(): void {} + } +} diff --git a/src/MongoDB/ServerApi.c b/src/MongoDB/ServerApi.c index 94ea2da51..2c77484c2 100644 --- a/src/MongoDB/ServerApi.c +++ b/src/MongoDB/ServerApi.c @@ -23,6 +23,7 @@ #include "php_phongo.h" #include "phongo_error.h" +#include "ServerApi_arginfo.h" zend_class_entry* php_phongo_serverapi_ce; @@ -93,7 +94,7 @@ static bool php_phongo_serverapi_init_from_hash(php_phongo_serverapi_t* intern, /* {{{ proto void MongoDB\Driver\ServerApi::__construct(string $version, [?bool $strict], [?bool $deprecationErrors]) Constructs a new ServerApi object */ -static PHP_METHOD(ServerApi, __construct) +static PHP_METHOD(MongoDB_Driver_ServerApi, __construct) { php_phongo_serverapi_t* intern; zend_string* version; @@ -123,7 +124,7 @@ static PHP_METHOD(ServerApi, __construct) /* {{{ proto MongoDB\Driver\ServerApi MongoDB\Driver\ServerApi::__set_state(array $properties) */ -static PHP_METHOD(ServerApi, __set_state) +static PHP_METHOD(MongoDB_Driver_ServerApi, __set_state) { php_phongo_serverapi_t* intern; HashTable* props; @@ -182,7 +183,7 @@ static HashTable* php_phongo_serverapi_get_properties_hash(phongo_compat_object_ /* {{{ proto array MongoDB\Driver\ServerApi::bsonSerialize() */ -static PHP_METHOD(ServerApi, bsonSerialize) +static PHP_METHOD(MongoDB_Driver_ServerApi, bsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -192,7 +193,7 @@ static PHP_METHOD(ServerApi, bsonSerialize) /* {{{ proto string MongoDB\Driver\ServerApi::serialize() */ -static PHP_METHOD(ServerApi, serialize) +static PHP_METHOD(MongoDB_Driver_ServerApi, serialize) { php_phongo_serverapi_t* intern; zval retval; @@ -232,7 +233,7 @@ static PHP_METHOD(ServerApi, serialize) /* {{{ proto void MongoDB\Driver\ServerApi::unserialize(string $serialized) */ -static PHP_METHOD(ServerApi, unserialize) +static PHP_METHOD(MongoDB_Driver_ServerApi, unserialize) { php_phongo_serverapi_t* intern; char* serialized; @@ -266,7 +267,7 @@ static PHP_METHOD(ServerApi, unserialize) /* {{{ proto array MongoDB\Driver\ServerApi::__serialize() */ -static PHP_METHOD(ServerApi, __serialize) +static PHP_METHOD(MongoDB_Driver_ServerApi, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -275,7 +276,7 @@ static PHP_METHOD(ServerApi, __serialize) /* {{{ proto void MongoDB\Driver\ServerApi::__unserialize(array $data) */ -static PHP_METHOD(ServerApi, __unserialize) +static PHP_METHOD(MongoDB_Driver_ServerApi, __unserialize) { zval* data; @@ -286,46 +287,6 @@ static PHP_METHOD(ServerApi, __unserialize) php_phongo_serverapi_init_from_hash(Z_SERVERAPI_OBJ_P(getThis()), Z_ARRVAL_P(data)); } /* }}} */ -/* {{{ MongoDB\Driver\ServerApi function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_ServerApi___construct, 0, 0, 1) - ZEND_ARG_TYPE_INFO(0, version, IS_STRING, 0) - ZEND_ARG_TYPE_INFO(0, strict, _IS_BOOL, 1) - ZEND_ARG_TYPE_INFO(0, deprecationErrors, _IS_BOOL, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ServerApi___set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, properties, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ServerApi___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ServerApi_unserialize, 0, 0, 1) -#if PHP_VERSION_ID >= 80000 - ZEND_ARG_TYPE_INFO(0, serialized, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, serialized) -#endif -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_ServerApi_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_serverapi_me[] = { - /* clang-format off */ - PHP_ME(ServerApi, __construct, ai_ServerApi___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerApi, __serialize, ai_ServerApi_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerApi, __set_state, ai_ServerApi___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(ServerApi, __unserialize, ai_ServerApi___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerApi, bsonSerialize, ai_ServerApi_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerApi, serialize, ai_ServerApi_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerApi, unserialize, ai_ServerApi_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\ServerApi object handlers */ static zend_object_handlers php_phongo_handler_serverapi; @@ -370,21 +331,12 @@ static HashTable* php_phongo_serverapi_get_properties(phongo_compat_object_handl void php_phongo_serverapi_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ServerApi", php_phongo_serverapi_me); - php_phongo_serverapi_ce = zend_register_internal_class(&ce); + php_phongo_serverapi_ce = register_class_MongoDB_Driver_ServerApi(php_phongo_serializable_ce, zend_ce_serializable); php_phongo_serverapi_ce->create_object = php_phongo_serverapi_create_object; - PHONGO_CE_FINAL(php_phongo_serverapi_ce); - - zend_class_implements(php_phongo_serverapi_ce, 1, php_phongo_serializable_ce); - zend_class_implements(php_phongo_serverapi_ce, 1, zend_ce_serializable); memcpy(&php_phongo_handler_serverapi, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_serverapi.get_debug_info = php_phongo_serverapi_get_debug_info; php_phongo_handler_serverapi.get_properties = php_phongo_serverapi_get_properties; php_phongo_handler_serverapi.free_obj = php_phongo_serverapi_free_object; php_phongo_handler_serverapi.offset = XtOffsetOf(php_phongo_serverapi_t, std); - - zend_declare_class_constant_stringl(php_phongo_serverapi_ce, ZEND_STRL("V1"), ZEND_STRL("1")); } /* }}} */ diff --git a/src/MongoDB/ServerApi.stub.php b/src/MongoDB/ServerApi.stub.php new file mode 100644 index 000000000..d2140febf --- /dev/null +++ b/src/MongoDB/ServerApi.stub.php @@ -0,0 +1,35 @@ += 80000 + final public function bsonSerialize(): array|object {} +#else + /** @return array|object */ + final public function bsonSerialize() {} +#endif + + final public function serialize(): string {} + + /** @param string $serialized */ + final public function unserialize($serialized): void {} + + final public function __unserialize(array $data): void {} + + final public function __serialize(): array {} + } +} diff --git a/src/MongoDB/ServerApi_arginfo.h b/src/MongoDB/ServerApi_arginfo.h new file mode 100644 index 000000000..d486d2d7b --- /dev/null +++ b/src/MongoDB/ServerApi_arginfo.h @@ -0,0 +1,86 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 25126c36542ef56cab425ed42a44b862cb9e83f9 */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi___construct, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, version, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, strict, _IS_BOOL, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, deprecationErrors, _IS_BOOL, 1, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi___set_state, 0, 1, MongoDB\\Driver\\ServerApi, 0) + ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_ServerApi_bsonSerialize, 0, 0, MAY_BE_ARRAY|MAY_BE_OBJECT) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi_bsonSerialize, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi_serialize, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi___unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi___serialize, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + + +static ZEND_METHOD(MongoDB_Driver_ServerApi, __construct); +static ZEND_METHOD(MongoDB_Driver_ServerApi, __set_state); +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_ServerApi, bsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_ServerApi, bsonSerialize); +#endif +static ZEND_METHOD(MongoDB_Driver_ServerApi, serialize); +static ZEND_METHOD(MongoDB_Driver_ServerApi, unserialize); +static ZEND_METHOD(MongoDB_Driver_ServerApi, __unserialize); +static ZEND_METHOD(MongoDB_Driver_ServerApi, __serialize); + + +static const zend_function_entry class_MongoDB_Driver_ServerApi_methods[] = { + ZEND_ME(MongoDB_Driver_ServerApi, __construct, arginfo_class_MongoDB_Driver_ServerApi___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ServerApi, __set_state, arginfo_class_MongoDB_Driver_ServerApi___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_ServerApi, bsonSerialize, arginfo_class_MongoDB_Driver_ServerApi_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_ServerApi, bsonSerialize, arginfo_class_MongoDB_Driver_ServerApi_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_Driver_ServerApi, serialize, arginfo_class_MongoDB_Driver_ServerApi_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ServerApi, unserialize, arginfo_class_MongoDB_Driver_ServerApi_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ServerApi, __unserialize, arginfo_class_MongoDB_Driver_ServerApi___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ServerApi, __serialize, arginfo_class_MongoDB_Driver_ServerApi___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_FE_END +}; + +static zend_class_entry *register_class_MongoDB_Driver_ServerApi(zend_class_entry *class_entry_MongoDB_BSON_Serializable, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ServerApi", class_MongoDB_Driver_ServerApi_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 2, class_entry_MongoDB_BSON_Serializable, class_entry_Serializable); + + zval const_V1_value; + zend_string *const_V1_value_str = zend_string_init("1", sizeof("1") - 1, 1); + ZVAL_STR(&const_V1_value, const_V1_value_str); + zend_string *const_V1_name = zend_string_init_interned("V1", sizeof("V1") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_V1_name, &const_V1_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_V1_name); + + return class_entry; +} diff --git a/src/MongoDB/ServerDescription.c b/src/MongoDB/ServerDescription.c index d9ff1fd51..172f20de6 100644 --- a/src/MongoDB/ServerDescription.c +++ b/src/MongoDB/ServerDescription.c @@ -26,22 +26,10 @@ #include "phongo_error.h" #include "MongoDB/ServerDescription.h" +#include "ServerDescription_arginfo.h" zend_class_entry* php_phongo_serverdescription_ce; -/* Note: these constants are derived from mongoc_server_description_type, since - * since mongoc_server_description_type_t is private. */ -#define PHONGO_SERVER_TYPE_UNKNOWN "Unknown" -#define PHONGO_SERVER_TYPE_STANDALONE "Standalone" -#define PHONGO_SERVER_TYPE_MONGOS "Mongos" -#define PHONGO_SERVER_TYPE_POSSIBLE_PRIMARY "PossiblePrimary" -#define PHONGO_SERVER_TYPE_RS_PRIMARY "RSPrimary" -#define PHONGO_SERVER_TYPE_RS_SECONDARY "RSSecondary" -#define PHONGO_SERVER_TYPE_RS_ARBITER "RSArbiter" -#define PHONGO_SERVER_TYPE_RS_OTHER "RSOther" -#define PHONGO_SERVER_TYPE_RS_GHOST "RSGhost" -#define PHONGO_SERVER_TYPE_LOAD_BALANCER "LoadBalancer" - php_phongo_server_description_type_map_t php_phongo_server_description_type_map[PHONGO_SERVER_DESCRIPTION_TYPES] = { { PHONGO_SERVER_UNKNOWN, PHONGO_SERVER_TYPE_UNKNOWN }, @@ -56,9 +44,11 @@ php_phongo_server_description_type_map_t { PHONGO_SERVER_LOAD_BALANCER, PHONGO_SERVER_TYPE_LOAD_BALANCER }, }; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_ServerDescription) + /* {{{ proto array MongoDB\Driver\ServerDescription::getHelloResponse() Returns the most recent "hello" response */ -static PHP_METHOD(ServerDescription, getHelloResponse) +static PHP_METHOD(MongoDB_Driver_ServerDescription, getHelloResponse) { php_phongo_serverdescription_t* intern; const bson_t* helloResponse; @@ -88,7 +78,7 @@ static PHP_METHOD(ServerDescription, getHelloResponse) /* {{{ proto string MongoDB\Driver\ServerDescription::getHost() Returns the server's hostname */ -static PHP_METHOD(ServerDescription, getHost) +static PHP_METHOD(MongoDB_Driver_ServerDescription, getHost) { php_phongo_serverdescription_t* intern; @@ -101,7 +91,7 @@ static PHP_METHOD(ServerDescription, getHost) /* {{{ proto integer MongoDB\Driver\ServerDescription::getLastUpdateTime() Returns the server's last update time, in microseconds */ -static PHP_METHOD(ServerDescription, getLastUpdateTime) +static PHP_METHOD(MongoDB_Driver_ServerDescription, getLastUpdateTime) { php_phongo_serverdescription_t* intern; int64_t last_update_time; @@ -123,7 +113,7 @@ static PHP_METHOD(ServerDescription, getLastUpdateTime) /* {{{ proto integer MongoDB\Driver\ServerDescription::getPort() Returns the server's port */ -static PHP_METHOD(ServerDescription, getPort) +static PHP_METHOD(MongoDB_Driver_ServerDescription, getPort) { php_phongo_serverdescription_t* intern; @@ -136,7 +126,7 @@ static PHP_METHOD(ServerDescription, getPort) /* {{{ proto integer MongoDB\Driver\ServerDescription::getRoundTripTime() Returns the server's round trip time, in milliseconds */ -static PHP_METHOD(ServerDescription, getRoundTripTime) +static PHP_METHOD(MongoDB_Driver_ServerDescription, getRoundTripTime) { php_phongo_serverdescription_t* intern; @@ -154,7 +144,7 @@ static PHP_METHOD(ServerDescription, getRoundTripTime) /* {{{ proto string MongoDB\Driver\ServerDescription::getType() Returns the server's node type */ -static PHP_METHOD(ServerDescription, getType) +static PHP_METHOD(MongoDB_Driver_ServerDescription, getType) { php_phongo_serverdescription_t* intern; @@ -165,24 +155,6 @@ static PHP_METHOD(ServerDescription, getType) RETVAL_STRING(mongoc_server_description_type(intern->server_description)); } /* }}} */ -/* {{{ MongoDB\Driver\ServerDescription function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_ServerDescription_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_serverdescription_me[] = { - /* clang-format off */ - PHP_ME(ServerDescription, getHelloResponse, ai_ServerDescription_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerDescription, getHost, ai_ServerDescription_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerDescription, getLastUpdateTime, ai_ServerDescription_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerDescription, getPort, ai_ServerDescription_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerDescription, getRoundTripTime, ai_ServerDescription_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(ServerDescription, getType, ai_ServerDescription_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_ServerDescription_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\ServerDescription object handlers */ static zend_object_handlers php_phongo_handler_serverdescription; @@ -304,12 +276,8 @@ static HashTable* php_phongo_serverdescription_get_properties(phongo_compat_obje void php_phongo_serverdescription_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "ServerDescription", php_phongo_serverdescription_me); - php_phongo_serverdescription_ce = zend_register_internal_class(&ce); + php_phongo_serverdescription_ce = register_class_MongoDB_Driver_ServerDescription(); php_phongo_serverdescription_ce->create_object = php_phongo_serverdescription_create_object; - PHONGO_CE_FINAL(php_phongo_serverdescription_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_serverdescription_ce); memcpy(&php_phongo_handler_serverdescription, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -317,17 +285,6 @@ void php_phongo_serverdescription_init_ce(INIT_FUNC_ARGS) /* {{{ */ php_phongo_handler_serverdescription.get_properties = php_phongo_serverdescription_get_properties; php_phongo_handler_serverdescription.free_obj = php_phongo_serverdescription_free_object; php_phongo_handler_serverdescription.offset = XtOffsetOf(php_phongo_serverdescription_t, std); - - zend_declare_class_constant_string(php_phongo_serverdescription_ce, ZEND_STRL("TYPE_UNKNOWN"), PHONGO_SERVER_TYPE_UNKNOWN); - zend_declare_class_constant_string(php_phongo_serverdescription_ce, ZEND_STRL("TYPE_STANDALONE"), PHONGO_SERVER_TYPE_STANDALONE); - zend_declare_class_constant_string(php_phongo_serverdescription_ce, ZEND_STRL("TYPE_MONGOS"), PHONGO_SERVER_TYPE_MONGOS); - zend_declare_class_constant_string(php_phongo_serverdescription_ce, ZEND_STRL("TYPE_POSSIBLE_PRIMARY"), PHONGO_SERVER_TYPE_POSSIBLE_PRIMARY); - zend_declare_class_constant_string(php_phongo_serverdescription_ce, ZEND_STRL("TYPE_RS_PRIMARY"), PHONGO_SERVER_TYPE_RS_PRIMARY); - zend_declare_class_constant_string(php_phongo_serverdescription_ce, ZEND_STRL("TYPE_RS_SECONDARY"), PHONGO_SERVER_TYPE_RS_SECONDARY); - zend_declare_class_constant_string(php_phongo_serverdescription_ce, ZEND_STRL("TYPE_RS_ARBITER"), PHONGO_SERVER_TYPE_RS_ARBITER); - zend_declare_class_constant_string(php_phongo_serverdescription_ce, ZEND_STRL("TYPE_RS_OTHER"), PHONGO_SERVER_TYPE_RS_OTHER); - zend_declare_class_constant_string(php_phongo_serverdescription_ce, ZEND_STRL("TYPE_RS_GHOST"), PHONGO_SERVER_TYPE_RS_GHOST); - zend_declare_class_constant_string(php_phongo_serverdescription_ce, ZEND_STRL("TYPE_LOAD_BALANCER"), PHONGO_SERVER_TYPE_LOAD_BALANCER); } /* }}} */ void phongo_serverdescription_init_ex(zval* return_value, mongoc_server_description_t* server_description, bool copy) /* {{{ */ diff --git a/src/MongoDB/ServerDescription.h b/src/MongoDB/ServerDescription.h index a23679ed9..d3fa55f40 100644 --- a/src/MongoDB/ServerDescription.h +++ b/src/MongoDB/ServerDescription.h @@ -21,6 +21,19 @@ #include +/* Note: these constants are derived from mongoc_server_description_type, since + * since mongoc_server_description_type_t is private. */ +#define PHONGO_SERVER_TYPE_UNKNOWN "Unknown" +#define PHONGO_SERVER_TYPE_STANDALONE "Standalone" +#define PHONGO_SERVER_TYPE_MONGOS "Mongos" +#define PHONGO_SERVER_TYPE_POSSIBLE_PRIMARY "PossiblePrimary" +#define PHONGO_SERVER_TYPE_RS_PRIMARY "RSPrimary" +#define PHONGO_SERVER_TYPE_RS_SECONDARY "RSSecondary" +#define PHONGO_SERVER_TYPE_RS_ARBITER "RSArbiter" +#define PHONGO_SERVER_TYPE_RS_OTHER "RSOther" +#define PHONGO_SERVER_TYPE_RS_GHOST "RSGhost" +#define PHONGO_SERVER_TYPE_LOAD_BALANCER "LoadBalancer" + /* This enum is necessary since mongoc_server_description_type_t is private and * we need to translate strings returned by mongoc_server_description_type() to * Server integer constants. */ diff --git a/src/MongoDB/ServerDescription.stub.php b/src/MongoDB/ServerDescription.stub.php new file mode 100644 index 000000000..3dde219b4 --- /dev/null +++ b/src/MongoDB/ServerDescription.stub.php @@ -0,0 +1,86 @@ +ce_flags |= ZEND_ACC_FINAL; + + zval const_TYPE_UNKNOWN_value; + zend_string *const_TYPE_UNKNOWN_value_str = zend_string_init(PHONGO_SERVER_TYPE_UNKNOWN, sizeof(PHONGO_SERVER_TYPE_UNKNOWN) - 1, 1); + ZVAL_STR(&const_TYPE_UNKNOWN_value, const_TYPE_UNKNOWN_value_str); + zend_string *const_TYPE_UNKNOWN_name = zend_string_init_interned("TYPE_UNKNOWN", sizeof("TYPE_UNKNOWN") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_UNKNOWN_name, &const_TYPE_UNKNOWN_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_UNKNOWN_name); + + zval const_TYPE_STANDALONE_value; + zend_string *const_TYPE_STANDALONE_value_str = zend_string_init(PHONGO_SERVER_TYPE_STANDALONE, sizeof(PHONGO_SERVER_TYPE_STANDALONE) - 1, 1); + ZVAL_STR(&const_TYPE_STANDALONE_value, const_TYPE_STANDALONE_value_str); + zend_string *const_TYPE_STANDALONE_name = zend_string_init_interned("TYPE_STANDALONE", sizeof("TYPE_STANDALONE") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_STANDALONE_name, &const_TYPE_STANDALONE_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_STANDALONE_name); + + zval const_TYPE_MONGOS_value; + zend_string *const_TYPE_MONGOS_value_str = zend_string_init(PHONGO_SERVER_TYPE_MONGOS, sizeof(PHONGO_SERVER_TYPE_MONGOS) - 1, 1); + ZVAL_STR(&const_TYPE_MONGOS_value, const_TYPE_MONGOS_value_str); + zend_string *const_TYPE_MONGOS_name = zend_string_init_interned("TYPE_MONGOS", sizeof("TYPE_MONGOS") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_MONGOS_name, &const_TYPE_MONGOS_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_MONGOS_name); + + zval const_TYPE_POSSIBLE_PRIMARY_value; + zend_string *const_TYPE_POSSIBLE_PRIMARY_value_str = zend_string_init(PHONGO_SERVER_TYPE_POSSIBLE_PRIMARY, sizeof(PHONGO_SERVER_TYPE_POSSIBLE_PRIMARY) - 1, 1); + ZVAL_STR(&const_TYPE_POSSIBLE_PRIMARY_value, const_TYPE_POSSIBLE_PRIMARY_value_str); + zend_string *const_TYPE_POSSIBLE_PRIMARY_name = zend_string_init_interned("TYPE_POSSIBLE_PRIMARY", sizeof("TYPE_POSSIBLE_PRIMARY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_POSSIBLE_PRIMARY_name, &const_TYPE_POSSIBLE_PRIMARY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_POSSIBLE_PRIMARY_name); + + zval const_TYPE_RS_PRIMARY_value; + zend_string *const_TYPE_RS_PRIMARY_value_str = zend_string_init(PHONGO_SERVER_TYPE_RS_PRIMARY, sizeof(PHONGO_SERVER_TYPE_RS_PRIMARY) - 1, 1); + ZVAL_STR(&const_TYPE_RS_PRIMARY_value, const_TYPE_RS_PRIMARY_value_str); + zend_string *const_TYPE_RS_PRIMARY_name = zend_string_init_interned("TYPE_RS_PRIMARY", sizeof("TYPE_RS_PRIMARY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_RS_PRIMARY_name, &const_TYPE_RS_PRIMARY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_RS_PRIMARY_name); + + zval const_TYPE_RS_SECONDARY_value; + zend_string *const_TYPE_RS_SECONDARY_value_str = zend_string_init(PHONGO_SERVER_TYPE_RS_SECONDARY, sizeof(PHONGO_SERVER_TYPE_RS_SECONDARY) - 1, 1); + ZVAL_STR(&const_TYPE_RS_SECONDARY_value, const_TYPE_RS_SECONDARY_value_str); + zend_string *const_TYPE_RS_SECONDARY_name = zend_string_init_interned("TYPE_RS_SECONDARY", sizeof("TYPE_RS_SECONDARY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_RS_SECONDARY_name, &const_TYPE_RS_SECONDARY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_RS_SECONDARY_name); + + zval const_TYPE_RS_ARBITER_value; + zend_string *const_TYPE_RS_ARBITER_value_str = zend_string_init(PHONGO_SERVER_TYPE_RS_ARBITER, sizeof(PHONGO_SERVER_TYPE_RS_ARBITER) - 1, 1); + ZVAL_STR(&const_TYPE_RS_ARBITER_value, const_TYPE_RS_ARBITER_value_str); + zend_string *const_TYPE_RS_ARBITER_name = zend_string_init_interned("TYPE_RS_ARBITER", sizeof("TYPE_RS_ARBITER") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_RS_ARBITER_name, &const_TYPE_RS_ARBITER_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_RS_ARBITER_name); + + zval const_TYPE_RS_OTHER_value; + zend_string *const_TYPE_RS_OTHER_value_str = zend_string_init(PHONGO_SERVER_TYPE_RS_OTHER, sizeof(PHONGO_SERVER_TYPE_RS_OTHER) - 1, 1); + ZVAL_STR(&const_TYPE_RS_OTHER_value, const_TYPE_RS_OTHER_value_str); + zend_string *const_TYPE_RS_OTHER_name = zend_string_init_interned("TYPE_RS_OTHER", sizeof("TYPE_RS_OTHER") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_RS_OTHER_name, &const_TYPE_RS_OTHER_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_RS_OTHER_name); + + zval const_TYPE_RS_GHOST_value; + zend_string *const_TYPE_RS_GHOST_value_str = zend_string_init(PHONGO_SERVER_TYPE_RS_GHOST, sizeof(PHONGO_SERVER_TYPE_RS_GHOST) - 1, 1); + ZVAL_STR(&const_TYPE_RS_GHOST_value, const_TYPE_RS_GHOST_value_str); + zend_string *const_TYPE_RS_GHOST_name = zend_string_init_interned("TYPE_RS_GHOST", sizeof("TYPE_RS_GHOST") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_RS_GHOST_name, &const_TYPE_RS_GHOST_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_RS_GHOST_name); + + zval const_TYPE_LOAD_BALANCER_value; + zend_string *const_TYPE_LOAD_BALANCER_value_str = zend_string_init(PHONGO_SERVER_TYPE_LOAD_BALANCER, sizeof(PHONGO_SERVER_TYPE_LOAD_BALANCER) - 1, 1); + ZVAL_STR(&const_TYPE_LOAD_BALANCER_value, const_TYPE_LOAD_BALANCER_value_str); + zend_string *const_TYPE_LOAD_BALANCER_name = zend_string_init_interned("TYPE_LOAD_BALANCER", sizeof("TYPE_LOAD_BALANCER") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_LOAD_BALANCER_name, &const_TYPE_LOAD_BALANCER_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_LOAD_BALANCER_name); + + return class_entry; +} diff --git a/src/MongoDB/Server_arginfo.h b/src/MongoDB/Server_arginfo.h new file mode 100644 index 000000000..80bcb3a24 --- /dev/null +++ b/src/MongoDB/Server_arginfo.h @@ -0,0 +1,244 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 1efac8a3f41afcdd1af63979404a44550174c40d */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Server___construct, 0, 0, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) + ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, zwrite, MongoDB\\Driver\\BulkWrite, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\WriteConcern, MAY_BE_ARRAY|MAY_BE_NULL, "null") +ZEND_END_ARG_INFO() +#endif + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") +ZEND_END_ARG_INFO() +#endif + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) + ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, zwrite, MongoDB\\Driver\\BulkWrite, 0) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeReadCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_Driver_Server_executeReadWriteCommand arginfo_class_MongoDB_Driver_Server_executeReadCommand + +#define arginfo_class_MongoDB_Driver_Server_executeWriteCommand arginfo_class_MongoDB_Driver_Server_executeReadCommand + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Server_getHost, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Server_getInfo, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Server_getLatency, 0, 0, IS_LONG, 1) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Server_getPort, 0, 0, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_getServerDescription, 0, 0, MongoDB\\Driver\\ServerDescription, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_Driver_Server_getTags arginfo_class_MongoDB_Driver_Server_getInfo + +#define arginfo_class_MongoDB_Driver_Server_getType arginfo_class_MongoDB_Driver_Server_getPort + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Server_isArbiter, 0, 0, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_Driver_Server_isHidden arginfo_class_MongoDB_Driver_Server_isArbiter + +#define arginfo_class_MongoDB_Driver_Server_isPassive arginfo_class_MongoDB_Driver_Server_isArbiter + +#define arginfo_class_MongoDB_Driver_Server_isPrimary arginfo_class_MongoDB_Driver_Server_isArbiter + +#define arginfo_class_MongoDB_Driver_Server_isSecondary arginfo_class_MongoDB_Driver_Server_isArbiter + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Server___wakeup, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + + +static ZEND_METHOD(MongoDB_Driver_Server, __construct); +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Server, executeBulkWrite); +#endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Server, executeCommand); +#endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Server, executeQuery); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_Server, executeBulkWrite); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_Server, executeCommand); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_Server, executeQuery); +#endif +static ZEND_METHOD(MongoDB_Driver_Server, executeReadCommand); +static ZEND_METHOD(MongoDB_Driver_Server, executeReadWriteCommand); +static ZEND_METHOD(MongoDB_Driver_Server, executeWriteCommand); +static ZEND_METHOD(MongoDB_Driver_Server, getHost); +static ZEND_METHOD(MongoDB_Driver_Server, getInfo); +static ZEND_METHOD(MongoDB_Driver_Server, getLatency); +static ZEND_METHOD(MongoDB_Driver_Server, getPort); +static ZEND_METHOD(MongoDB_Driver_Server, getServerDescription); +static ZEND_METHOD(MongoDB_Driver_Server, getTags); +static ZEND_METHOD(MongoDB_Driver_Server, getType); +static ZEND_METHOD(MongoDB_Driver_Server, isArbiter); +static ZEND_METHOD(MongoDB_Driver_Server, isHidden); +static ZEND_METHOD(MongoDB_Driver_Server, isPassive); +static ZEND_METHOD(MongoDB_Driver_Server, isPrimary); +static ZEND_METHOD(MongoDB_Driver_Server, isSecondary); +static ZEND_METHOD(MongoDB_Driver_Server, __wakeup); + + +static const zend_function_entry class_MongoDB_Driver_Server_methods[] = { + ZEND_ME(MongoDB_Driver_Server, __construct, arginfo_class_MongoDB_Driver_Server___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Server, executeBulkWrite, arginfo_class_MongoDB_Driver_Server_executeBulkWrite, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Server, executeCommand, arginfo_class_MongoDB_Driver_Server_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Server, executeQuery, arginfo_class_MongoDB_Driver_Server_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_Server, executeBulkWrite, arginfo_class_MongoDB_Driver_Server_executeBulkWrite, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_Server, executeCommand, arginfo_class_MongoDB_Driver_Server_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_Server, executeQuery, arginfo_class_MongoDB_Driver_Server_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_Driver_Server, executeReadCommand, arginfo_class_MongoDB_Driver_Server_executeReadCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, executeReadWriteCommand, arginfo_class_MongoDB_Driver_Server_executeReadWriteCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, executeWriteCommand, arginfo_class_MongoDB_Driver_Server_executeWriteCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, getHost, arginfo_class_MongoDB_Driver_Server_getHost, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, getInfo, arginfo_class_MongoDB_Driver_Server_getInfo, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, getLatency, arginfo_class_MongoDB_Driver_Server_getLatency, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, getPort, arginfo_class_MongoDB_Driver_Server_getPort, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, getServerDescription, arginfo_class_MongoDB_Driver_Server_getServerDescription, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, getTags, arginfo_class_MongoDB_Driver_Server_getTags, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, getType, arginfo_class_MongoDB_Driver_Server_getType, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, isArbiter, arginfo_class_MongoDB_Driver_Server_isArbiter, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, isHidden, arginfo_class_MongoDB_Driver_Server_isHidden, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, isPassive, arginfo_class_MongoDB_Driver_Server_isPassive, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, isPrimary, arginfo_class_MongoDB_Driver_Server_isPrimary, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, isSecondary, arginfo_class_MongoDB_Driver_Server_isSecondary, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Server, __wakeup, arginfo_class_MongoDB_Driver_Server___wakeup, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_FE_END +}; + +static zend_class_entry *register_class_MongoDB_Driver_Server(void) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Server", class_MongoDB_Driver_Server_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + zval const_TYPE_UNKNOWN_value; + ZVAL_LONG(&const_TYPE_UNKNOWN_value, PHONGO_SERVER_UNKNOWN); + zend_string *const_TYPE_UNKNOWN_name = zend_string_init_interned("TYPE_UNKNOWN", sizeof("TYPE_UNKNOWN") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_UNKNOWN_name, &const_TYPE_UNKNOWN_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_UNKNOWN_name); + + zval const_TYPE_STANDALONE_value; + ZVAL_LONG(&const_TYPE_STANDALONE_value, PHONGO_SERVER_STANDALONE); + zend_string *const_TYPE_STANDALONE_name = zend_string_init_interned("TYPE_STANDALONE", sizeof("TYPE_STANDALONE") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_STANDALONE_name, &const_TYPE_STANDALONE_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_STANDALONE_name); + + zval const_TYPE_MONGOS_value; + ZVAL_LONG(&const_TYPE_MONGOS_value, PHONGO_SERVER_MONGOS); + zend_string *const_TYPE_MONGOS_name = zend_string_init_interned("TYPE_MONGOS", sizeof("TYPE_MONGOS") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_MONGOS_name, &const_TYPE_MONGOS_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_MONGOS_name); + + zval const_TYPE_POSSIBLE_PRIMARY_value; + ZVAL_LONG(&const_TYPE_POSSIBLE_PRIMARY_value, PHONGO_SERVER_POSSIBLE_PRIMARY); + zend_string *const_TYPE_POSSIBLE_PRIMARY_name = zend_string_init_interned("TYPE_POSSIBLE_PRIMARY", sizeof("TYPE_POSSIBLE_PRIMARY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_POSSIBLE_PRIMARY_name, &const_TYPE_POSSIBLE_PRIMARY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_POSSIBLE_PRIMARY_name); + + zval const_TYPE_RS_PRIMARY_value; + ZVAL_LONG(&const_TYPE_RS_PRIMARY_value, PHONGO_SERVER_RS_PRIMARY); + zend_string *const_TYPE_RS_PRIMARY_name = zend_string_init_interned("TYPE_RS_PRIMARY", sizeof("TYPE_RS_PRIMARY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_RS_PRIMARY_name, &const_TYPE_RS_PRIMARY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_RS_PRIMARY_name); + + zval const_TYPE_RS_SECONDARY_value; + ZVAL_LONG(&const_TYPE_RS_SECONDARY_value, PHONGO_SERVER_RS_SECONDARY); + zend_string *const_TYPE_RS_SECONDARY_name = zend_string_init_interned("TYPE_RS_SECONDARY", sizeof("TYPE_RS_SECONDARY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_RS_SECONDARY_name, &const_TYPE_RS_SECONDARY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_RS_SECONDARY_name); + + zval const_TYPE_RS_ARBITER_value; + ZVAL_LONG(&const_TYPE_RS_ARBITER_value, PHONGO_SERVER_RS_ARBITER); + zend_string *const_TYPE_RS_ARBITER_name = zend_string_init_interned("TYPE_RS_ARBITER", sizeof("TYPE_RS_ARBITER") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_RS_ARBITER_name, &const_TYPE_RS_ARBITER_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_RS_ARBITER_name); + + zval const_TYPE_RS_OTHER_value; + ZVAL_LONG(&const_TYPE_RS_OTHER_value, PHONGO_SERVER_RS_OTHER); + zend_string *const_TYPE_RS_OTHER_name = zend_string_init_interned("TYPE_RS_OTHER", sizeof("TYPE_RS_OTHER") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_RS_OTHER_name, &const_TYPE_RS_OTHER_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_RS_OTHER_name); + + zval const_TYPE_RS_GHOST_value; + ZVAL_LONG(&const_TYPE_RS_GHOST_value, PHONGO_SERVER_RS_GHOST); + zend_string *const_TYPE_RS_GHOST_name = zend_string_init_interned("TYPE_RS_GHOST", sizeof("TYPE_RS_GHOST") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_RS_GHOST_name, &const_TYPE_RS_GHOST_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_RS_GHOST_name); + + zval const_TYPE_LOAD_BALANCER_value; + ZVAL_LONG(&const_TYPE_LOAD_BALANCER_value, PHONGO_SERVER_LOAD_BALANCER); + zend_string *const_TYPE_LOAD_BALANCER_name = zend_string_init_interned("TYPE_LOAD_BALANCER", sizeof("TYPE_LOAD_BALANCER") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_LOAD_BALANCER_name, &const_TYPE_LOAD_BALANCER_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_LOAD_BALANCER_name); + + return class_entry; +} diff --git a/src/MongoDB/Session.c b/src/MongoDB/Session.c index 794beb9fa..12b187a62 100644 --- a/src/MongoDB/Session.c +++ b/src/MongoDB/Session.c @@ -32,15 +32,10 @@ #include "MongoDB/Server.h" #include "MongoDB/Session.h" #include "MongoDB/WriteConcern.h" +#include "Session_arginfo.h" zend_class_entry* php_phongo_session_ce; -#define PHONGO_TRANSACTION_NONE "none" -#define PHONGO_TRANSACTION_STARTING "starting" -#define PHONGO_TRANSACTION_IN_PROGRESS "in_progress" -#define PHONGO_TRANSACTION_COMMITTED "committed" -#define PHONGO_TRANSACTION_ABORTED "aborted" - #define SESSION_CHECK_LIVELINESS(i, m) \ if (!(i)->client_session) { \ phongo_throw_exception( \ @@ -159,9 +154,12 @@ static void php_phongo_transaction_options_to_zval(mongoc_client_session_t* cs, mongoc_transaction_opts_destroy(opts); } +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_Session) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_Session) + /* {{{ proto void MongoDB\Driver\Session::advanceClusterTime(array|object $clusterTime) Advances the cluster time for this Session */ -static PHP_METHOD(Session, advanceClusterTime) +static PHP_METHOD(MongoDB_Driver_Session, advanceClusterTime) { php_phongo_session_t* intern; zval* zcluster_time; @@ -189,7 +187,7 @@ static PHP_METHOD(Session, advanceClusterTime) /* {{{ proto void MongoDB\Driver\Session::advanceOperationTime(MongoDB\BSON\TimestampInterface $timestamp) Advances the operation time for this Session */ -static PHP_METHOD(Session, advanceOperationTime) +static PHP_METHOD(MongoDB_Driver_Session, advanceOperationTime) { php_phongo_session_t* intern; zval* ztimestamp; @@ -212,7 +210,7 @@ static PHP_METHOD(Session, advanceOperationTime) /* {{{ proto object|null MongoDB\Driver\Session::getClusterTime() Returns the cluster time for this Session */ -static PHP_METHOD(Session, getClusterTime) +static PHP_METHOD(MongoDB_Driver_Session, getClusterTime) { php_phongo_session_t* intern; const bson_t* cluster_time; @@ -242,7 +240,7 @@ static PHP_METHOD(Session, getClusterTime) /* {{{ proto object MongoDB\Driver\Session::getLogicalSessionId() Returns the logical session ID for this Session */ -static PHP_METHOD(Session, getLogicalSessionId) +static PHP_METHOD(MongoDB_Driver_Session, getLogicalSessionId) { php_phongo_session_t* intern; const bson_t* lsid; @@ -268,7 +266,7 @@ static PHP_METHOD(Session, getLogicalSessionId) /* {{{ proto MongoDB\BSON\Timestamp|null MongoDB\Driver\Session::getOperationTime() Returns the operation time for this Session */ -static PHP_METHOD(Session, getOperationTime) +static PHP_METHOD(MongoDB_Driver_Session, getOperationTime) { php_phongo_session_t* intern; uint32_t timestamp, increment; @@ -292,7 +290,7 @@ static PHP_METHOD(Session, getOperationTime) /* {{{ proto MongoDB\Driver\Server|null MongoDB\Driver\Session::getServer() Returns the server this session is pinned to */ -static PHP_METHOD(Session, getServer) +static PHP_METHOD(MongoDB_Driver_Session, getServer) { php_phongo_session_t* intern; uint32_t server_id = 0; @@ -314,7 +312,7 @@ static PHP_METHOD(Session, getServer) /* {{{ proto array|null MongoDB\Driver\Session::getTransactionOptions() Returns options for the currently running transaction */ -static PHP_METHOD(Session, getTransactionOptions) +static PHP_METHOD(MongoDB_Driver_Session, getTransactionOptions) { php_phongo_session_t* intern; @@ -328,7 +326,7 @@ static PHP_METHOD(Session, getTransactionOptions) /* {{{ proto string MongoDB\Driver\Session::getTransactionState() Returns the current transaction state for this session */ -static PHP_METHOD(Session, getTransactionState) +static PHP_METHOD(MongoDB_Driver_Session, getTransactionState) { php_phongo_session_t* intern; const char* state; @@ -446,7 +444,7 @@ mongoc_transaction_opt_t* php_mongodb_session_parse_transaction_options(zval* op /* {{{ proto void MongoDB\Driver\Session::startTransaction([array $options = null]) Starts a new transaction */ -static PHP_METHOD(Session, startTransaction) +static PHP_METHOD(MongoDB_Driver_Session, startTransaction) { php_phongo_session_t* intern; zval* options = NULL; @@ -479,7 +477,7 @@ static PHP_METHOD(Session, startTransaction) /* {{{ proto void MongoDB\Driver\Session::commitTransaction(void) Commits an existing transaction */ -static PHP_METHOD(Session, commitTransaction) +static PHP_METHOD(MongoDB_Driver_Session, commitTransaction) { php_phongo_session_t* intern; bson_error_t error; @@ -499,7 +497,7 @@ static PHP_METHOD(Session, commitTransaction) /* {{{ proto void MongoDB\Driver\Session::abortTransaction(void) Aborts (rolls back) an existing transaction */ -static PHP_METHOD(Session, abortTransaction) +static PHP_METHOD(MongoDB_Driver_Session, abortTransaction) { php_phongo_session_t* intern; bson_error_t error; @@ -516,7 +514,7 @@ static PHP_METHOD(Session, abortTransaction) /* {{{ proto void MongoDB\Driver\Session::endSession(void) Ends the session, and a running transaction if active */ -static PHP_METHOD(Session, endSession) +static PHP_METHOD(MongoDB_Driver_Session, endSession) { php_phongo_session_t* intern; @@ -532,7 +530,7 @@ static PHP_METHOD(Session, endSession) Returns whether the session is dirty (i.e. was used with a command that encountered a network error) and will be discarded when returned to the server session pool. */ -static PHP_METHOD(Session, isDirty) +static PHP_METHOD(MongoDB_Driver_Session, isDirty) { php_phongo_session_t* intern = Z_SESSION_OBJ_P(getThis()); @@ -545,7 +543,7 @@ static PHP_METHOD(Session, isDirty) /* {{{ proto void MongoDB\Driver\Session::isInTransaction(void) Returns whether a multi-document transaction is in progress */ -static PHP_METHOD(Session, isInTransaction) +static PHP_METHOD(MongoDB_Driver_Session, isInTransaction) { php_phongo_session_t* intern; @@ -557,45 +555,6 @@ static PHP_METHOD(Session, isInTransaction) RETURN_BOOL(mongoc_client_session_in_transaction(intern->client_session)); } /* }}} */ -/* {{{ MongoDB\Driver\Session function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_Session_advanceClusterTime, 0, 0, 1) - ZEND_ARG_INFO(0, clusterTime) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Session_advanceOperationTime, 0, 0, 1) - ZEND_ARG_INFO(0, timestamp) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Session_startTransaction, 0, 0, 0) - ZEND_ARG_ARRAY_INFO(0, options, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_Session_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_session_me[] = { - /* clang-format off */ - PHP_ME(Session, abortTransaction, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Session, advanceClusterTime, ai_Session_advanceClusterTime, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Session, advanceOperationTime, ai_Session_advanceOperationTime, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Session, commitTransaction, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Session, endSession, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Session, getClusterTime, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Session, getLogicalSessionId, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Session, getOperationTime, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Session, getServer, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Session, getTransactionOptions, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Session, getTransactionState, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Session, isDirty, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Session, isInTransaction, ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(Session, startTransaction, ai_Session_startTransaction, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_Session_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_Session_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\Session object handlers */ static zend_object_handlers php_phongo_handler_session; @@ -746,24 +705,14 @@ static HashTable* php_phongo_session_get_debug_info(phongo_compat_object_handler void php_phongo_session_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Session", php_phongo_session_me); - php_phongo_session_ce = zend_register_internal_class(&ce); + php_phongo_session_ce = register_class_MongoDB_Driver_Session(); php_phongo_session_ce->create_object = php_phongo_session_create_object; - PHONGO_CE_FINAL(php_phongo_session_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_session_ce); memcpy(&php_phongo_handler_session, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_session.get_debug_info = php_phongo_session_get_debug_info; php_phongo_handler_session.free_obj = php_phongo_session_free_object; php_phongo_handler_session.offset = XtOffsetOf(php_phongo_session_t, std); - - zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_NONE"), PHONGO_TRANSACTION_NONE); - zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_STARTING"), PHONGO_TRANSACTION_STARTING); - zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_IN_PROGRESS"), PHONGO_TRANSACTION_IN_PROGRESS); - zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_COMMITTED"), PHONGO_TRANSACTION_COMMITTED); - zend_declare_class_constant_string(php_phongo_session_ce, ZEND_STRL("TRANSACTION_ABORTED"), PHONGO_TRANSACTION_ABORTED); } /* }}} */ void phongo_session_init(zval* return_value, zval* manager, mongoc_client_session_t* client_session) /* {{{ */ diff --git a/src/MongoDB/Session.h b/src/MongoDB/Session.h index 9162ffb79..5e8caaabc 100644 --- a/src/MongoDB/Session.h +++ b/src/MongoDB/Session.h @@ -21,6 +21,12 @@ #include +#define PHONGO_TRANSACTION_NONE "none" +#define PHONGO_TRANSACTION_STARTING "starting" +#define PHONGO_TRANSACTION_IN_PROGRESS "in_progress" +#define PHONGO_TRANSACTION_COMMITTED "committed" +#define PHONGO_TRANSACTION_ABORTED "aborted" + mongoc_transaction_opt_t* php_mongodb_session_parse_transaction_options(zval* txnOptions); void phongo_session_init(zval* return_value, zval* manager, mongoc_client_session_t* client_session); diff --git a/src/MongoDB/Session.stub.php b/src/MongoDB/Session.stub.php new file mode 100644 index 000000000..6814475c4 --- /dev/null +++ b/src/MongoDB/Session.stub.php @@ -0,0 +1,79 @@ += 80000 + final public function advanceClusterTime(array|object $clusterTime): void {} +#else + /** @param array|object $clusterTime */ + final public function advanceClusterTime($clusterTime): void {} +#endif + + final public function advanceOperationTime(\MongoDB\BSON\TimestampInterface $operationTime): void {} + + final public function commitTransaction(): void {} + + final public function endSession(): void {} + + final public function getClusterTime(): ?object {} + + final public function getLogicalSessionId(): object {} + + final public function getOperationTime(): ?\MongoDB\BSON\Timestamp {} + + final public function getServer(): ?Server {} + + final public function getTransactionOptions(): ?array {} + + final public function getTransactionState(): string {} + + final public function isDirty(): bool {} + + final public function isInTransaction(): bool {} + + final public function startTransaction(?array $options = []): void {} + + final public function __wakeup(): void {} + } +} diff --git a/src/MongoDB/Session_arginfo.h b/src/MongoDB/Session_arginfo.h new file mode 100644 index 000000000..61e65f48b --- /dev/null +++ b/src/MongoDB/Session_arginfo.h @@ -0,0 +1,152 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: b42d72ff67d80eaa211effcaa7827e462cf34552 */ + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Session___construct, 0, 0, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_abortTransaction, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_advanceClusterTime, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_MASK(0, clusterTime, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_advanceClusterTime, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, clusterTime) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_advanceOperationTime, 0, 1, IS_VOID, 0) + ZEND_ARG_OBJ_INFO(0, operationTime, MongoDB\\BSON\\TimestampInterface, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_Driver_Session_commitTransaction arginfo_class_MongoDB_Driver_Session_abortTransaction + +#define arginfo_class_MongoDB_Driver_Session_endSession arginfo_class_MongoDB_Driver_Session_abortTransaction + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_getClusterTime, 0, 0, IS_OBJECT, 1) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_getLogicalSessionId, 0, 0, IS_OBJECT, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Session_getOperationTime, 0, 0, MongoDB\\BSON\\Timestamp, 1) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Session_getServer, 0, 0, MongoDB\\Driver\\Server, 1) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_getTransactionOptions, 0, 0, IS_ARRAY, 1) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_getTransactionState, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_isDirty, 0, 0, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_Driver_Session_isInTransaction arginfo_class_MongoDB_Driver_Session_isDirty + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Session_startTransaction, 0, 0, IS_VOID, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "[]") +ZEND_END_ARG_INFO() + +#define arginfo_class_MongoDB_Driver_Session___wakeup arginfo_class_MongoDB_Driver_Session_abortTransaction + + +static ZEND_METHOD(MongoDB_Driver_Session, __construct); +static ZEND_METHOD(MongoDB_Driver_Session, abortTransaction); +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Session, advanceClusterTime); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_Session, advanceClusterTime); +#endif +static ZEND_METHOD(MongoDB_Driver_Session, advanceOperationTime); +static ZEND_METHOD(MongoDB_Driver_Session, commitTransaction); +static ZEND_METHOD(MongoDB_Driver_Session, endSession); +static ZEND_METHOD(MongoDB_Driver_Session, getClusterTime); +static ZEND_METHOD(MongoDB_Driver_Session, getLogicalSessionId); +static ZEND_METHOD(MongoDB_Driver_Session, getOperationTime); +static ZEND_METHOD(MongoDB_Driver_Session, getServer); +static ZEND_METHOD(MongoDB_Driver_Session, getTransactionOptions); +static ZEND_METHOD(MongoDB_Driver_Session, getTransactionState); +static ZEND_METHOD(MongoDB_Driver_Session, isDirty); +static ZEND_METHOD(MongoDB_Driver_Session, isInTransaction); +static ZEND_METHOD(MongoDB_Driver_Session, startTransaction); +static ZEND_METHOD(MongoDB_Driver_Session, __wakeup); + + +static const zend_function_entry class_MongoDB_Driver_Session_methods[] = { + ZEND_ME(MongoDB_Driver_Session, __construct, arginfo_class_MongoDB_Driver_Session___construct, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Session, abortTransaction, arginfo_class_MongoDB_Driver_Session_abortTransaction, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Session, advanceClusterTime, arginfo_class_MongoDB_Driver_Session_advanceClusterTime, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_Session, advanceClusterTime, arginfo_class_MongoDB_Driver_Session_advanceClusterTime, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_Driver_Session, advanceOperationTime, arginfo_class_MongoDB_Driver_Session_advanceOperationTime, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Session, commitTransaction, arginfo_class_MongoDB_Driver_Session_commitTransaction, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Session, endSession, arginfo_class_MongoDB_Driver_Session_endSession, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Session, getClusterTime, arginfo_class_MongoDB_Driver_Session_getClusterTime, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Session, getLogicalSessionId, arginfo_class_MongoDB_Driver_Session_getLogicalSessionId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Session, getOperationTime, arginfo_class_MongoDB_Driver_Session_getOperationTime, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Session, getServer, arginfo_class_MongoDB_Driver_Session_getServer, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Session, getTransactionOptions, arginfo_class_MongoDB_Driver_Session_getTransactionOptions, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Session, getTransactionState, arginfo_class_MongoDB_Driver_Session_getTransactionState, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Session, isDirty, arginfo_class_MongoDB_Driver_Session_isDirty, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Session, isInTransaction, arginfo_class_MongoDB_Driver_Session_isInTransaction, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Session, startTransaction, arginfo_class_MongoDB_Driver_Session_startTransaction, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Session, __wakeup, arginfo_class_MongoDB_Driver_Session___wakeup, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_FE_END +}; + +static zend_class_entry *register_class_MongoDB_Driver_Session(void) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "Session", class_MongoDB_Driver_Session_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + + zval const_TRANSACTION_NONE_value; + zend_string *const_TRANSACTION_NONE_value_str = zend_string_init(PHONGO_TRANSACTION_NONE, sizeof(PHONGO_TRANSACTION_NONE) - 1, 1); + ZVAL_STR(&const_TRANSACTION_NONE_value, const_TRANSACTION_NONE_value_str); + zend_string *const_TRANSACTION_NONE_name = zend_string_init_interned("TRANSACTION_NONE", sizeof("TRANSACTION_NONE") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TRANSACTION_NONE_name, &const_TRANSACTION_NONE_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TRANSACTION_NONE_name); + + zval const_TRANSACTION_STARTING_value; + zend_string *const_TRANSACTION_STARTING_value_str = zend_string_init(PHONGO_TRANSACTION_STARTING, sizeof(PHONGO_TRANSACTION_STARTING) - 1, 1); + ZVAL_STR(&const_TRANSACTION_STARTING_value, const_TRANSACTION_STARTING_value_str); + zend_string *const_TRANSACTION_STARTING_name = zend_string_init_interned("TRANSACTION_STARTING", sizeof("TRANSACTION_STARTING") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TRANSACTION_STARTING_name, &const_TRANSACTION_STARTING_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TRANSACTION_STARTING_name); + + zval const_TRANSACTION_IN_PROGRESS_value; + zend_string *const_TRANSACTION_IN_PROGRESS_value_str = zend_string_init(PHONGO_TRANSACTION_IN_PROGRESS, sizeof(PHONGO_TRANSACTION_IN_PROGRESS) - 1, 1); + ZVAL_STR(&const_TRANSACTION_IN_PROGRESS_value, const_TRANSACTION_IN_PROGRESS_value_str); + zend_string *const_TRANSACTION_IN_PROGRESS_name = zend_string_init_interned("TRANSACTION_IN_PROGRESS", sizeof("TRANSACTION_IN_PROGRESS") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TRANSACTION_IN_PROGRESS_name, &const_TRANSACTION_IN_PROGRESS_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TRANSACTION_IN_PROGRESS_name); + + zval const_TRANSACTION_COMMITTED_value; + zend_string *const_TRANSACTION_COMMITTED_value_str = zend_string_init(PHONGO_TRANSACTION_COMMITTED, sizeof(PHONGO_TRANSACTION_COMMITTED) - 1, 1); + ZVAL_STR(&const_TRANSACTION_COMMITTED_value, const_TRANSACTION_COMMITTED_value_str); + zend_string *const_TRANSACTION_COMMITTED_name = zend_string_init_interned("TRANSACTION_COMMITTED", sizeof("TRANSACTION_COMMITTED") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TRANSACTION_COMMITTED_name, &const_TRANSACTION_COMMITTED_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TRANSACTION_COMMITTED_name); + + zval const_TRANSACTION_ABORTED_value; + zend_string *const_TRANSACTION_ABORTED_value_str = zend_string_init(PHONGO_TRANSACTION_ABORTED, sizeof(PHONGO_TRANSACTION_ABORTED) - 1, 1); + ZVAL_STR(&const_TRANSACTION_ABORTED_value, const_TRANSACTION_ABORTED_value_str); + zend_string *const_TRANSACTION_ABORTED_name = zend_string_init_interned("TRANSACTION_ABORTED", sizeof("TRANSACTION_ABORTED") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TRANSACTION_ABORTED_name, &const_TRANSACTION_ABORTED_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TRANSACTION_ABORTED_name); + + return class_entry; +} diff --git a/src/MongoDB/TopologyDescription.c b/src/MongoDB/TopologyDescription.c index a87c45547..ab24eb6ba 100644 --- a/src/MongoDB/TopologyDescription.c +++ b/src/MongoDB/TopologyDescription.c @@ -27,21 +27,15 @@ #include "MongoDB/ReadPreference.h" #include "MongoDB/ServerDescription.h" #include "MongoDB/TopologyDescription.h" +#include "TopologyDescription_arginfo.h" zend_class_entry* php_phongo_topologydescription_ce; -/* Note: these constants are derived from _mongoc_topology_description_type, - * since mongoc_topology_description_t is private. */ -#define PHONGO_TOPOLOGY_UNKNOWN "Unknown" -#define PHONGO_TOPOLOGY_SINGLE "Single" -#define PHONGO_TOPOLOGY_SHARDED "Sharded" -#define PHONGO_TOPOLOGY_REPLICA_SET_NO_PRIMARY "ReplicaSetNoPrimary" -#define PHONGO_TOPOLOGY_REPLICA_SET_WITH_PRIMARY "ReplicaSetWithPrimary" -#define PHONGO_TOPOLOGY_LOAD_BALANCED "LoadBalanced" +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_TopologyDescription) /* {{{ proto array MongoDB\Driver\TopologyDescription::getServers() Returns an array of ServerDescription objects for all known servers in the topology */ -static PHP_METHOD(TopologyDescription, getServers) +static PHP_METHOD(MongoDB_Driver_TopologyDescription, getServers) { php_phongo_topologydescription_t* intern; mongoc_server_description_t** sds; @@ -66,7 +60,7 @@ static PHP_METHOD(TopologyDescription, getServers) /* {{{ proto boolean MongoDB\Driver\TopologyDescription::hasReadableServer([MongoDB\Driver\ReadPreference $readPreference]) Returns whether the topology has a readable server available */ -static PHP_METHOD(TopologyDescription, hasReadableServer) +static PHP_METHOD(MongoDB_Driver_TopologyDescription, hasReadableServer) { php_phongo_topologydescription_t* intern; const mongoc_read_prefs_t* read_preference = NULL; @@ -88,7 +82,7 @@ static PHP_METHOD(TopologyDescription, hasReadableServer) /* {{{ proto boolean MongoDB\Driver\TopologyDescription::hasWritableServer() Returns whether the topology has a writable server available */ -static PHP_METHOD(TopologyDescription, hasWritableServer) +static PHP_METHOD(MongoDB_Driver_TopologyDescription, hasWritableServer) { php_phongo_topologydescription_t* intern = Z_TOPOLOGYDESCRIPTION_OBJ_P(getThis()); @@ -99,7 +93,7 @@ static PHP_METHOD(TopologyDescription, hasWritableServer) /* {{{ proto string MongoDB\Driver\TopologyDescription::getType() Returns the topology type */ -static PHP_METHOD(TopologyDescription, getType) +static PHP_METHOD(MongoDB_Driver_TopologyDescription, getType) { php_phongo_topologydescription_t* intern = Z_TOPOLOGYDESCRIPTION_OBJ_P(getThis()); @@ -108,26 +102,6 @@ static PHP_METHOD(TopologyDescription, getType) RETVAL_STRING(mongoc_topology_description_type(intern->topology_description)); } /* }}} */ -/* {{{ MongoDB\Driver\TopologyDescription function entries */ -/* clang-format off */ -ZEND_BEGIN_ARG_INFO_EX(ai_TopologyDescription_hasReadableServer, 0, 0, 0) - ZEND_ARG_OBJ_INFO(0, readPreference, MongoDB\\Driver\\ReadPreference, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_TopologyDescription_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_topologydescription_me[] = { - PHP_ME(TopologyDescription, getServers, ai_TopologyDescription_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(TopologyDescription, hasReadableServer, ai_TopologyDescription_hasReadableServer, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(TopologyDescription, hasWritableServer, ai_TopologyDescription_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(TopologyDescription, getType, ai_TopologyDescription_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_TopologyDescription_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - PHP_FE_END -}; -/* clang-format on */ -/* }}} */ - /* {{{ MongoDB\Driver\TopologyDescription object handlers */ static zend_object_handlers php_phongo_handler_topologydescription; @@ -213,12 +187,8 @@ static HashTable* php_phongo_topologydescription_get_properties(phongo_compat_ob void php_phongo_topologydescription_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "TopologyDescription", php_phongo_topologydescription_me); - php_phongo_topologydescription_ce = zend_register_internal_class(&ce); + php_phongo_topologydescription_ce = register_class_MongoDB_Driver_TopologyDescription(); php_phongo_topologydescription_ce->create_object = php_phongo_topologydescription_create_object; - PHONGO_CE_FINAL(php_phongo_topologydescription_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_topologydescription_ce); memcpy(&php_phongo_handler_topologydescription, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -226,13 +196,6 @@ void php_phongo_topologydescription_init_ce(INIT_FUNC_ARGS) /* {{{ */ php_phongo_handler_topologydescription.get_properties = php_phongo_topologydescription_get_properties; php_phongo_handler_topologydescription.free_obj = php_phongo_topologydescription_free_object; php_phongo_handler_topologydescription.offset = XtOffsetOf(php_phongo_topologydescription_t, std); - - zend_declare_class_constant_string(php_phongo_topologydescription_ce, ZEND_STRL("TYPE_UNKNOWN"), PHONGO_TOPOLOGY_UNKNOWN); - zend_declare_class_constant_string(php_phongo_topologydescription_ce, ZEND_STRL("TYPE_SINGLE"), PHONGO_TOPOLOGY_SINGLE); - zend_declare_class_constant_string(php_phongo_topologydescription_ce, ZEND_STRL("TYPE_SHARDED"), PHONGO_TOPOLOGY_SHARDED); - zend_declare_class_constant_string(php_phongo_topologydescription_ce, ZEND_STRL("TYPE_REPLICA_SET_NO_PRIMARY"), PHONGO_TOPOLOGY_REPLICA_SET_NO_PRIMARY); - zend_declare_class_constant_string(php_phongo_topologydescription_ce, ZEND_STRL("TYPE_REPLICA_SET_WITH_PRIMARY"), PHONGO_TOPOLOGY_REPLICA_SET_WITH_PRIMARY); - zend_declare_class_constant_string(php_phongo_topologydescription_ce, ZEND_STRL("TYPE_LOAD_BALANCED"), PHONGO_TOPOLOGY_LOAD_BALANCED); } /* }}} */ void phongo_topologydescription_init(zval* return_value, mongoc_topology_description_t* topology_description) /* {{{ */ diff --git a/src/MongoDB/TopologyDescription.h b/src/MongoDB/TopologyDescription.h index 2e5af3697..66c2631c8 100644 --- a/src/MongoDB/TopologyDescription.h +++ b/src/MongoDB/TopologyDescription.h @@ -21,6 +21,15 @@ #include +/* Note: these constants are derived from _mongoc_topology_description_type, + * since mongoc_topology_description_t is private. */ +#define PHONGO_TOPOLOGY_UNKNOWN "Unknown" +#define PHONGO_TOPOLOGY_SINGLE "Single" +#define PHONGO_TOPOLOGY_SHARDED "Sharded" +#define PHONGO_TOPOLOGY_REPLICA_SET_NO_PRIMARY "ReplicaSetNoPrimary" +#define PHONGO_TOPOLOGY_REPLICA_SET_WITH_PRIMARY "ReplicaSetWithPrimary" +#define PHONGO_TOPOLOGY_LOAD_BALANCED "LoadBalanced" + void phongo_topologydescription_init(zval* return_value, mongoc_topology_description_t* topology_description); #endif /* PHONGO_TOPOLOGYDESCRIPTION_H */ diff --git a/src/MongoDB/TopologyDescription.stub.php b/src/MongoDB/TopologyDescription.stub.php new file mode 100644 index 000000000..7d6840ccf --- /dev/null +++ b/src/MongoDB/TopologyDescription.stub.php @@ -0,0 +1,58 @@ +ce_flags |= ZEND_ACC_FINAL; + + zval const_TYPE_UNKNOWN_value; + zend_string *const_TYPE_UNKNOWN_value_str = zend_string_init(PHONGO_TOPOLOGY_UNKNOWN, sizeof(PHONGO_TOPOLOGY_UNKNOWN) - 1, 1); + ZVAL_STR(&const_TYPE_UNKNOWN_value, const_TYPE_UNKNOWN_value_str); + zend_string *const_TYPE_UNKNOWN_name = zend_string_init_interned("TYPE_UNKNOWN", sizeof("TYPE_UNKNOWN") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_UNKNOWN_name, &const_TYPE_UNKNOWN_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_UNKNOWN_name); + + zval const_TYPE_SINGLE_value; + zend_string *const_TYPE_SINGLE_value_str = zend_string_init(PHONGO_TOPOLOGY_SINGLE, sizeof(PHONGO_TOPOLOGY_SINGLE) - 1, 1); + ZVAL_STR(&const_TYPE_SINGLE_value, const_TYPE_SINGLE_value_str); + zend_string *const_TYPE_SINGLE_name = zend_string_init_interned("TYPE_SINGLE", sizeof("TYPE_SINGLE") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_SINGLE_name, &const_TYPE_SINGLE_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_SINGLE_name); + + zval const_TYPE_SHARDED_value; + zend_string *const_TYPE_SHARDED_value_str = zend_string_init(PHONGO_TOPOLOGY_SHARDED, sizeof(PHONGO_TOPOLOGY_SHARDED) - 1, 1); + ZVAL_STR(&const_TYPE_SHARDED_value, const_TYPE_SHARDED_value_str); + zend_string *const_TYPE_SHARDED_name = zend_string_init_interned("TYPE_SHARDED", sizeof("TYPE_SHARDED") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_SHARDED_name, &const_TYPE_SHARDED_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_SHARDED_name); + + zval const_TYPE_REPLICA_SET_NO_PRIMARY_value; + zend_string *const_TYPE_REPLICA_SET_NO_PRIMARY_value_str = zend_string_init(PHONGO_TOPOLOGY_REPLICA_SET_NO_PRIMARY, sizeof(PHONGO_TOPOLOGY_REPLICA_SET_NO_PRIMARY) - 1, 1); + ZVAL_STR(&const_TYPE_REPLICA_SET_NO_PRIMARY_value, const_TYPE_REPLICA_SET_NO_PRIMARY_value_str); + zend_string *const_TYPE_REPLICA_SET_NO_PRIMARY_name = zend_string_init_interned("TYPE_REPLICA_SET_NO_PRIMARY", sizeof("TYPE_REPLICA_SET_NO_PRIMARY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_REPLICA_SET_NO_PRIMARY_name, &const_TYPE_REPLICA_SET_NO_PRIMARY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_REPLICA_SET_NO_PRIMARY_name); + + zval const_TYPE_REPLICA_SET_WITH_PRIMARY_value; + zend_string *const_TYPE_REPLICA_SET_WITH_PRIMARY_value_str = zend_string_init(PHONGO_TOPOLOGY_REPLICA_SET_WITH_PRIMARY, sizeof(PHONGO_TOPOLOGY_REPLICA_SET_WITH_PRIMARY) - 1, 1); + ZVAL_STR(&const_TYPE_REPLICA_SET_WITH_PRIMARY_value, const_TYPE_REPLICA_SET_WITH_PRIMARY_value_str); + zend_string *const_TYPE_REPLICA_SET_WITH_PRIMARY_name = zend_string_init_interned("TYPE_REPLICA_SET_WITH_PRIMARY", sizeof("TYPE_REPLICA_SET_WITH_PRIMARY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_REPLICA_SET_WITH_PRIMARY_name, &const_TYPE_REPLICA_SET_WITH_PRIMARY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_REPLICA_SET_WITH_PRIMARY_name); + + zval const_TYPE_LOAD_BALANCED_value; + zend_string *const_TYPE_LOAD_BALANCED_value_str = zend_string_init(PHONGO_TOPOLOGY_LOAD_BALANCED, sizeof(PHONGO_TOPOLOGY_LOAD_BALANCED) - 1, 1); + ZVAL_STR(&const_TYPE_LOAD_BALANCED_value, const_TYPE_LOAD_BALANCED_value_str); + zend_string *const_TYPE_LOAD_BALANCED_name = zend_string_init_interned("TYPE_LOAD_BALANCED", sizeof("TYPE_LOAD_BALANCED") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_TYPE_LOAD_BALANCED_name, &const_TYPE_LOAD_BALANCED_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_TYPE_LOAD_BALANCED_name); + + return class_entry; +} diff --git a/src/MongoDB/WriteConcern.c b/src/MongoDB/WriteConcern.c index 8d31b9f76..ba31bdac1 100644 --- a/src/MongoDB/WriteConcern.c +++ b/src/MongoDB/WriteConcern.c @@ -26,6 +26,7 @@ #include "phongo_util.h" #include "MongoDB/WriteConcern.h" +#include "WriteConcern_arginfo.h" zend_class_entry* php_phongo_writeconcern_ce; @@ -108,7 +109,7 @@ static bool php_phongo_writeconcern_init_from_hash(php_phongo_writeconcern_t* in /* {{{ proto void MongoDB\Driver\WriteConcern::__construct(integer|string $w[, integer $wtimeout[, boolean $journal]]) Constructs a new WriteConcern */ -static PHP_METHOD(WriteConcern, __construct) +static PHP_METHOD(MongoDB_Driver_WriteConcern, __construct) { php_phongo_writeconcern_t* intern; zval * w, *journal = NULL; @@ -171,7 +172,7 @@ static PHP_METHOD(WriteConcern, __construct) /* {{{ proto MongoDB\Driver\WriteConcern MongoDB\Driver\WriteConcern::__set_state(array $properties) */ -static PHP_METHOD(WriteConcern, __set_state) +static PHP_METHOD(MongoDB_Driver_WriteConcern, __set_state) { php_phongo_writeconcern_t* intern; HashTable* props; @@ -191,7 +192,7 @@ static PHP_METHOD(WriteConcern, __set_state) /* {{{ proto string|integer|null MongoDB\Driver\WriteConcern::getW() Returns the WriteConcern "w" option */ -static PHP_METHOD(WriteConcern, getW) +static PHP_METHOD(MongoDB_Driver_WriteConcern, getW) { php_phongo_writeconcern_t* intern; const char* wtag; @@ -219,7 +220,7 @@ static PHP_METHOD(WriteConcern, getW) /* {{{ proto integer MongoDB\Driver\WriteConcern::getWtimeout() Returns the WriteConcern "wtimeout" option */ -static PHP_METHOD(WriteConcern, getWtimeout) +static PHP_METHOD(MongoDB_Driver_WriteConcern, getWtimeout) { php_phongo_writeconcern_t* intern; int64_t wtimeout; @@ -241,7 +242,7 @@ static PHP_METHOD(WriteConcern, getWtimeout) /* {{{ proto null|boolean MongoDB\Driver\WriteConcern::getJournal() Returns the WriteConcern "journal" option */ -static PHP_METHOD(WriteConcern, getJournal) +static PHP_METHOD(MongoDB_Driver_WriteConcern, getJournal) { php_phongo_writeconcern_t* intern; @@ -259,7 +260,7 @@ static PHP_METHOD(WriteConcern, getJournal) /* {{{ proto boolean MongoDB\Driver\WriteConcern::isDefault() Returns whether the write concern has not been modified (i.e. from a Manager with no write concern URI options). */ -static PHP_METHOD(WriteConcern, isDefault) +static PHP_METHOD(MongoDB_Driver_WriteConcern, isDefault) { php_phongo_writeconcern_t* intern; @@ -343,7 +344,7 @@ static HashTable* php_phongo_writeconcern_get_properties_hash(phongo_compat_obje /* {{{ proto array MongoDB\Driver\WriteConcern::bsonSerialize() */ -static PHP_METHOD(WriteConcern, bsonSerialize) +static PHP_METHOD(MongoDB_Driver_WriteConcern, bsonSerialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -353,7 +354,7 @@ static PHP_METHOD(WriteConcern, bsonSerialize) /* {{{ proto string MongoDB\Driver\WriteConcern::serialize() */ -static PHP_METHOD(WriteConcern, serialize) +static PHP_METHOD(MongoDB_Driver_WriteConcern, serialize) { php_phongo_writeconcern_t* intern; zval retval; @@ -410,7 +411,7 @@ static PHP_METHOD(WriteConcern, serialize) /* {{{ proto void MongoDB\Driver\WriteConcern::unserialize(string $serialized) */ -static PHP_METHOD(WriteConcern, unserialize) +static PHP_METHOD(MongoDB_Driver_WriteConcern, unserialize) { php_phongo_writeconcern_t* intern; char* serialized; @@ -444,7 +445,7 @@ static PHP_METHOD(WriteConcern, unserialize) /* {{{ proto array MongoDB\Driver\WriteConcern::__serialize() */ -static PHP_METHOD(WriteConcern, __serialize) +static PHP_METHOD(MongoDB_Driver_WriteConcern, __serialize) { PHONGO_PARSE_PARAMETERS_NONE(); @@ -453,7 +454,7 @@ static PHP_METHOD(WriteConcern, __serialize) /* {{{ proto void MongoDB\Driver\WriteConcern::__unserialize(array $data) */ -static PHP_METHOD(WriteConcern, __unserialize) +static PHP_METHOD(MongoDB_Driver_WriteConcern, __unserialize) { zval* data; @@ -464,46 +465,6 @@ static PHP_METHOD(WriteConcern, __unserialize) php_phongo_writeconcern_init_from_hash(Z_WRITECONCERN_OBJ_P(getThis()), Z_ARRVAL_P(data)); } /* }}} */ -/* {{{ MongoDB\Driver\WriteConcern function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcern___construct, 0, 0, 1) - ZEND_ARG_INFO(0, w) - ZEND_ARG_INFO(0, wtimeout) - ZEND_ARG_INFO(0, journal) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcern___set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, properties, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcern___unserialize, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, data, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcern_unserialize, 0, 0, 1) - ZEND_ARG_INFO(0, serialized) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcern_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_writeconcern_me[] = { - /* clang-format off */ - PHP_ME(WriteConcern, __construct, ai_WriteConcern___construct, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteConcern, __serialize, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteConcern, __set_state, ai_WriteConcern___set_state, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(WriteConcern, __unserialize, ai_WriteConcern___unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteConcern, getW, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteConcern, getWtimeout, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteConcern, getJournal, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteConcern, isDefault, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteConcern, bsonSerialize, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteConcern, serialize, ai_WriteConcern_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteConcern, unserialize, ai_WriteConcern_unserialize, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\WriteConcern object handlers */ static zend_object_handlers php_phongo_handler_writeconcern; @@ -548,23 +509,14 @@ static HashTable* php_phongo_writeconcern_get_properties(phongo_compat_object_ha void php_phongo_writeconcern_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteConcern", php_phongo_writeconcern_me); - php_phongo_writeconcern_ce = zend_register_internal_class(&ce); + php_phongo_writeconcern_ce = register_class_MongoDB_Driver_WriteConcern(php_phongo_serializable_ce, zend_ce_serializable); php_phongo_writeconcern_ce->create_object = php_phongo_writeconcern_create_object; - PHONGO_CE_FINAL(php_phongo_writeconcern_ce); - - zend_class_implements(php_phongo_writeconcern_ce, 1, php_phongo_serializable_ce); - zend_class_implements(php_phongo_writeconcern_ce, 1, zend_ce_serializable); memcpy(&php_phongo_handler_writeconcern, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); php_phongo_handler_writeconcern.get_debug_info = php_phongo_writeconcern_get_debug_info; php_phongo_handler_writeconcern.get_properties = php_phongo_writeconcern_get_properties; php_phongo_handler_writeconcern.free_obj = php_phongo_writeconcern_free_object; php_phongo_handler_writeconcern.offset = XtOffsetOf(php_phongo_writeconcern_t, std); - - zend_declare_class_constant_stringl(php_phongo_writeconcern_ce, ZEND_STRL("MAJORITY"), ZEND_STRL(PHONGO_WRITE_CONCERN_W_MAJORITY)); } /* }}} */ void phongo_writeconcern_init(zval* return_value, const mongoc_write_concern_t* write_concern) /* {{{ */ diff --git a/src/MongoDB/WriteConcern.stub.php b/src/MongoDB/WriteConcern.stub.php new file mode 100644 index 000000000..39c42c7a9 --- /dev/null +++ b/src/MongoDB/WriteConcern.stub.php @@ -0,0 +1,57 @@ += 80000 + final public function __construct(string|int $w, ?int $wtimeout = null, ?bool $journal = null) {} +#else + /** @param string|int $w */ + final public function __construct($w, ?int $wtimeout = null, ?bool $journal = null) {} +#endif + + final public function getJournal(): ?bool {} + +#if PHP_VERSION_ID >= 80000 + final public function getW(): string|int|null {} +#else + /** @return string|int|null */ + final public function getW() {} +#endif + + final public function getWtimeout(): ?int {} + + final public function isDefault(): bool {} + + public static function __set_state(array $properties): WriteConcern {} + +#if PHP_VERSION_ID >= 80000 + final public function bsonSerialize(): array|object {} +#else + /** @return array|object */ + final public function bsonSerialize() {} +#endif + + final public function serialize(): string {} + + /** @param string $serialized */ + final public function unserialize($serialized): void {} + + final public function __unserialize(array $data): void {} + + final public function __serialize(): array {} + + } +} diff --git a/src/MongoDB/WriteConcernError.c b/src/MongoDB/WriteConcernError.c index bbe2b7765..2338c9fff 100644 --- a/src/MongoDB/WriteConcernError.c +++ b/src/MongoDB/WriteConcernError.c @@ -23,12 +23,16 @@ #include "phongo_error.h" #include "MongoDB/WriteConcernError.h" +#include "WriteConcernError_arginfo.h" zend_class_entry* php_phongo_writeconcernerror_ce; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_WriteConcernError) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_WriteConcernError) + /* {{{ proto integer MongoDB\Driver\WriteConcernError::getCode() Returns the MongoDB error code */ -static PHP_METHOD(WriteConcernError, getCode) +static PHP_METHOD(MongoDB_Driver_WriteConcernError, getCode) { php_phongo_writeconcernerror_t* intern; @@ -41,7 +45,7 @@ static PHP_METHOD(WriteConcernError, getCode) /* {{{ proto object|null MongoDB\Driver\WriteConcernError::getInfo() Returns additional metadata for the error */ -static PHP_METHOD(WriteConcernError, getInfo) +static PHP_METHOD(MongoDB_Driver_WriteConcernError, getInfo) { php_phongo_writeconcernerror_t* intern; @@ -56,7 +60,7 @@ static PHP_METHOD(WriteConcernError, getInfo) /* {{{ proto string MongoDB\Driver\WriteConcernError::getMessage() Returns the actual error message from the server */ -static PHP_METHOD(WriteConcernError, getMessage) +static PHP_METHOD(MongoDB_Driver_WriteConcernError, getMessage) { php_phongo_writeconcernerror_t* intern; @@ -67,22 +71,6 @@ static PHP_METHOD(WriteConcernError, getMessage) RETURN_STRING(intern->message); } /* }}} */ -/* {{{ MongoDB\Driver\WriteConcernError function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_WriteConcernError_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_writeconcernerror_me[] = { - /* clang-format off */ - PHP_ME(WriteConcernError, getCode, ai_WriteConcernError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteConcernError, getInfo, ai_WriteConcernError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteConcernError, getMessage, ai_WriteConcernError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_WriteConcernError_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_WriteConcernError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\WriteConcernError object handlers */ static zend_object_handlers php_phongo_handler_writeconcernerror; @@ -137,12 +125,8 @@ static HashTable* php_phongo_writeconcernerror_get_debug_info(phongo_compat_obje void php_phongo_writeconcernerror_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteConcernError", php_phongo_writeconcernerror_me); - php_phongo_writeconcernerror_ce = zend_register_internal_class(&ce); + php_phongo_writeconcernerror_ce = register_class_MongoDB_Driver_WriteConcernError(); php_phongo_writeconcernerror_ce->create_object = php_phongo_writeconcernerror_create_object; - PHONGO_CE_FINAL(php_phongo_writeconcernerror_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_writeconcernerror_ce); memcpy(&php_phongo_handler_writeconcernerror, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/WriteConcernError.stub.php b/src/MongoDB/WriteConcernError.stub.php new file mode 100644 index 000000000..c5bb98275 --- /dev/null +++ b/src/MongoDB/WriteConcernError.stub.php @@ -0,0 +1,22 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/WriteConcern_arginfo.h b/src/MongoDB/WriteConcern_arginfo.h new file mode 100644 index 000000000..a1227e6fa --- /dev/null +++ b/src/MongoDB/WriteConcern_arginfo.h @@ -0,0 +1,142 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 846d7edf5b49ec5553bcfc69134d14abbf07a71b */ + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern___construct, 0, 0, 1) + ZEND_ARG_TYPE_MASK(0, w, MAY_BE_STRING|MAY_BE_LONG, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, wtimeout, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, journal, _IS_BOOL, 1, "null") +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern___construct, 0, 0, 1) + ZEND_ARG_INFO(0, w) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, wtimeout, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, journal, _IS_BOOL, 1, "null") +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_getJournal, 0, 0, _IS_BOOL, 1) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_WriteConcern_getW, 0, 0, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_NULL) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_getW, 0, 0, 0) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_getWtimeout, 0, 0, IS_LONG, 1) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_isDefault, 0, 0, _IS_BOOL, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern___set_state, 0, 1, MongoDB\\Driver\\WriteConcern, 0) + ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_WriteConcern_bsonSerialize, 0, 0, MAY_BE_ARRAY|MAY_BE_OBJECT) +ZEND_END_ARG_INFO() +#endif + +#if !(PHP_VERSION_ID >= 80000) +#define arginfo_class_MongoDB_Driver_WriteConcern_bsonSerialize arginfo_class_MongoDB_Driver_WriteConcern_getW +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_serialize, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, serialized) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern___unserialize, 0, 1, IS_VOID, 0) + ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern___serialize, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + + +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_WriteConcern, __construct); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_WriteConcern, __construct); +#endif +static ZEND_METHOD(MongoDB_Driver_WriteConcern, getJournal); +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_WriteConcern, getW); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_WriteConcern, getW); +#endif +static ZEND_METHOD(MongoDB_Driver_WriteConcern, getWtimeout); +static ZEND_METHOD(MongoDB_Driver_WriteConcern, isDefault); +static ZEND_METHOD(MongoDB_Driver_WriteConcern, __set_state); +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_WriteConcern, bsonSerialize); +#endif +#if !(PHP_VERSION_ID >= 80000) +static ZEND_METHOD(MongoDB_Driver_WriteConcern, bsonSerialize); +#endif +static ZEND_METHOD(MongoDB_Driver_WriteConcern, serialize); +static ZEND_METHOD(MongoDB_Driver_WriteConcern, unserialize); +static ZEND_METHOD(MongoDB_Driver_WriteConcern, __unserialize); +static ZEND_METHOD(MongoDB_Driver_WriteConcern, __serialize); + + +static const zend_function_entry class_MongoDB_Driver_WriteConcern_methods[] = { +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_WriteConcern, __construct, arginfo_class_MongoDB_Driver_WriteConcern___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_WriteConcern, __construct, arginfo_class_MongoDB_Driver_WriteConcern___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_Driver_WriteConcern, getJournal, arginfo_class_MongoDB_Driver_WriteConcern_getJournal, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_WriteConcern, getW, arginfo_class_MongoDB_Driver_WriteConcern_getW, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_WriteConcern, getW, arginfo_class_MongoDB_Driver_WriteConcern_getW, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_Driver_WriteConcern, getWtimeout, arginfo_class_MongoDB_Driver_WriteConcern_getWtimeout, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_WriteConcern, isDefault, arginfo_class_MongoDB_Driver_WriteConcern_isDefault, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_WriteConcern, __set_state, arginfo_class_MongoDB_Driver_WriteConcern___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_WriteConcern, bsonSerialize, arginfo_class_MongoDB_Driver_WriteConcern_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif +#if !(PHP_VERSION_ID >= 80000) + ZEND_ME(MongoDB_Driver_WriteConcern, bsonSerialize, arginfo_class_MongoDB_Driver_WriteConcern_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif + ZEND_ME(MongoDB_Driver_WriteConcern, serialize, arginfo_class_MongoDB_Driver_WriteConcern_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_WriteConcern, unserialize, arginfo_class_MongoDB_Driver_WriteConcern_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_WriteConcern, __unserialize, arginfo_class_MongoDB_Driver_WriteConcern___unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_WriteConcern, __serialize, arginfo_class_MongoDB_Driver_WriteConcern___serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_FE_END +}; + +static zend_class_entry *register_class_MongoDB_Driver_WriteConcern(zend_class_entry *class_entry_MongoDB_BSON_Serializable, zend_class_entry *class_entry_Serializable) +{ + zend_class_entry ce, *class_entry; + + INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteConcern", class_MongoDB_Driver_WriteConcern_methods); + class_entry = zend_register_internal_class_ex(&ce, NULL); + class_entry->ce_flags |= ZEND_ACC_FINAL; + zend_class_implements(class_entry, 2, class_entry_MongoDB_BSON_Serializable, class_entry_Serializable); + + zval const_MAJORITY_value; + zend_string *const_MAJORITY_value_str = zend_string_init(PHONGO_WRITE_CONCERN_W_MAJORITY, sizeof(PHONGO_WRITE_CONCERN_W_MAJORITY) - 1, 1); + ZVAL_STR(&const_MAJORITY_value, const_MAJORITY_value_str); + zend_string *const_MAJORITY_name = zend_string_init_interned("MAJORITY", sizeof("MAJORITY") - 1, 1); + zend_declare_class_constant_ex(class_entry, const_MAJORITY_name, &const_MAJORITY_value, ZEND_ACC_PUBLIC, NULL); + zend_string_release(const_MAJORITY_name); + + return class_entry; +} diff --git a/src/MongoDB/WriteError.c b/src/MongoDB/WriteError.c index 9015b2f06..31c601576 100644 --- a/src/MongoDB/WriteError.c +++ b/src/MongoDB/WriteError.c @@ -23,12 +23,16 @@ #include "phongo_error.h" #include "MongoDB/WriteError.h" +#include "WriteError_arginfo.h" zend_class_entry* php_phongo_writeerror_ce; +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_WriteError) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_WriteError) + /* {{{ proto integer MongoDB\Driver\WriteError::getCode() Returns the MongoDB error code */ -static PHP_METHOD(WriteError, getCode) +static PHP_METHOD(MongoDB_Driver_WriteError, getCode) { php_phongo_writeerror_t* intern; @@ -42,7 +46,7 @@ static PHP_METHOD(WriteError, getCode) /* {{{ proto integer MongoDB\Driver\WriteError::getIndex() Returns the index of the operation in the BulkWrite to which this WriteError corresponds. */ -static PHP_METHOD(WriteError, getIndex) +static PHP_METHOD(MongoDB_Driver_WriteError, getIndex) { php_phongo_writeerror_t* intern; @@ -55,7 +59,7 @@ static PHP_METHOD(WriteError, getIndex) /* {{{ proto string MongoDB\Driver\WriteError::getMessage() Returns the actual error message from the server */ -static PHP_METHOD(WriteError, getMessage) +static PHP_METHOD(MongoDB_Driver_WriteError, getMessage) { php_phongo_writeerror_t* intern; @@ -68,7 +72,7 @@ static PHP_METHOD(WriteError, getMessage) /* {{{ proto object|null MongoDB\Driver\WriteError::getInfo() Returns additional metadata for the error */ -static PHP_METHOD(WriteError, getInfo) +static PHP_METHOD(MongoDB_Driver_WriteError, getInfo) { php_phongo_writeerror_t* intern; @@ -81,23 +85,6 @@ static PHP_METHOD(WriteError, getInfo) } } /* }}} */ -/* {{{ MongoDB\Driver\WriteError function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_WriteError_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_writeerror_me[] = { - /* clang-format off */ - PHP_ME(WriteError, getCode, ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteError, getIndex, ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteError, getMessage, ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteError, getInfo, ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_WriteError_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_WriteError_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\WriteError object handlers */ static zend_object_handlers php_phongo_handler_writeerror; @@ -153,12 +140,8 @@ static HashTable* php_phongo_writeerror_get_debug_info(phongo_compat_object_hand void php_phongo_writeerror_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteError", php_phongo_writeerror_me); - php_phongo_writeerror_ce = zend_register_internal_class(&ce); + php_phongo_writeerror_ce = register_class_MongoDB_Driver_WriteError(); php_phongo_writeerror_ce->create_object = php_phongo_writeerror_create_object; - PHONGO_CE_FINAL(php_phongo_writeerror_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_writeerror_ce); memcpy(&php_phongo_handler_writeerror, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/WriteError.stub.php b/src/MongoDB/WriteError.stub.php new file mode 100644 index 000000000..44202dc42 --- /dev/null +++ b/src/MongoDB/WriteError.stub.php @@ -0,0 +1,24 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} diff --git a/src/MongoDB/WriteResult.c b/src/MongoDB/WriteResult.c index 1e29c5bcc..e5163487f 100644 --- a/src/MongoDB/WriteResult.c +++ b/src/MongoDB/WriteResult.c @@ -29,6 +29,7 @@ #include "MongoDB/WriteConcern.h" #include "MongoDB/WriteConcernError.h" #include "MongoDB/WriteError.h" +#include "WriteResult_arginfo.h" #define PHONGO_WRITERESULT_RETURN_LONG_FROM_BSON_INT32(iter, bson, key) \ if (bson_iter_init_find((iter), (bson), (key)) && BSON_ITER_HOLDS_INT32((iter))) { \ @@ -109,9 +110,12 @@ static bool php_phongo_writeresult_get_writeerrors(php_phongo_writeresult_t* int return true; } /* }}} */ +PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_WriteResult) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_WriteResult) + /* {{{ proto integer|null MongoDB\Driver\WriteResult::getInsertedCount() Returns the number of documents that were inserted */ -static PHP_METHOD(WriteResult, getInsertedCount) +static PHP_METHOD(MongoDB_Driver_WriteResult, getInsertedCount) { bson_iter_t iter; php_phongo_writeresult_t* intern; @@ -125,7 +129,7 @@ static PHP_METHOD(WriteResult, getInsertedCount) /* {{{ proto integer|null MongoDB\Driver\WriteResult::getMatchedCount() Returns the number of documents that matched the update criteria */ -static PHP_METHOD(WriteResult, getMatchedCount) +static PHP_METHOD(MongoDB_Driver_WriteResult, getMatchedCount) { bson_iter_t iter; php_phongo_writeresult_t* intern; @@ -139,7 +143,7 @@ static PHP_METHOD(WriteResult, getMatchedCount) /* {{{ proto integer|null MongoDB\Driver\WriteResult::getModifiedCount() Returns the number of documents that were actually modified by an update */ -static PHP_METHOD(WriteResult, getModifiedCount) +static PHP_METHOD(MongoDB_Driver_WriteResult, getModifiedCount) { bson_iter_t iter; php_phongo_writeresult_t* intern; @@ -153,7 +157,7 @@ static PHP_METHOD(WriteResult, getModifiedCount) /* {{{ proto integer|null MongoDB\Driver\WriteResult::getDeletedCount() Returns the number of documents that were deleted */ -static PHP_METHOD(WriteResult, getDeletedCount) +static PHP_METHOD(MongoDB_Driver_WriteResult, getDeletedCount) { bson_iter_t iter; php_phongo_writeresult_t* intern; @@ -167,7 +171,7 @@ static PHP_METHOD(WriteResult, getDeletedCount) /* {{{ proto integer|null MongoDB\Driver\WriteResult::getUpsertedCount() Returns the number of documents that were upserted */ -static PHP_METHOD(WriteResult, getUpsertedCount) +static PHP_METHOD(MongoDB_Driver_WriteResult, getUpsertedCount) { bson_iter_t iter; php_phongo_writeresult_t* intern; @@ -181,7 +185,7 @@ static PHP_METHOD(WriteResult, getUpsertedCount) /* {{{ proto MongoDB\Driver\Server MongoDB\Driver\WriteResult::getServer() Returns the Server from which the result originated */ -static PHP_METHOD(WriteResult, getServer) +static PHP_METHOD(MongoDB_Driver_WriteResult, getServer) { php_phongo_writeresult_t* intern; @@ -194,7 +198,7 @@ static PHP_METHOD(WriteResult, getServer) /* {{{ proto array MongoDB\Driver\WriteResult::getUpsertedIds() Returns the identifiers generated by the server for upsert operations. */ -static PHP_METHOD(WriteResult, getUpsertedIds) +static PHP_METHOD(MongoDB_Driver_WriteResult, getUpsertedIds) { bson_iter_t iter, child; php_phongo_writeresult_t* intern; @@ -235,7 +239,7 @@ static PHP_METHOD(WriteResult, getUpsertedIds) /* {{{ proto WriteConcernError MongoDB\Driver\WriteResult::getWriteConcernError() Return any write concern error that occurred */ -static PHP_METHOD(WriteResult, getWriteConcernError) +static PHP_METHOD(MongoDB_Driver_WriteResult, getWriteConcernError) { php_phongo_writeresult_t* intern; @@ -248,7 +252,7 @@ static PHP_METHOD(WriteResult, getWriteConcernError) /* {{{ proto WriteError[] MongoDB\Driver\WriteResult::getWriteErrors() Returns any write errors that occurred */ -static PHP_METHOD(WriteResult, getWriteErrors) +static PHP_METHOD(MongoDB_Driver_WriteResult, getWriteErrors) { php_phongo_writeresult_t* intern; @@ -262,7 +266,7 @@ static PHP_METHOD(WriteResult, getWriteErrors) /* {{{ proto boolean MongoDB\Driver\WriteResult::isAcknowledged() Returns whether the write operation was acknowledged (based on the write concern). */ -static PHP_METHOD(WriteResult, isAcknowledged) +static PHP_METHOD(MongoDB_Driver_WriteResult, isAcknowledged) { php_phongo_writeresult_t* intern; @@ -273,29 +277,6 @@ static PHP_METHOD(WriteResult, isAcknowledged) RETURN_BOOL(mongoc_write_concern_is_acknowledged(intern->write_concern)); } /* }}} */ -/* {{{ MongoDB\Driver\WriteResult function entries */ -ZEND_BEGIN_ARG_INFO_EX(ai_WriteResult_void, 0, 0, 0) -ZEND_END_ARG_INFO() - -static zend_function_entry php_phongo_writeresult_me[] = { - /* clang-format off */ - PHP_ME(WriteResult, getInsertedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteResult, getMatchedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteResult, getModifiedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteResult, getDeletedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteResult, getUpsertedCount, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteResult, getServer, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteResult, getUpsertedIds, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteResult, getWriteConcernError, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteResult, getWriteErrors, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_ME(WriteResult, isAcknowledged, ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__construct, PHP_FN(MongoDB_disabled___construct), ai_WriteResult_void, ZEND_ACC_PRIVATE | ZEND_ACC_FINAL) - ZEND_NAMED_ME(__wakeup, PHP_FN(MongoDB_disabled___wakeup), ai_WriteResult_void, ZEND_ACC_PUBLIC | ZEND_ACC_FINAL) - PHP_FE_END - /* clang-format on */ -}; -/* }}} */ - /* {{{ MongoDB\Driver\WriteResult object handlers */ static zend_object_handlers php_phongo_handler_writeresult; @@ -403,12 +384,8 @@ static HashTable* php_phongo_writeresult_get_debug_info(phongo_compat_object_han void php_phongo_writeresult_init_ce(INIT_FUNC_ARGS) /* {{{ */ { - zend_class_entry ce; - - INIT_NS_CLASS_ENTRY(ce, "MongoDB\\Driver", "WriteResult", php_phongo_writeresult_me); - php_phongo_writeresult_ce = zend_register_internal_class(&ce); + php_phongo_writeresult_ce = register_class_MongoDB_Driver_WriteResult(); php_phongo_writeresult_ce->create_object = php_phongo_writeresult_create_object; - PHONGO_CE_FINAL(php_phongo_writeresult_ce); PHONGO_CE_DISABLE_SERIALIZATION(php_phongo_writeresult_ce); memcpy(&php_phongo_handler_writeresult, phongo_get_std_object_handlers(), sizeof(zend_object_handlers)); diff --git a/src/MongoDB/WriteResult.stub.php b/src/MongoDB/WriteResult.stub.php new file mode 100644 index 000000000..7c1fb8c66 --- /dev/null +++ b/src/MongoDB/WriteResult.stub.php @@ -0,0 +1,36 @@ +ce_flags |= ZEND_ACC_FINAL; + + return class_entry; +} From b6e090dc75a635b9d379a6e476dce69f8b8f45a2 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Thu, 28 Jul 2022 12:17:12 +0200 Subject: [PATCH 13/26] Fix deprecation messages in tests --- tests/apm/bug0950-002.phpt | 6 +++--- tests/apm/commandFailedEvent-001.phpt | 6 +++--- tests/apm/commandFailedEvent-002.phpt | 6 +++--- tests/apm/commandFailedEvent-debug-001.phpt | 6 +++--- tests/apm/commandFailedEvent-getReply-001.phpt | 6 +++--- ...dFailedEvent-getServerConnectionId-001.phpt | 6 +++--- ...dFailedEvent-getServerConnectionId-002.phpt | 6 +++--- .../commandFailedEvent-getServiceId-001.phpt | 6 +++--- .../commandFailedEvent-getServiceId-002.phpt | 6 +++--- tests/apm/commandStartedEvent-001.phpt | 6 +++--- tests/apm/commandStartedEvent-002.phpt | 6 +++--- tests/apm/commandStartedEvent-debug-001.phpt | 6 +++--- ...StartedEvent-getServerConnectionId-001.phpt | 6 +++--- ...StartedEvent-getServerConnectionId-002.phpt | 6 +++--- .../commandStartedEvent-getServiceId-001.phpt | 6 +++--- .../commandStartedEvent-getServiceId-002.phpt | 6 +++--- tests/apm/commandSucceededEvent-001.phpt | 6 +++--- tests/apm/commandSucceededEvent-002.phpt | 6 +++--- tests/apm/commandSucceededEvent-debug-001.phpt | 6 +++--- ...cceededEvent-getServerConnectionId-001.phpt | 6 +++--- ...cceededEvent-getServerConnectionId-002.phpt | 6 +++--- ...commandSucceededEvent-getServiceId-001.phpt | 6 +++--- ...commandSucceededEvent-getServiceId-002.phpt | 6 +++--- tests/apm/monitoring-addSubscriber-001.phpt | 6 +++--- tests/apm/monitoring-addSubscriber-002.phpt | 6 +++--- tests/apm/monitoring-addSubscriber-003.phpt | 6 +++--- tests/apm/monitoring-addSubscriber-004.phpt | 6 +++--- tests/apm/monitoring-removeSubscriber-001.phpt | 6 +++--- tests/apm/monitoring-removeSubscriber-002.phpt | 6 +++--- tests/apm/serverChangedEvent-001.phpt | 18 +++++++++--------- tests/apm/serverClosedEvent-001.phpt | 18 +++++++++--------- tests/apm/serverHeartbeatFailedEvent-001.phpt | 18 +++++++++--------- tests/apm/serverHeartbeatStartedEvent-001.phpt | 18 +++++++++--------- .../apm/serverHeartbeatSucceededEvent-001.phpt | 18 +++++++++--------- tests/apm/serverOpeningEvent-001.phpt | 18 +++++++++--------- tests/apm/topologyChangedEvent-001.phpt | 18 +++++++++--------- tests/apm/topologyClosedEvent-001.phpt | 18 +++++++++--------- tests/apm/topologyOpeningEvent-001.phpt | 18 +++++++++--------- tests/apm/topologyOpeningEvent-002.phpt | 18 +++++++++--------- tests/bson/bson-decode-002.phpt | 2 +- tests/bson/bson-encode-002.phpt | 6 ++++-- tests/bson/bson-encode-003.phpt | 10 ++++++---- tests/bson/bson-fromPHP-001.phpt | 1 + tests/bson/bson-fromPHP_error-001.phpt | 1 + tests/bson/bson-fromPHP_error-005.phpt | 2 ++ tests/bson/bson-fromPHP_error-007.phpt | 1 + tests/bson/bson-toPHP-001.phpt | 2 +- tests/bson/bson-toPHP-002.phpt | 3 ++- tests/bson/bson-toPHP-003.phpt | 7 ++++--- tests/bson/bson-toPHP-004.phpt | 2 +- tests/bson/bson-toPHP-007.phpt | 2 +- tests/bson/bson-toPHP-008.phpt | 2 +- tests/bson/bson-toPHP-009.phpt | 2 +- tests/bson/bson-toPHP-010.phpt | 4 ++-- tests/bson/bson-toPHP-011.phpt | 2 +- tests/bson/bug0274.phpt | 2 ++ tests/bson/bug0334-001.phpt | 5 +++-- tests/bson/bug0334-002.phpt | 5 +++-- tests/bson/bug1006-001.phpt | 5 +++-- tests/bson/bug1006-002.phpt | 3 ++- tests/bson/typemap-001.phpt | 2 +- tests/bson/typemap-003.phpt | 2 +- tests/bson/typemap-004.phpt | 2 +- tests/bson/typemap-005.phpt | 2 +- tests/bson/typemap-006.phpt | 4 ++-- tests/bson/typemap-007.phpt | 2 +- tests/bulk/bulkwrite-ctor-comment-001.phpt | 6 +++--- .../bulk/bulkwrite-ctor-comment_error-001.phpt | 1 + tests/bulk/bulkwrite-ctor-let-001.phpt | 6 +++--- tests/bulk/bulkwrite-delete-001.phpt | 3 ++- tests/bulk/bulkwrite-delete-002.phpt | 6 +++--- tests/bulk/bulkwrite-insert-001.phpt | 3 ++- tests/bulk/bulkwrite-insert-004.phpt | 3 ++- tests/bulk/bulkwrite-update-001.phpt | 3 ++- tests/bulk/bulkwrite-update-004.phpt | 6 +++--- .../causal-consistency-003.phpt | 6 +++--- .../causal-consistency-004.phpt | 6 +++--- .../causal-consistency-005.phpt | 6 +++--- .../causal-consistency-006.phpt | 6 +++--- tests/command/command-ctor-001.phpt | 3 ++- tests/command/cursor-batchsize-001.phpt | 6 +++--- tests/command/cursor-batchsize-002.phpt | 6 +++--- tests/command/cursor-comment-001.phpt | 6 +++--- tests/cursor/bug0924-001.phpt | 3 ++- tests/cursor/bug0924-002.phpt | 3 ++- tests/cursor/bug1050-001.phpt | 6 +++--- tests/cursor/bug1050-002.phpt | 6 +++--- tests/cursor/bug1152-001.phpt | 6 +++--- tests/cursor/bug1152-002.phpt | 6 +++--- tests/cursor/bug1274-001.phpt | 6 +++--- tests/cursor/bug1274-002.phpt | 6 +++--- tests/cursor/bug1274-003.phpt | 6 +++--- tests/cursor/bug1274-004.phpt | 6 +++--- tests/cursor/bug1274-005.phpt | 6 +++--- tests/cursor/bug1274-006.phpt | 6 +++--- tests/cursor/bug1529-001.phpt | 6 +++--- tests/cursor/cursor-setTypeMap_error-004.phpt | 2 +- tests/cursor/cursor-toArray-002.phpt | 2 +- tests/manager/bug1163-001.phpt | 6 +++--- tests/manager/manager-addSubscriber-001.phpt | 6 +++--- tests/manager/manager-addSubscriber-002.phpt | 6 +++--- tests/manager/manager-addSubscriber-003.phpt | 6 +++--- tests/manager/manager-addSubscriber-004.phpt | 6 +++--- tests/manager/manager-addSubscriber-005.phpt | 6 +++--- tests/manager/manager-addSubscriber-006.phpt | 6 +++--- ...ager-ctor-disableClientPersistence-008.phpt | 6 +++--- ...ager-ctor-disableClientPersistence-009.phpt | 6 +++--- ...ager-ctor-disableClientPersistence-010.phpt | 6 +++--- ...ager-ctor-disableClientPersistence-011.phpt | 6 +++--- tests/manager/manager-ctor-serverApi-001.phpt | 6 +++--- tests/manager/manager-executeQuery-005.phpt | 2 +- .../manager/manager-removeSubscriber-001.phpt | 6 +++--- .../manager/manager-removeSubscriber-002.phpt | 6 +++--- tests/query/query-ctor-001.phpt | 3 ++- tests/query/query-ctor-comment-001.phpt | 6 +++--- tests/query/query-ctor-comment_error-001.phpt | 1 + tests/query/query-ctor-let-001.phpt | 6 +++--- tests/retryable-reads/retryable-reads-001.phpt | 6 +++--- tests/retryable-reads/retryable-reads-002.phpt | 6 +++--- .../retryable-reads_error-001.phpt | 6 +++--- .../retryable-reads_error-002.phpt | 6 +++--- .../retryable-writes/retryable-writes-001.phpt | 6 +++--- .../retryable-writes/retryable-writes-002.phpt | 6 +++--- .../retryable-writes/retryable-writes-003.phpt | 6 +++--- .../retryable-writes/retryable-writes-004.phpt | 6 +++--- .../retryable-writes/retryable-writes-005.phpt | 6 +++--- tests/session/bug1274-002.phpt | 6 +++--- tests/session/bug1274-003.phpt | 6 +++--- tests/session/bug1274-005.phpt | 6 +++--- tests/session/bug1274-006.phpt | 6 +++--- tests/session/session-002.phpt | 6 +++--- .../session/session-commitTransaction-001.phpt | 6 +++--- tests/standalone/bug0545.phpt | 6 ++++-- .../topologyDescription-debug-001.phpt | 18 +++++++++--------- .../topologyDescription-getServers-001.phpt | 18 +++++++++--------- .../topologyDescription-getType-001.phpt | 18 +++++++++--------- ...ologyDescription-hasReadableServer-001.phpt | 18 +++++++++--------- ...ologyDescription-hasReadableServer-002.phpt | 18 +++++++++--------- ...escription-hasReadableServer_error-001.phpt | 18 +++++++++--------- ...ologyDescription-hasWritableServer-001.phpt | 18 +++++++++--------- tests/utils/classes.inc | 18 ++++++++++-------- tests/utils/observer.php | 6 +++--- tests/writeError/writeerror-getInfo-002.phpt | 6 +++--- 143 files changed, 490 insertions(+), 459 deletions(-) diff --git a/tests/apm/bug0950-002.phpt b/tests/apm/bug0950-002.phpt index 51381ab3a..1dd0a2cb0 100644 --- a/tests/apm/bug0950-002.phpt +++ b/tests/apm/bug0950-002.phpt @@ -14,17 +14,17 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("- started: %s\n", $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { printf("- succeeded: %s\n", $event->getCommandName()); } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { printf("- failed: %s\n", $event->getCommandName()); } diff --git a/tests/apm/commandFailedEvent-001.phpt b/tests/apm/commandFailedEvent-001.phpt index 8a3bb46ce..6d183578b 100644 --- a/tests/apm/commandFailedEvent-001.phpt +++ b/tests/apm/commandFailedEvent-001.phpt @@ -13,16 +13,16 @@ $m = create_test_manager(); class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { echo "started: ", $event->getCommandName(), "\n"; } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { echo "failed: ", $event->getCommandName(), "\n"; echo "- getError() returns an object: ", is_object( $event->getError() ) ? 'yes' : 'no', "\n"; diff --git a/tests/apm/commandFailedEvent-002.phpt b/tests/apm/commandFailedEvent-002.phpt index 5fd9e5609..e0a23ab86 100644 --- a/tests/apm/commandFailedEvent-002.phpt +++ b/tests/apm/commandFailedEvent-002.phpt @@ -12,18 +12,18 @@ $m = create_test_manager(); class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { echo "started: ", $event->getCommandName(), "\n"; $this->startRequestId = $event->getRequestId(); $this->startOperationId = $event->getOperationId(); } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { echo "failed: ", $event->getCommandName(), "\n"; echo "- requestId matches: ", $this->startRequestId == $event->getRequestId() ? 'yes' : 'no', " \n"; diff --git a/tests/apm/commandFailedEvent-debug-001.phpt b/tests/apm/commandFailedEvent-debug-001.phpt index f8df2973d..ba8383b3b 100644 --- a/tests/apm/commandFailedEvent-debug-001.phpt +++ b/tests/apm/commandFailedEvent-debug-001.phpt @@ -9,15 +9,15 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { var_dump($event); } diff --git a/tests/apm/commandFailedEvent-getReply-001.phpt b/tests/apm/commandFailedEvent-getReply-001.phpt index 6b1901f9b..6ede4a78f 100644 --- a/tests/apm/commandFailedEvent-getReply-001.phpt +++ b/tests/apm/commandFailedEvent-getReply-001.phpt @@ -11,17 +11,17 @@ $manager = create_test_manager(); class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { echo "started: ", $event->getCommandName(), "\n"; } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { var_dump($event); } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { echo "failed: ", $event->getCommandName(), "\n"; var_dump($event->getReply()); diff --git a/tests/apm/commandFailedEvent-getServerConnectionId-001.phpt b/tests/apm/commandFailedEvent-getServerConnectionId-001.phpt index e4f523829..5084508d7 100644 --- a/tests/apm/commandFailedEvent-getServerConnectionId-001.phpt +++ b/tests/apm/commandFailedEvent-getServerConnectionId-001.phpt @@ -12,7 +12,7 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { private $commandStartedServerConnectionId; - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); @@ -20,11 +20,11 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber var_dump($this->commandStartedServerConnectionId); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { printf("commandFailed: %s\n", $event->getCommandName()); printf("same serverConnectionId as last commandStarted: %s\n", $event->getServerConnectionId() == $this->commandStartedServerConnectionId ? 'yes' : 'no'); diff --git a/tests/apm/commandFailedEvent-getServerConnectionId-002.phpt b/tests/apm/commandFailedEvent-getServerConnectionId-002.phpt index afd826194..a966dfd19 100644 --- a/tests/apm/commandFailedEvent-getServerConnectionId-002.phpt +++ b/tests/apm/commandFailedEvent-getServerConnectionId-002.phpt @@ -10,17 +10,17 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); var_dump($event->getServerConnectionId()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { printf("commandFailed: %s\n", $event->getCommandName()); var_dump($event->getServerConnectionId()); diff --git a/tests/apm/commandFailedEvent-getServiceId-001.phpt b/tests/apm/commandFailedEvent-getServiceId-001.phpt index cffcd00d1..48d014b6c 100644 --- a/tests/apm/commandFailedEvent-getServiceId-001.phpt +++ b/tests/apm/commandFailedEvent-getServiceId-001.phpt @@ -11,7 +11,7 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { private $commandStartedServiceId; - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); @@ -19,11 +19,11 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber var_dump($this->commandStartedServiceId); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { printf("commandFailed: %s\n", $event->getCommandName()); printf("same serviceId as last commandStarted: %s\n", $event->getServiceId() == $this->commandStartedServiceId ? 'yes' : 'no'); diff --git a/tests/apm/commandFailedEvent-getServiceId-002.phpt b/tests/apm/commandFailedEvent-getServiceId-002.phpt index 323a4afec..0e47948d7 100644 --- a/tests/apm/commandFailedEvent-getServiceId-002.phpt +++ b/tests/apm/commandFailedEvent-getServiceId-002.phpt @@ -9,17 +9,17 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); var_dump($event->getServiceId()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { printf("commandFailed: %s\n", $event->getCommandName()); var_dump($event->getServiceId()); diff --git a/tests/apm/commandStartedEvent-001.phpt b/tests/apm/commandStartedEvent-001.phpt index c08c3e1e7..24ed6f63f 100644 --- a/tests/apm/commandStartedEvent-001.phpt +++ b/tests/apm/commandStartedEvent-001.phpt @@ -12,7 +12,7 @@ $m = create_test_manager(); class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { echo "started: ", $event->getCommandName(), "\n"; echo "- getCommand() returns an object: ", is_object( $event->getCommand() ) ? 'yes' : 'no', "\n"; @@ -27,11 +27,11 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber echo "- getRequestId() returns a string: ", is_string( $event->getRequestId() ) ? 'yes' : 'no', "\n"; } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { } } diff --git a/tests/apm/commandStartedEvent-002.phpt b/tests/apm/commandStartedEvent-002.phpt index acce0c779..fbbdcda8e 100644 --- a/tests/apm/commandStartedEvent-002.phpt +++ b/tests/apm/commandStartedEvent-002.phpt @@ -10,14 +10,14 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("Observed commandStarted for %s\n", $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) {} + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void {} - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) {} + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void {} } $manager = create_test_manager(URI, [], ['disableClientPersistence' => true]); diff --git a/tests/apm/commandStartedEvent-debug-001.phpt b/tests/apm/commandStartedEvent-debug-001.phpt index 3d6e0c45a..b9b090554 100644 --- a/tests/apm/commandStartedEvent-debug-001.phpt +++ b/tests/apm/commandStartedEvent-debug-001.phpt @@ -9,16 +9,16 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { var_dump($event); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/apm/commandStartedEvent-getServerConnectionId-001.phpt b/tests/apm/commandStartedEvent-getServerConnectionId-001.phpt index 2f185b14c..7ba6b6628 100644 --- a/tests/apm/commandStartedEvent-getServerConnectionId-001.phpt +++ b/tests/apm/commandStartedEvent-getServerConnectionId-001.phpt @@ -12,7 +12,7 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { private $commandStartedServerConnectionId; - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); @@ -24,11 +24,11 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber var_dump($this->commandStartedServerConnectionId); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/apm/commandStartedEvent-getServerConnectionId-002.phpt b/tests/apm/commandStartedEvent-getServerConnectionId-002.phpt index f9c1977d0..9f7936a14 100644 --- a/tests/apm/commandStartedEvent-getServerConnectionId-002.phpt +++ b/tests/apm/commandStartedEvent-getServerConnectionId-002.phpt @@ -10,17 +10,17 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); var_dump($event->getServerConnectionId()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/apm/commandStartedEvent-getServiceId-001.phpt b/tests/apm/commandStartedEvent-getServiceId-001.phpt index 38cdf9db8..9852988f6 100644 --- a/tests/apm/commandStartedEvent-getServiceId-001.phpt +++ b/tests/apm/commandStartedEvent-getServiceId-001.phpt @@ -11,7 +11,7 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { private $commandStartedServiceId; - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); @@ -23,11 +23,11 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber var_dump($this->commandStartedServiceId); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/apm/commandStartedEvent-getServiceId-002.phpt b/tests/apm/commandStartedEvent-getServiceId-002.phpt index 1bf4af789..d5f0c5f94 100644 --- a/tests/apm/commandStartedEvent-getServiceId-002.phpt +++ b/tests/apm/commandStartedEvent-getServiceId-002.phpt @@ -9,17 +9,17 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); var_dump($event->getServiceId()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/apm/commandSucceededEvent-001.phpt b/tests/apm/commandSucceededEvent-001.phpt index 9707e3766..b437e10b0 100644 --- a/tests/apm/commandSucceededEvent-001.phpt +++ b/tests/apm/commandSucceededEvent-001.phpt @@ -13,12 +13,12 @@ $m = create_test_manager(); class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { echo "started: ", $event->getCommandName(), "\n"; } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { echo "succeeded: ", $event->getCommandName(), "\n"; echo "- getReply() returns an object: ", is_object( $event->getReply() ) ? 'yes' : 'no', "\n"; @@ -33,7 +33,7 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber echo "- getRequestId() returns a string: ", is_string( $event->getRequestId() ) ? 'yes' : 'no', "\n"; } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { } } diff --git a/tests/apm/commandSucceededEvent-002.phpt b/tests/apm/commandSucceededEvent-002.phpt index ed445b161..1939d51c8 100644 --- a/tests/apm/commandSucceededEvent-002.phpt +++ b/tests/apm/commandSucceededEvent-002.phpt @@ -12,21 +12,21 @@ $m = create_test_manager(); class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { echo "started: ", $event->getCommandName(), "\n"; $this->startRequestId = $event->getRequestId(); $this->startOperationId = $event->getOperationId(); } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { echo "succeeded: ", $event->getCommandName(), "\n"; echo "- requestId matches: ", $this->startRequestId == $event->getRequestId() ? 'yes' : 'no', " \n"; echo "- operationId matches: ", $this->startOperationId == $event->getOperationId() ? 'yes' : 'no', " \n"; } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { } } diff --git a/tests/apm/commandSucceededEvent-debug-001.phpt b/tests/apm/commandSucceededEvent-debug-001.phpt index f0f7201cb..361d2be23 100644 --- a/tests/apm/commandSucceededEvent-debug-001.phpt +++ b/tests/apm/commandSucceededEvent-debug-001.phpt @@ -9,16 +9,16 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { var_dump($event); } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/apm/commandSucceededEvent-getServerConnectionId-001.phpt b/tests/apm/commandSucceededEvent-getServerConnectionId-001.phpt index a215c339f..e7cc1a0e8 100644 --- a/tests/apm/commandSucceededEvent-getServerConnectionId-001.phpt +++ b/tests/apm/commandSucceededEvent-getServerConnectionId-001.phpt @@ -12,7 +12,7 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { private $commandStartedServerConnectionId; - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); @@ -20,14 +20,14 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber var_dump($this->commandStartedServerConnectionId); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { printf("commandSucceeded: %s\n", $event->getCommandName()); printf("same serverConnectionId as last commandStarted: %s\n", $event->getServerConnectionId() == $this->commandStartedServerConnectionId ? 'yes' : 'no'); var_dump($event->getServerConnectionId()); } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { } } diff --git a/tests/apm/commandSucceededEvent-getServerConnectionId-002.phpt b/tests/apm/commandSucceededEvent-getServerConnectionId-002.phpt index 1a4affb83..617077571 100644 --- a/tests/apm/commandSucceededEvent-getServerConnectionId-002.phpt +++ b/tests/apm/commandSucceededEvent-getServerConnectionId-002.phpt @@ -10,19 +10,19 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); var_dump($event->getServerConnectionId()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { printf("commandSucceeded: %s\n", $event->getCommandName()); var_dump($event->getServerConnectionId()); } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { } } diff --git a/tests/apm/commandSucceededEvent-getServiceId-001.phpt b/tests/apm/commandSucceededEvent-getServiceId-001.phpt index 72abbd04d..8ecb1a915 100644 --- a/tests/apm/commandSucceededEvent-getServiceId-001.phpt +++ b/tests/apm/commandSucceededEvent-getServiceId-001.phpt @@ -11,7 +11,7 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { private $commandStartedServiceId; - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { printf("commandStarted: %s\n", $event->getCommandName()); @@ -19,14 +19,14 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber var_dump($this->commandStartedServiceId); } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { printf("commandSucceeded: %s\n", $event->getCommandName()); printf("same serviceId as last commandStarted: %s\n", $event->getServiceId() == $this->commandStartedServiceId ? 'yes' : 'no'); var_dump($event->getServiceId()); } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { } } diff --git a/tests/apm/commandSucceededEvent-getServiceId-002.phpt b/tests/apm/commandSucceededEvent-getServiceId-002.phpt index 2c40b237f..692bb6842 100644 --- a/tests/apm/commandSucceededEvent-getServiceId-002.phpt +++ b/tests/apm/commandSucceededEvent-getServiceId-002.phpt @@ -9,19 +9,19 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { printf("commandStarted: %s\n", $event->getCommandName()); var_dump($event->getServiceId()); } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { printf("commandSucceeded: %s\n", $event->getCommandName()); var_dump($event->getServiceId()); } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { } } diff --git a/tests/apm/monitoring-addSubscriber-001.phpt b/tests/apm/monitoring-addSubscriber-001.phpt index f4f9cc26d..4d8b37ba1 100644 --- a/tests/apm/monitoring-addSubscriber-001.phpt +++ b/tests/apm/monitoring-addSubscriber-001.phpt @@ -12,16 +12,16 @@ $m = create_test_manager(); class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { echo "- started: ", $event->getCommandName(), "\n"; } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { } } diff --git a/tests/apm/monitoring-addSubscriber-002.phpt b/tests/apm/monitoring-addSubscriber-002.phpt index 300f5a6c4..dcc85035c 100644 --- a/tests/apm/monitoring-addSubscriber-002.phpt +++ b/tests/apm/monitoring-addSubscriber-002.phpt @@ -19,16 +19,16 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber $this->instanceName = $instanceName; } - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { echo "- ({$this->instanceName}) - started: ", $event->getCommandName(), "\n"; } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { } } diff --git a/tests/apm/monitoring-addSubscriber-003.phpt b/tests/apm/monitoring-addSubscriber-003.phpt index 7989b3df2..7c8faf8df 100644 --- a/tests/apm/monitoring-addSubscriber-003.phpt +++ b/tests/apm/monitoring-addSubscriber-003.phpt @@ -12,16 +12,16 @@ $m = create_test_manager(); class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { echo "- started: ", $event->getCommandName(), "\n"; } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { } } diff --git a/tests/apm/monitoring-addSubscriber-004.phpt b/tests/apm/monitoring-addSubscriber-004.phpt index 4712d7546..59d08dff5 100644 --- a/tests/apm/monitoring-addSubscriber-004.phpt +++ b/tests/apm/monitoring-addSubscriber-004.phpt @@ -19,16 +19,16 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber $this->instanceName = $instanceName; } - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { echo "- ({$this->instanceName}) - started: ", $event->getCommandName(), "\n"; } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { } } diff --git a/tests/apm/monitoring-removeSubscriber-001.phpt b/tests/apm/monitoring-removeSubscriber-001.phpt index 34b163447..f1a704174 100644 --- a/tests/apm/monitoring-removeSubscriber-001.phpt +++ b/tests/apm/monitoring-removeSubscriber-001.phpt @@ -12,16 +12,16 @@ $m = create_test_manager(); class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { echo "- started: ", $event->getCommandName(), "\n"; } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { } } diff --git a/tests/apm/monitoring-removeSubscriber-002.phpt b/tests/apm/monitoring-removeSubscriber-002.phpt index 239400516..f046606bd 100644 --- a/tests/apm/monitoring-removeSubscriber-002.phpt +++ b/tests/apm/monitoring-removeSubscriber-002.phpt @@ -19,16 +19,16 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber $this->instanceName = $instanceName; } - public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ) + public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event ): void { echo "- ({$this->instanceName}) - started: ", $event->getCommandName(), "\n"; } - public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ) + public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event ): void { } - public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ) + public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event ): void { } } diff --git a/tests/apm/serverChangedEvent-001.phpt b/tests/apm/serverChangedEvent-001.phpt index 8f5883a8c..af5d0db49 100644 --- a/tests/apm/serverChangedEvent-001.phpt +++ b/tests/apm/serverChangedEvent-001.phpt @@ -11,7 +11,7 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber { private $isObserved = false; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void { // Ignore multiple events for the purpose of this test if ($this->isObserved) { @@ -29,21 +29,21 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber var_dump($event); } - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) {} + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void {} - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} } $m = create_test_manager(); diff --git a/tests/apm/serverClosedEvent-001.phpt b/tests/apm/serverClosedEvent-001.phpt index b2351af19..8e6062717 100644 --- a/tests/apm/serverClosedEvent-001.phpt +++ b/tests/apm/serverClosedEvent-001.phpt @@ -11,9 +11,9 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber { private $isObserved = false; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void { // Ignore multiple events for the purpose of this test if ($this->isObserved) { @@ -29,19 +29,19 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber var_dump($event); } - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) {} + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void {} - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} } /* Note: load balanced topologies will always emit ServerClosedEvent before diff --git a/tests/apm/serverHeartbeatFailedEvent-001.phpt b/tests/apm/serverHeartbeatFailedEvent-001.phpt index 5e88ebacb..81c779a88 100644 --- a/tests/apm/serverHeartbeatFailedEvent-001.phpt +++ b/tests/apm/serverHeartbeatFailedEvent-001.phpt @@ -12,11 +12,11 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber { - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void { printf("getDurationMicros() returns an integer: %s\n", is_integer($event->getDurationMicros()) ? 'yes' : 'no'); printf("getError() returns an Exception: %s\n", ($event->getError() instanceof Exception) ? 'yes' : 'no'); @@ -27,17 +27,17 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber var_dump($event); } - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) {} + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void {} - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} } /* Use a separate client to configure the fail point and trigger a heartbeat diff --git a/tests/apm/serverHeartbeatStartedEvent-001.phpt b/tests/apm/serverHeartbeatStartedEvent-001.phpt index 7cf3e73df..d6adfdbf7 100644 --- a/tests/apm/serverHeartbeatStartedEvent-001.phpt +++ b/tests/apm/serverHeartbeatStartedEvent-001.phpt @@ -11,13 +11,13 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber { private $isObserved = false; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event) + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event): void { // Ignore multiple events for the purpose of this test if ($this->isObserved) { @@ -33,15 +33,15 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber var_dump($event); } - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) {} + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void {} - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} } $m = create_test_manager(); diff --git a/tests/apm/serverHeartbeatSucceededEvent-001.phpt b/tests/apm/serverHeartbeatSucceededEvent-001.phpt index e614e5254..1c06cc200 100644 --- a/tests/apm/serverHeartbeatSucceededEvent-001.phpt +++ b/tests/apm/serverHeartbeatSucceededEvent-001.phpt @@ -11,15 +11,15 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber { private $isObserved = false; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void { // Ignore multiple events for the purpose of this test if ($this->isObserved) { @@ -37,13 +37,13 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber var_dump($event); } - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) {} + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void {} - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} } $m = create_test_manager(); diff --git a/tests/apm/serverOpeningEvent-001.phpt b/tests/apm/serverOpeningEvent-001.phpt index 8ee76e4aa..a9b4fcfb7 100644 --- a/tests/apm/serverOpeningEvent-001.phpt +++ b/tests/apm/serverOpeningEvent-001.phpt @@ -11,17 +11,17 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber { private $isObserved = false; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void { // Ignore multiple events for the purpose of this test if ($this->isObserved) { @@ -37,11 +37,11 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber var_dump($event); } - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) {} + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void {} - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} } $m = create_test_manager(); diff --git a/tests/apm/topologyChangedEvent-001.phpt b/tests/apm/topologyChangedEvent-001.phpt index 003e431cd..4683cd1e3 100644 --- a/tests/apm/topologyChangedEvent-001.phpt +++ b/tests/apm/topologyChangedEvent-001.phpt @@ -11,19 +11,19 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber { private $isObserved = false; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void { // Ignore multiple events for the purpose of this test if ($this->isObserved) { @@ -39,9 +39,9 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber var_dump($event); } - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} } $m = create_test_manager(); diff --git a/tests/apm/topologyClosedEvent-001.phpt b/tests/apm/topologyClosedEvent-001.phpt index cd0ec992f..138e67634 100644 --- a/tests/apm/topologyClosedEvent-001.phpt +++ b/tests/apm/topologyClosedEvent-001.phpt @@ -9,28 +9,28 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber { - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) {} + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void {} - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void { printf("getTopologyId() returns an ObjectId: %s\n", ($event->getTopologyId() instanceof MongoDB\BSON\ObjectId) ? 'yes' : 'no'); var_dump($event); } - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} } /* Note: TopologyChangedEvent can only be observed for non-persistent clients. diff --git a/tests/apm/topologyOpeningEvent-001.phpt b/tests/apm/topologyOpeningEvent-001.phpt index abb6f0091..faf09d023 100644 --- a/tests/apm/topologyOpeningEvent-001.phpt +++ b/tests/apm/topologyOpeningEvent-001.phpt @@ -9,23 +9,23 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber { - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) {} + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void {} - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void { printf("getTopologyId() returns an ObjectId: %s\n", ($event->getTopologyId() instanceof MongoDB\BSON\ObjectId) ? 'yes' : 'no'); diff --git a/tests/apm/topologyOpeningEvent-002.phpt b/tests/apm/topologyOpeningEvent-002.phpt index 94d3ed39e..92ed4836d 100644 --- a/tests/apm/topologyOpeningEvent-002.phpt +++ b/tests/apm/topologyOpeningEvent-002.phpt @@ -12,38 +12,38 @@ class MySubscriber implements MongoDB\Driver\Monitoring\SDAMSubscriber private $topologyId; public $numAssertions = 0; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void { $this->assertSameTopologyId($event); } - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void { $this->assertSameTopologyId($event); } - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\serverHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void { $this->assertSameTopologyId($event); } - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void { $this->assertSameTopologyId($event); } - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void { $this->assertSameTopologyId($event); } - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void { $this->topologyId = $event->getTopologyId(); } diff --git a/tests/bson/bson-decode-002.phpt b/tests/bson/bson-decode-002.phpt index c1c06001c..45d3933c5 100644 --- a/tests/bson/bson-decode-002.phpt +++ b/tests/bson/bson-decode-002.phpt @@ -6,7 +6,7 @@ BSON encoding: Encoding object/arrays data into user specificied classes require_once __DIR__ . '/../utils/basic.inc'; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) { + public function bsonUnserialize(array $data): void { parent::__construct($data); } } diff --git a/tests/bson/bson-encode-002.phpt b/tests/bson/bson-encode-002.phpt index 0171f5c3b..374e2f574 100644 --- a/tests/bson/bson-encode-002.phpt +++ b/tests/bson/bson-encode-002.phpt @@ -7,12 +7,13 @@ require_once __DIR__ . '/../utils/basic.inc'; class AssociativeArray implements MongoDB\BSON\Serializable, MongoDB\BSON\Unserializable { + #[\ReturnTypeWillChange] public function bsonSerialize() { return array("random" => "class", "data"); } - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { echo __METHOD__, "() was called with data:\n"; var_dump($data); @@ -21,12 +22,13 @@ class AssociativeArray implements MongoDB\BSON\Serializable, MongoDB\BSON\Unseri class NumericArray implements MongoDB\BSON\Serializable, MongoDB\BSON\Unserializable { + #[\ReturnTypeWillChange] public function bsonSerialize() { return array(1, 2, 3); } - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { echo __METHOD__, "() was called with data:\n"; var_dump($data); diff --git a/tests/bson/bson-encode-003.phpt b/tests/bson/bson-encode-003.phpt index 3e2a0af03..4f5205905 100644 --- a/tests/bson/bson-encode-003.phpt +++ b/tests/bson/bson-encode-003.phpt @@ -6,23 +6,25 @@ BSON encoding: Encoding objects into BSON representation require_once __DIR__ . '/../utils/basic.inc'; class MyClass implements MongoDB\BSON\Persistable { - function bsonSerialize() { + #[\ReturnTypeWillChange] + public function bsonSerialize() { return array( "random" => "class", "data" ); } - function bsonUnserialize(array $data) { + public function bsonUnserialize(array $data): void { $this->props = $data; } } class MyClass2 implements MongoDB\BSON\Persistable { - function bsonSerialize() { + #[\ReturnTypeWillChange] + public function bsonSerialize() { return array( 1, 2, 3, ); } - function bsonUnserialize(array $data) { + public function bsonUnserialize(array $data): void { $this->props = $data; } } diff --git a/tests/bson/bson-fromPHP-001.phpt b/tests/bson/bson-fromPHP-001.phpt index 778f1ce7b..3a763cff0 100644 --- a/tests/bson/bson-fromPHP-001.phpt +++ b/tests/bson/bson-fromPHP-001.phpt @@ -14,6 +14,7 @@ class MyDocument implements MongoDB\BSON\Serializable $this->data = $data; } + #[\ReturnTypeWillChange] public function bsonSerialize() { return $this->data; diff --git a/tests/bson/bson-fromPHP_error-001.phpt b/tests/bson/bson-fromPHP_error-001.phpt index 03439b04b..d39ee7baa 100644 --- a/tests/bson/bson-fromPHP_error-001.phpt +++ b/tests/bson/bson-fromPHP_error-001.phpt @@ -14,6 +14,7 @@ class MyDocument implements MongoDB\BSON\Serializable $this->data = $data; } + #[\ReturnTypeWillChange] public function bsonSerialize() { return $this->data; diff --git a/tests/bson/bson-fromPHP_error-005.phpt b/tests/bson/bson-fromPHP_error-005.phpt index 351407775..67668270f 100644 --- a/tests/bson/bson-fromPHP_error-005.phpt +++ b/tests/bson/bson-fromPHP_error-005.phpt @@ -9,6 +9,7 @@ class MyRecursiveSerializable implements MongoDB\BSON\Serializable { public $child = 1; + #[\ReturnTypeWillChange] public function bsonSerialize() { return $this; @@ -17,6 +18,7 @@ class MyRecursiveSerializable implements MongoDB\BSON\Serializable class MyIndirectlyRecursiveSerializable extends MyRecursiveSerializable { + #[\ReturnTypeWillChange] public function bsonSerialize() { return ['parent' => $this]; diff --git a/tests/bson/bson-fromPHP_error-007.phpt b/tests/bson/bson-fromPHP_error-007.phpt index ae82a3193..806f0952a 100644 --- a/tests/bson/bson-fromPHP_error-007.phpt +++ b/tests/bson/bson-fromPHP_error-007.phpt @@ -14,6 +14,7 @@ class MySerializable implements MongoDB\BSON\Serializable $this->data = $data; } + #[\ReturnTypeWillChange] public function bsonSerialize() { return $this->data; diff --git a/tests/bson/bson-toPHP-001.phpt b/tests/bson/bson-toPHP-001.phpt index 7c21d43c5..e2d1c0744 100644 --- a/tests/bson/bson-toPHP-001.phpt +++ b/tests/bson/bson-toPHP-001.phpt @@ -11,7 +11,7 @@ abstract class MyAbstractDocument implements MongoDB\BSON\Persistable class MyDocument implements MongoDB\BSON\Unserializable { - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { $this->unserialized = true; } diff --git a/tests/bson/bson-toPHP-002.phpt b/tests/bson/bson-toPHP-002.phpt index 4523b9fc3..7bdcd3c4d 100644 --- a/tests/bson/bson-toPHP-002.phpt +++ b/tests/bson/bson-toPHP-002.phpt @@ -17,12 +17,13 @@ class MyDocument implements MongoDB\BSON\Persistable ); } + #[\ReturnTypeWillChange] public function bsonSerialize() { return $this->data; } - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { foreach (array('list', 'map') as $key) { if (isset($data[$key])) { diff --git a/tests/bson/bson-toPHP-003.phpt b/tests/bson/bson-toPHP-003.phpt index 8ef7bbfcd..4e5e90a66 100644 --- a/tests/bson/bson-toPHP-003.phpt +++ b/tests/bson/bson-toPHP-003.phpt @@ -11,7 +11,7 @@ class MyClass class YourClass implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { foreach ($data as $key => $value) { $this->$key = $value; @@ -22,13 +22,14 @@ class YourClass implements MongoDB\BSON\Unserializable class OurClass implements MongoDB\BSON\Persistable { - function bsonSerialize() + #[\ReturnTypeWillChange] + public function bsonSerialize() { // Not tested with this test, so return empty array return array(); } - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { foreach ($data as $key => $value) { $this->$key = $value; diff --git a/tests/bson/bson-toPHP-004.phpt b/tests/bson/bson-toPHP-004.phpt index 56488b8ad..58387d06f 100644 --- a/tests/bson/bson-toPHP-004.phpt +++ b/tests/bson/bson-toPHP-004.phpt @@ -7,7 +7,7 @@ require_once __DIR__ . '/../utils/basic.inc'; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data); } diff --git a/tests/bson/bson-toPHP-007.phpt b/tests/bson/bson-toPHP-007.phpt index bf8d43209..6124119be 100644 --- a/tests/bson/bson-toPHP-007.phpt +++ b/tests/bson/bson-toPHP-007.phpt @@ -5,7 +5,7 @@ MongoDB\BSON\toPHP(): fieldPath typemaps without server class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data, ArrayObject::ARRAY_AS_PROPS); } diff --git a/tests/bson/bson-toPHP-008.phpt b/tests/bson/bson-toPHP-008.phpt index 1860c31a6..48201b03f 100644 --- a/tests/bson/bson-toPHP-008.phpt +++ b/tests/bson/bson-toPHP-008.phpt @@ -7,7 +7,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data); } diff --git a/tests/bson/bson-toPHP-009.phpt b/tests/bson/bson-toPHP-009.phpt index 0f67328f5..8c08f056c 100644 --- a/tests/bson/bson-toPHP-009.phpt +++ b/tests/bson/bson-toPHP-009.phpt @@ -7,7 +7,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data, ArrayObject::ARRAY_AS_PROPS); } diff --git a/tests/bson/bson-toPHP-010.phpt b/tests/bson/bson-toPHP-010.phpt index 109ba22a7..5772f9418 100644 --- a/tests/bson/bson-toPHP-010.phpt +++ b/tests/bson/bson-toPHP-010.phpt @@ -7,7 +7,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data, ArrayObject::ARRAY_AS_PROPS); } @@ -15,7 +15,7 @@ class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable class MyWildcardArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data, ArrayObject::ARRAY_AS_PROPS); } diff --git a/tests/bson/bson-toPHP-011.phpt b/tests/bson/bson-toPHP-011.phpt index f9fa77930..7ca35a26f 100644 --- a/tests/bson/bson-toPHP-011.phpt +++ b/tests/bson/bson-toPHP-011.phpt @@ -7,7 +7,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data, ArrayObject::ARRAY_AS_PROPS); } diff --git a/tests/bson/bug0274.phpt b/tests/bson/bug0274.phpt index 2f4de6911..f4fb09478 100644 --- a/tests/bson/bug0274.phpt +++ b/tests/bson/bug0274.phpt @@ -7,6 +7,7 @@ require_once __DIR__ . '/../utils/basic.inc'; class AssociativeArray implements MongoDB\BSON\Serializable { + #[\ReturnTypeWillChange] public function bsonSerialize() { return array("random" => "class", "data"); @@ -15,6 +16,7 @@ class AssociativeArray implements MongoDB\BSON\Serializable class NumericArray implements MongoDB\BSON\Serializable { + #[\ReturnTypeWillChange] public function bsonSerialize() { return array(1, 2, 3); diff --git a/tests/bson/bug0334-001.phpt b/tests/bson/bug0334-001.phpt index b7743652b..a409b6389 100644 --- a/tests/bson/bug0334-001.phpt +++ b/tests/bson/bug0334-001.phpt @@ -6,13 +6,14 @@ PHPC-334: Injected __pclass should override a __pclass key in bsonSerialize() re require_once __DIR__ . '/../utils/basic.inc'; class MyClass implements MongoDB\BSON\Persistable { - function bsonSerialize() { + #[\ReturnTypeWillChange] + public function bsonSerialize() { return array( "__pclass" => "baz", "foo" => "bar", ); } - function bsonUnserialize(array $data) { + public function bsonUnserialize(array $data): void { } } diff --git a/tests/bson/bug0334-002.phpt b/tests/bson/bug0334-002.phpt index 579485f4f..e34824c6f 100644 --- a/tests/bson/bug0334-002.phpt +++ b/tests/bson/bug0334-002.phpt @@ -6,13 +6,14 @@ PHPC-334: Encoded BSON should never have multiple __pclass keys require_once __DIR__ . '/../utils/basic.inc'; class MyClass implements MongoDB\BSON\Persistable { - function bsonSerialize() { + #[\ReturnTypeWillChange] + public function bsonSerialize() { return array( "__pclass" => "baz", "foo" => "bar", ); } - function bsonUnserialize(array $data) { + public function bsonUnserialize(array $data): void { } } diff --git a/tests/bson/bug1006-001.phpt b/tests/bson/bug1006-001.phpt index 5ef31be74..4a8b26a98 100644 --- a/tests/bson/bug1006-001.phpt +++ b/tests/bson/bug1006-001.phpt @@ -17,12 +17,13 @@ class MyClass implements MongoDB\BSON\Persistable ]; } - function bsonSerialize() + #[\ReturnTypeWillChange] + public function bsonSerialize() { return $this->data; } - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { } } diff --git a/tests/bson/bug1006-002.phpt b/tests/bson/bug1006-002.phpt index 215aa9ecf..d2641220d 100644 --- a/tests/bson/bug1006-002.phpt +++ b/tests/bson/bug1006-002.phpt @@ -7,7 +7,8 @@ require_once __DIR__ . '/../utils/basic.inc'; class MyClass implements MongoDB\BSON\Serializable { - function bsonSerialize() + #[\ReturnTypeWillChange] + public function bsonSerialize() { return [ '__pclass' => 'baz', diff --git a/tests/bson/typemap-001.phpt b/tests/bson/typemap-001.phpt index 744ff2e33..ef22f460b 100644 --- a/tests/bson/typemap-001.phpt +++ b/tests/bson/typemap-001.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data); } diff --git a/tests/bson/typemap-003.phpt b/tests/bson/typemap-003.phpt index ef40cc04d..1bd2580ab 100644 --- a/tests/bson/typemap-003.phpt +++ b/tests/bson/typemap-003.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data, \ArrayObject::ARRAY_AS_PROPS); } diff --git a/tests/bson/typemap-004.phpt b/tests/bson/typemap-004.phpt index 2e09d38f6..6d1e7bcf3 100644 --- a/tests/bson/typemap-004.phpt +++ b/tests/bson/typemap-004.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data); } diff --git a/tests/bson/typemap-005.phpt b/tests/bson/typemap-005.phpt index 99adf25b7..7f5d9c0ee 100644 --- a/tests/bson/typemap-005.phpt +++ b/tests/bson/typemap-005.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data, ArrayObject::ARRAY_AS_PROPS); } diff --git a/tests/bson/typemap-006.phpt b/tests/bson/typemap-006.phpt index fc1caccf3..51d5607f9 100644 --- a/tests/bson/typemap-006.phpt +++ b/tests/bson/typemap-006.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data, ArrayObject::ARRAY_AS_PROPS); } @@ -19,7 +19,7 @@ class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable class MyWildcardArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data, ArrayObject::ARRAY_AS_PROPS); } diff --git a/tests/bson/typemap-007.phpt b/tests/bson/typemap-007.phpt index fa05567db..24f31f9d4 100644 --- a/tests/bson/typemap-007.phpt +++ b/tests/bson/typemap-007.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data, ArrayObject::ARRAY_AS_PROPS); } diff --git a/tests/bulk/bulkwrite-ctor-comment-001.phpt b/tests/bulk/bulkwrite-ctor-comment-001.phpt index 7b996f80c..623d94c09 100644 --- a/tests/bulk/bulkwrite-ctor-comment-001.phpt +++ b/tests/bulk/bulkwrite-ctor-comment-001.phpt @@ -12,7 +12,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); @@ -25,11 +25,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s included comment: %s\n", $event->getCommandName(), json_encode($command->comment)); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/bulk/bulkwrite-ctor-comment_error-001.phpt b/tests/bulk/bulkwrite-ctor-comment_error-001.phpt index 7ecf4c604..6e1c8a3af 100644 --- a/tests/bulk/bulkwrite-ctor-comment_error-001.phpt +++ b/tests/bulk/bulkwrite-ctor-comment_error-001.phpt @@ -7,6 +7,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class Comment implements MongoDB\BSON\Serializable { + #[\ReturnTypeWillChange] public function bsonSerialize(): array { throw new Exception('php_phongo_zval_to_bson_value fails'); diff --git a/tests/bulk/bulkwrite-ctor-let-001.phpt b/tests/bulk/bulkwrite-ctor-let-001.phpt index e9243f21f..0acbda72b 100644 --- a/tests/bulk/bulkwrite-ctor-let-001.phpt +++ b/tests/bulk/bulkwrite-ctor-let-001.phpt @@ -12,7 +12,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); @@ -25,11 +25,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s included let: %s\n", $event->getCommandName(), json_encode($command->let)); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/bulk/bulkwrite-delete-001.phpt b/tests/bulk/bulkwrite-delete-001.phpt index 5aa0ced3d..b0bae3521 100644 --- a/tests/bulk/bulkwrite-delete-001.phpt +++ b/tests/bulk/bulkwrite-delete-001.phpt @@ -19,6 +19,7 @@ class MyClass implements MongoDB\BSON\Persistable $this->child = $child; } + #[\ReturnTypeWillChange] public function bsonSerialize() { return [ @@ -27,7 +28,7 @@ class MyClass implements MongoDB\BSON\Persistable ]; } - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { $this->id = $data['_id']; $this->child = $data['child']; diff --git a/tests/bulk/bulkwrite-delete-002.phpt b/tests/bulk/bulkwrite-delete-002.phpt index 47cd3ac94..00bdbd349 100644 --- a/tests/bulk/bulkwrite-delete-002.phpt +++ b/tests/bulk/bulkwrite-delete-002.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { if ($event->getCommandName() !== 'delete') { return; @@ -20,11 +20,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("delete included hint: %s\n", json_encode($event->getCommand()->deletes[0]->hint)); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/bulk/bulkwrite-insert-001.phpt b/tests/bulk/bulkwrite-insert-001.phpt index 1d9bcfbdb..4160a95f8 100644 --- a/tests/bulk/bulkwrite-insert-001.phpt +++ b/tests/bulk/bulkwrite-insert-001.phpt @@ -19,6 +19,7 @@ class MyClass implements MongoDB\BSON\Persistable $this->child = $child; } + #[\ReturnTypeWillChange] public function bsonSerialize() { return [ @@ -27,7 +28,7 @@ class MyClass implements MongoDB\BSON\Persistable ]; } - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { $this->id = $data['_id']; $this->child = $data['child']; diff --git a/tests/bulk/bulkwrite-insert-004.phpt b/tests/bulk/bulkwrite-insert-004.phpt index ded802ee0..aaa74b99c 100644 --- a/tests/bulk/bulkwrite-insert-004.phpt +++ b/tests/bulk/bulkwrite-insert-004.phpt @@ -17,6 +17,7 @@ class MySerializableId implements MongoDB\BSON\Serializable $this->id = $id; } + #[\ReturnTypeWillChange] public function bsonSerialize() { return ['id' => $this->id]; @@ -25,7 +26,7 @@ class MySerializableId implements MongoDB\BSON\Serializable class MyPersistableId extends MySerializableId implements MongoDB\BSON\Persistable { - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { $this->id = $data['id']; } diff --git a/tests/bulk/bulkwrite-update-001.phpt b/tests/bulk/bulkwrite-update-001.phpt index 6c15d99c9..a02a78a90 100644 --- a/tests/bulk/bulkwrite-update-001.phpt +++ b/tests/bulk/bulkwrite-update-001.phpt @@ -19,6 +19,7 @@ class MyClass implements MongoDB\BSON\Persistable $this->child = $child; } + #[\ReturnTypeWillChange] public function bsonSerialize() { return [ @@ -27,7 +28,7 @@ class MyClass implements MongoDB\BSON\Persistable ]; } - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { $this->id = $data['_id']; $this->child = $data['child']; diff --git a/tests/bulk/bulkwrite-update-004.phpt b/tests/bulk/bulkwrite-update-004.phpt index d242b9f8b..30cfc2d02 100644 --- a/tests/bulk/bulkwrite-update-004.phpt +++ b/tests/bulk/bulkwrite-update-004.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { if ($event->getCommandName() !== 'update') { return; @@ -20,11 +20,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("update included hint: %s\n", json_encode($event->getCommand()->updates[0]->hint)); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/causal-consistency/causal-consistency-003.phpt b/tests/causal-consistency/causal-consistency-003.phpt index 89240e09b..546ca9cfc 100644 --- a/tests/causal-consistency/causal-consistency-003.phpt +++ b/tests/causal-consistency/causal-consistency-003.phpt @@ -68,11 +68,11 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber MongoDB\Driver\Monitoring\removeSubscriber($this); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { $reply = $event->getReply(); $hasOperationTime = isset($reply->{'operationTime'}); @@ -84,7 +84,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/causal-consistency/causal-consistency-004.phpt b/tests/causal-consistency/causal-consistency-004.phpt index 6c36698eb..4ea41c6b4 100644 --- a/tests/causal-consistency/causal-consistency-004.phpt +++ b/tests/causal-consistency/causal-consistency-004.phpt @@ -90,11 +90,11 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber MongoDB\Driver\Monitoring\removeSubscriber($this); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { $reply = $event->getReply(); $hasOperationTime = isset($reply->operationTime); @@ -106,7 +106,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/causal-consistency/causal-consistency-005.phpt b/tests/causal-consistency/causal-consistency-005.phpt index d01c94a4f..37da520e0 100644 --- a/tests/causal-consistency/causal-consistency-005.phpt +++ b/tests/causal-consistency/causal-consistency-005.phpt @@ -51,7 +51,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber MongoDB\Driver\Monitoring\removeSubscriber($this); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $hasAfterClusterTime = isset($command->readConcern->afterClusterTime); @@ -62,7 +62,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { $reply = $event->getReply(); $hasOperationTime = isset($reply->operationTime); @@ -74,7 +74,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/causal-consistency/causal-consistency-006.phpt b/tests/causal-consistency/causal-consistency-006.phpt index e8470035b..f3607a990 100644 --- a/tests/causal-consistency/causal-consistency-006.phpt +++ b/tests/causal-consistency/causal-consistency-006.phpt @@ -65,7 +65,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber MongoDB\Driver\Monitoring\removeSubscriber($this); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $hasAfterClusterTime = isset($command->readConcern->afterClusterTime); @@ -76,7 +76,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { $reply = $event->getReply(); $hasOperationTime = isset($reply->operationTime); @@ -88,7 +88,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/command/command-ctor-001.phpt b/tests/command/command-ctor-001.phpt index 24929f4d7..024b34d96 100644 --- a/tests/command/command-ctor-001.phpt +++ b/tests/command/command-ctor-001.phpt @@ -19,6 +19,7 @@ class MyClass implements MongoDB\BSON\Persistable $this->child = $child; } + #[\ReturnTypeWillChange] public function bsonSerialize() { return [ @@ -27,7 +28,7 @@ class MyClass implements MongoDB\BSON\Persistable ]; } - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { $this->id = $data['_id']; $this->child = $data['child']; diff --git a/tests/command/cursor-batchsize-001.phpt b/tests/command/cursor-batchsize-001.phpt index bd72cf1a1..520b2a380 100644 --- a/tests/command/cursor-batchsize-001.phpt +++ b/tests/command/cursor-batchsize-001.phpt @@ -37,7 +37,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber MongoDB\Driver\Monitoring\removeSubscriber($this); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); @@ -50,7 +50,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { $reply = $event->getReply(); @@ -63,7 +63,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/command/cursor-batchsize-002.phpt b/tests/command/cursor-batchsize-002.phpt index c76437fb9..feb12f637 100644 --- a/tests/command/cursor-batchsize-002.phpt +++ b/tests/command/cursor-batchsize-002.phpt @@ -37,7 +37,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber MongoDB\Driver\Monitoring\removeSubscriber($this); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); @@ -50,7 +50,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { $reply = $event->getReply(); @@ -63,7 +63,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/command/cursor-comment-001.phpt b/tests/command/cursor-comment-001.phpt index 7a8393c19..62814f8b7 100644 --- a/tests/command/cursor-comment-001.phpt +++ b/tests/command/cursor-comment-001.phpt @@ -39,7 +39,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber MongoDB\Driver\Monitoring\removeSubscriber($this); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); @@ -48,11 +48,11 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/cursor/bug0924-001.phpt b/tests/cursor/bug0924-001.phpt index 0e3793450..a8cef98c1 100644 --- a/tests/cursor/bug0924-001.phpt +++ b/tests/cursor/bug0924-001.phpt @@ -17,12 +17,13 @@ class MyDocument implements MongoDB\BSON\Serializable, MongoDB\BSON\Unserializab $this->data['_id'] = $id; } + #[\ReturnTypeWillChange] public function bsonSerialize() { return (object) $this->data; } - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { printf("%s called for ID: %s\n", __METHOD__, $data['_id']); $this->data = $data; diff --git a/tests/cursor/bug0924-002.phpt b/tests/cursor/bug0924-002.phpt index c28c94443..594dd591d 100644 --- a/tests/cursor/bug0924-002.phpt +++ b/tests/cursor/bug0924-002.phpt @@ -17,12 +17,13 @@ class MyDocument implements MongoDB\BSON\Persistable $this->data['_id'] = $id; } + #[\ReturnTypeWillChange] public function bsonSerialize() { return (object) $this->data; } - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { printf("%s called for ID: %s\n", __METHOD__, $data['_id']); $this->data = $data; diff --git a/tests/cursor/bug1050-001.phpt b/tests/cursor/bug1050-001.phpt index b64efbbdc..d1da9ae69 100644 --- a/tests/cursor/bug1050-001.phpt +++ b/tests/cursor/bug1050-001.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { if ($event->getCommandName() !== 'aggregate' && $event->getCommandName() !== 'getMore') { return; @@ -20,7 +20,7 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("Executing command: %s\n", $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { if ($event->getCommandName() !== 'aggregate' && $event->getCommandName() !== 'getMore') { return; @@ -29,7 +29,7 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("Executing command took %0.6f seconds\n", $event->getDurationMicros() / 1000000); } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/cursor/bug1050-002.phpt b/tests/cursor/bug1050-002.phpt index 42c3bfe6c..b50c3fb24 100644 --- a/tests/cursor/bug1050-002.phpt +++ b/tests/cursor/bug1050-002.phpt @@ -19,7 +19,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { if ($event->getCommandName() !== 'aggregate' && $event->getCommandName() !== 'getMore') { return; @@ -28,7 +28,7 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("Executing command: %s\n", $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { if ($event->getCommandName() !== 'aggregate' && $event->getCommandName() !== 'getMore') { return; @@ -37,7 +37,7 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("Executing command took %0.6f seconds\n", $event->getDurationMicros() / 1000000); } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/cursor/bug1152-001.phpt b/tests/cursor/bug1152-001.phpt index aefc107c7..328ca045d 100644 --- a/tests/cursor/bug1152-001.phpt +++ b/tests/cursor/bug1152-001.phpt @@ -56,7 +56,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber printf("Unique session IDs used: %d\n", count(array_unique($this->lsidByRequestId))); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $requestId = $event->getRequestId(); $sessionId = bin2hex((string) $event->getCommand()->lsid->id); @@ -92,7 +92,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { /* Associate the aggregate's session ID with its cursor ID so it can be * looked up by the subsequent getMore or killCursors */ @@ -104,7 +104,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/cursor/bug1152-002.phpt b/tests/cursor/bug1152-002.phpt index 39f7016ac..550b18ad3 100644 --- a/tests/cursor/bug1152-002.phpt +++ b/tests/cursor/bug1152-002.phpt @@ -54,7 +54,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber printf("Unique session IDs used: %d\n", count(array_unique($this->lsidByRequestId))); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $requestId = $event->getRequestId(); $sessionId = bin2hex((string) $event->getCommand()->lsid->id); @@ -90,7 +90,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { /* Associate the aggregate's session ID with its cursor ID so it can be * looked up by the subsequent getMore or killCursors */ @@ -102,7 +102,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/cursor/bug1274-001.phpt b/tests/cursor/bug1274-001.phpt index 9f3f3e132..8f02d3310 100644 --- a/tests/cursor/bug1274-001.phpt +++ b/tests/cursor/bug1274-001.phpt @@ -18,7 +18,7 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber $this->pid = getmypid(); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $commandName = $event->getCommandName(); @@ -32,11 +32,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s executes %s\n", $process, $commandName); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/cursor/bug1274-002.phpt b/tests/cursor/bug1274-002.phpt index fcecddc3c..c53df6b0e 100644 --- a/tests/cursor/bug1274-002.phpt +++ b/tests/cursor/bug1274-002.phpt @@ -19,7 +19,7 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber $this->pid = getmypid(); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $commandName = $event->getCommandName(); @@ -33,11 +33,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s executes %s\n", $process, $commandName); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/cursor/bug1274-003.phpt b/tests/cursor/bug1274-003.phpt index 65518c5ed..386366232 100644 --- a/tests/cursor/bug1274-003.phpt +++ b/tests/cursor/bug1274-003.phpt @@ -18,7 +18,7 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber $this->pid = getmypid(); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $commandName = $event->getCommandName(); @@ -32,11 +32,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s executes %s\n", $process, $commandName); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/cursor/bug1274-004.phpt b/tests/cursor/bug1274-004.phpt index f600dbff7..b5d6eefec 100644 --- a/tests/cursor/bug1274-004.phpt +++ b/tests/cursor/bug1274-004.phpt @@ -18,7 +18,7 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber $this->pid = getmypid(); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $commandName = $event->getCommandName(); @@ -32,11 +32,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s executes %s\n", $process, $commandName); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/cursor/bug1274-005.phpt b/tests/cursor/bug1274-005.phpt index 69a298143..e7c54525f 100644 --- a/tests/cursor/bug1274-005.phpt +++ b/tests/cursor/bug1274-005.phpt @@ -19,7 +19,7 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber $this->pid = getmypid(); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $commandName = $event->getCommandName(); @@ -33,11 +33,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s executes %s\n", $process, $commandName); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/cursor/bug1274-006.phpt b/tests/cursor/bug1274-006.phpt index 2e0edd10c..3debdabff 100644 --- a/tests/cursor/bug1274-006.phpt +++ b/tests/cursor/bug1274-006.phpt @@ -18,7 +18,7 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber $this->pid = getmypid(); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $commandName = $event->getCommandName(); @@ -32,11 +32,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s executes %s\n", $process, $commandName); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/cursor/bug1529-001.phpt b/tests/cursor/bug1529-001.phpt index 90045fa49..dfa043652 100644 --- a/tests/cursor/bug1529-001.phpt +++ b/tests/cursor/bug1529-001.phpt @@ -20,7 +20,7 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber $this->pid = getmypid(); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $commandName = $event->getCommandName(); @@ -34,11 +34,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s executes %s\n", $process, $commandName); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/cursor/cursor-setTypeMap_error-004.phpt b/tests/cursor/cursor-setTypeMap_error-004.phpt index e4511c406..42438bc95 100644 --- a/tests/cursor/cursor-setTypeMap_error-004.phpt +++ b/tests/cursor/cursor-setTypeMap_error-004.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class MyDocument extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data, ArrayObject::ARRAY_AS_PROPS); } diff --git a/tests/cursor/cursor-toArray-002.phpt b/tests/cursor/cursor-toArray-002.phpt index d867e22e9..7f002695f 100644 --- a/tests/cursor/cursor-toArray-002.phpt +++ b/tests/cursor/cursor-toArray-002.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { parent::__construct($data); } diff --git a/tests/manager/bug1163-001.phpt b/tests/manager/bug1163-001.phpt index 01accd4c6..beefbdffb 100644 --- a/tests/manager/bug1163-001.phpt +++ b/tests/manager/bug1163-001.phpt @@ -41,7 +41,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber MongoDB\Driver\Monitoring\removeSubscriber($this); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { if ($event->getCommandName() === 'insert') { $command = $event->getCommand(); @@ -53,11 +53,11 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/manager/manager-addSubscriber-001.phpt b/tests/manager/manager-addSubscriber-001.phpt index fabce2cf3..7bba718e4 100644 --- a/tests/manager/manager-addSubscriber-001.phpt +++ b/tests/manager/manager-addSubscriber-001.phpt @@ -11,17 +11,17 @@ require_once __DIR__ . '/../utils/basic.inc'; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { printf("commandSucceeded: %s\n", $event->getCommandName()); } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { printf("commandFailed: %s\n", $event->getCommandName()); } diff --git a/tests/manager/manager-addSubscriber-002.phpt b/tests/manager/manager-addSubscriber-002.phpt index efb782f3b..2998f37f9 100644 --- a/tests/manager/manager-addSubscriber-002.phpt +++ b/tests/manager/manager-addSubscriber-002.phpt @@ -18,17 +18,17 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber $this->id = $id; } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("MySubscriber(%s) commandStarted: %s\n", $this->id, $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { printf("MySubscriber(%s) commandSucceeded: %s\n", $this->id, $event->getCommandName()); } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { printf("MySubscriber(%s) commandFailed: %s\n", $this->id, $event->getCommandName()); } diff --git a/tests/manager/manager-addSubscriber-003.phpt b/tests/manager/manager-addSubscriber-003.phpt index 03abcfb56..63a1eabe7 100644 --- a/tests/manager/manager-addSubscriber-003.phpt +++ b/tests/manager/manager-addSubscriber-003.phpt @@ -11,17 +11,17 @@ require_once __DIR__ . '/../utils/basic.inc'; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { printf("commandSucceeded: %s\n", $event->getCommandName()); } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { printf("commandFailed: %s\n", $event->getCommandName()); } diff --git a/tests/manager/manager-addSubscriber-004.phpt b/tests/manager/manager-addSubscriber-004.phpt index a801495df..0b1f875e9 100644 --- a/tests/manager/manager-addSubscriber-004.phpt +++ b/tests/manager/manager-addSubscriber-004.phpt @@ -11,17 +11,17 @@ require_once __DIR__ . '/../utils/basic.inc'; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { printf("commandSucceeded: %s\n", $event->getCommandName()); } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { printf("commandFailed: %s\n", $event->getCommandName()); } diff --git a/tests/manager/manager-addSubscriber-005.phpt b/tests/manager/manager-addSubscriber-005.phpt index 00213a320..6c3e40873 100644 --- a/tests/manager/manager-addSubscriber-005.phpt +++ b/tests/manager/manager-addSubscriber-005.phpt @@ -11,17 +11,17 @@ require_once __DIR__ . '/../utils/basic.inc'; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { printf("commandSucceeded: %s\n", $event->getCommandName()); } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { printf("commandFailed: %s\n", $event->getCommandName()); } diff --git a/tests/manager/manager-addSubscriber-006.phpt b/tests/manager/manager-addSubscriber-006.phpt index 6c81de4c8..bbc2f084b 100644 --- a/tests/manager/manager-addSubscriber-006.phpt +++ b/tests/manager/manager-addSubscriber-006.phpt @@ -11,17 +11,17 @@ require_once __DIR__ . '/../utils/basic.inc'; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("commandStarted: %s\n", $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { printf("commandSucceeded: %s\n", $event->getCommandName()); } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { printf("commandFailed: %s\n", $event->getCommandName()); } diff --git a/tests/manager/manager-ctor-disableClientPersistence-008.phpt b/tests/manager/manager-ctor-disableClientPersistence-008.phpt index dfe65c163..7a388c582 100644 --- a/tests/manager/manager-ctor-disableClientPersistence-008.phpt +++ b/tests/manager/manager-ctor-disableClientPersistence-008.phpt @@ -11,17 +11,17 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { private $events = []; - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("Command started: %s\n", $event->getCommandName()); $this->events[] = $event; } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/manager/manager-ctor-disableClientPersistence-009.phpt b/tests/manager/manager-ctor-disableClientPersistence-009.phpt index 9b5cfc717..62209a103 100644 --- a/tests/manager/manager-ctor-disableClientPersistence-009.phpt +++ b/tests/manager/manager-ctor-disableClientPersistence-009.phpt @@ -11,17 +11,17 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { private $events = []; - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { printf("Command succeeded: %s\n", $event->getCommandName()); $this->events[] = $event; } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/manager/manager-ctor-disableClientPersistence-010.phpt b/tests/manager/manager-ctor-disableClientPersistence-010.phpt index 79e81cf89..e09e6fe6c 100644 --- a/tests/manager/manager-ctor-disableClientPersistence-010.phpt +++ b/tests/manager/manager-ctor-disableClientPersistence-010.phpt @@ -11,15 +11,15 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { private $events = []; - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { printf("Command failed: %s\n", $event->getCommandName()); $this->events[] = $event; diff --git a/tests/manager/manager-ctor-disableClientPersistence-011.phpt b/tests/manager/manager-ctor-disableClientPersistence-011.phpt index 5f5f24863..3e8a53353 100644 --- a/tests/manager/manager-ctor-disableClientPersistence-011.phpt +++ b/tests/manager/manager-ctor-disableClientPersistence-011.phpt @@ -11,17 +11,17 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { private $events = []; - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("Command started: %s\n", $event->getCommandName()); $this->events[] = $event; } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/manager/manager-ctor-serverApi-001.phpt b/tests/manager/manager-ctor-serverApi-001.phpt index 092404397..f26e7c155 100644 --- a/tests/manager/manager-ctor-serverApi-001.phpt +++ b/tests/manager/manager-ctor-serverApi-001.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); var_dump($command->apiVersion); @@ -19,11 +19,11 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber var_dump(isset($command->apiDeprecationErrors)); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/manager/manager-executeQuery-005.phpt b/tests/manager/manager-executeQuery-005.phpt index 84f8f03b9..cdf763145 100644 --- a/tests/manager/manager-executeQuery-005.phpt +++ b/tests/manager/manager-executeQuery-005.phpt @@ -10,7 +10,7 @@ MongoDB\Driver\Manager::executeQuery() with filter and projection require_once __DIR__ . "/../utils/basic.inc"; class MyArrayObject extends ArrayObject implements MongoDB\BSON\Unserializable { - function bsonUnserialize(array $data) { + public function bsonUnserialize(array $data): void { parent::__construct($data); } } diff --git a/tests/manager/manager-removeSubscriber-001.phpt b/tests/manager/manager-removeSubscriber-001.phpt index fed974fe4..8226dc870 100644 --- a/tests/manager/manager-removeSubscriber-001.phpt +++ b/tests/manager/manager-removeSubscriber-001.phpt @@ -18,17 +18,17 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber $this->id = $id; } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("MySubscriber(%s) commandStarted: %s\n", $this->id, $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { printf("MySubscriber(%s) commandSucceeded: %s\n", $this->id, $event->getCommandName()); } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { printf("MySubscriber(%s) commandFailed: %s\n", $this->id, $event->getCommandName()); } diff --git a/tests/manager/manager-removeSubscriber-002.phpt b/tests/manager/manager-removeSubscriber-002.phpt index 004bb50a1..55f800e98 100644 --- a/tests/manager/manager-removeSubscriber-002.phpt +++ b/tests/manager/manager-removeSubscriber-002.phpt @@ -18,17 +18,17 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber $this->id = $id; } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("MySubscriber(%s) commandStarted: %s\n", $this->id, $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { printf("MySubscriber(%s) commandSucceeded: %s\n", $this->id, $event->getCommandName()); } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { printf("MySubscriber(%s) commandFailed: %s\n", $this->id, $event->getCommandName()); } diff --git a/tests/query/query-ctor-001.phpt b/tests/query/query-ctor-001.phpt index 8323ad437..98861f87c 100644 --- a/tests/query/query-ctor-001.phpt +++ b/tests/query/query-ctor-001.phpt @@ -19,6 +19,7 @@ class MyClass implements MongoDB\BSON\Persistable $this->child = $child; } + #[\ReturnTypeWillChange] public function bsonSerialize() { return [ @@ -27,7 +28,7 @@ class MyClass implements MongoDB\BSON\Persistable ]; } - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { $this->id = $data['_id']; $this->child = $data['child']; diff --git a/tests/query/query-ctor-comment-001.phpt b/tests/query/query-ctor-comment-001.phpt index b0ecc3f4f..ddb0b79fa 100644 --- a/tests/query/query-ctor-comment-001.phpt +++ b/tests/query/query-ctor-comment-001.phpt @@ -12,7 +12,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); @@ -25,11 +25,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s included comment: %s\n", $event->getCommandName(), json_encode($command->comment)); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/query/query-ctor-comment_error-001.phpt b/tests/query/query-ctor-comment_error-001.phpt index c4f1bd80f..31375831f 100644 --- a/tests/query/query-ctor-comment_error-001.phpt +++ b/tests/query/query-ctor-comment_error-001.phpt @@ -7,6 +7,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class Comment implements MongoDB\BSON\Serializable { + #[\ReturnTypeWillChange] public function bsonSerialize(): array { throw new Exception('php_phongo_zval_to_bson_value fails'); diff --git a/tests/query/query-ctor-let-001.phpt b/tests/query/query-ctor-let-001.phpt index 14a3a88f1..22fb21b8a 100644 --- a/tests/query/query-ctor-let-001.phpt +++ b/tests/query/query-ctor-let-001.phpt @@ -12,7 +12,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); @@ -25,11 +25,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s included let: %s\n", $event->getCommandName(), json_encode($command->let)); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/retryable-reads/retryable-reads-001.phpt b/tests/retryable-reads/retryable-reads-001.phpt index 0f3e749cf..886615284 100644 --- a/tests/retryable-reads/retryable-reads-001.phpt +++ b/tests/retryable-reads/retryable-reads-001.phpt @@ -11,16 +11,16 @@ require_once __DIR__ . "/../utils/basic.inc"; class Observer implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("Command started: %s\n", $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/retryable-reads/retryable-reads-002.phpt b/tests/retryable-reads/retryable-reads-002.phpt index fcc21ee9e..e1855f5fd 100644 --- a/tests/retryable-reads/retryable-reads-002.phpt +++ b/tests/retryable-reads/retryable-reads-002.phpt @@ -11,16 +11,16 @@ require_once __DIR__ . "/../utils/basic.inc"; class Observer implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("Command started: %s\n", $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/retryable-reads/retryable-reads_error-001.phpt b/tests/retryable-reads/retryable-reads_error-001.phpt index 7038ab1e2..fa96eecc6 100644 --- a/tests/retryable-reads/retryable-reads_error-001.phpt +++ b/tests/retryable-reads/retryable-reads_error-001.phpt @@ -10,16 +10,16 @@ require_once __DIR__ . "/../utils/basic.inc"; class Observer implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("Command started: %s\n", $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/retryable-reads/retryable-reads_error-002.phpt b/tests/retryable-reads/retryable-reads_error-002.phpt index 84a9e6bd2..78fb21a11 100644 --- a/tests/retryable-reads/retryable-reads_error-002.phpt +++ b/tests/retryable-reads/retryable-reads_error-002.phpt @@ -10,16 +10,16 @@ require_once __DIR__ . "/../utils/basic.inc"; class Observer implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { printf("Command started: %s\n", $event->getCommandName()); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/retryable-writes/retryable-writes-001.phpt b/tests/retryable-writes/retryable-writes-001.phpt index edb0d95d9..84f31f5e6 100644 --- a/tests/retryable-writes/retryable-writes-001.phpt +++ b/tests/retryable-writes/retryable-writes-001.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class TransactionIdObserver implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $hasTransactionId = isset($command->lsid) && isset($command->txnNumber); @@ -19,11 +19,11 @@ class TransactionIdObserver implements MongoDB\Driver\Monitoring\CommandSubscrib printf("%s command includes transaction ID: %s\n", $event->getCommandName(), $hasTransactionId ? 'yes' : 'no'); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/retryable-writes/retryable-writes-002.phpt b/tests/retryable-writes/retryable-writes-002.phpt index 8ac1d21d5..83c537446 100644 --- a/tests/retryable-writes/retryable-writes-002.phpt +++ b/tests/retryable-writes/retryable-writes-002.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class TransactionIdObserver implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $hasTransactionId = isset($command->lsid) && isset($command->txnNumber); @@ -19,11 +19,11 @@ class TransactionIdObserver implements MongoDB\Driver\Monitoring\CommandSubscrib printf("%s command includes transaction ID: %s\n", $event->getCommandName(), $hasTransactionId ? 'yes' : 'no'); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/retryable-writes/retryable-writes-003.phpt b/tests/retryable-writes/retryable-writes-003.phpt index f8d5fc7a2..173962a10 100644 --- a/tests/retryable-writes/retryable-writes-003.phpt +++ b/tests/retryable-writes/retryable-writes-003.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class TransactionIdObserver implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $hasTransactionId = isset($command->lsid) && isset($command->txnNumber); @@ -19,11 +19,11 @@ class TransactionIdObserver implements MongoDB\Driver\Monitoring\CommandSubscrib printf("%s command includes transaction ID: %s\n", $event->getCommandName(), $hasTransactionId ? 'yes' : 'no'); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/retryable-writes/retryable-writes-004.phpt b/tests/retryable-writes/retryable-writes-004.phpt index 295ca8ec2..a91b9fbf8 100644 --- a/tests/retryable-writes/retryable-writes-004.phpt +++ b/tests/retryable-writes/retryable-writes-004.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class TransactionIdObserver implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $hasTransactionId = isset($command->lsid) && isset($command->txnNumber); @@ -19,11 +19,11 @@ class TransactionIdObserver implements MongoDB\Driver\Monitoring\CommandSubscrib printf("%s command includes transaction ID: %s\n", $event->getCommandName(), $hasTransactionId ? 'yes' : 'no'); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/retryable-writes/retryable-writes-005.phpt b/tests/retryable-writes/retryable-writes-005.phpt index 7bda7ab58..defb57cd1 100644 --- a/tests/retryable-writes/retryable-writes-005.phpt +++ b/tests/retryable-writes/retryable-writes-005.phpt @@ -11,7 +11,7 @@ require_once __DIR__ . "/../utils/basic.inc"; class TransactionIdObserver implements MongoDB\Driver\Monitoring\CommandSubscriber { - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $hasTransactionId = isset($command->lsid) && isset($command->txnNumber); @@ -19,11 +19,11 @@ class TransactionIdObserver implements MongoDB\Driver\Monitoring\CommandSubscrib printf("%s command includes transaction ID: %s\n", $event->getCommandName(), $hasTransactionId ? 'yes' : 'no'); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/session/bug1274-002.phpt b/tests/session/bug1274-002.phpt index f5886865f..7e38f1482 100644 --- a/tests/session/bug1274-002.phpt +++ b/tests/session/bug1274-002.phpt @@ -19,7 +19,7 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber $this->pid = getmypid(); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $commandName = $event->getCommandName(); @@ -33,11 +33,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s executes %s\n", $process, $commandName); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/session/bug1274-003.phpt b/tests/session/bug1274-003.phpt index 802d6f7f8..f5575586b 100644 --- a/tests/session/bug1274-003.phpt +++ b/tests/session/bug1274-003.phpt @@ -46,7 +46,7 @@ class SessionLogger implements MongoDB\Driver\Monitoring\CommandSubscriber $this->manager->executeBulkWrite($this->logNamespace, $bulk); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); @@ -60,11 +60,11 @@ class SessionLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s executes %s\n", $process, $commandName); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/session/bug1274-005.phpt b/tests/session/bug1274-005.phpt index b9df30822..9442b1c4d 100644 --- a/tests/session/bug1274-005.phpt +++ b/tests/session/bug1274-005.phpt @@ -19,7 +19,7 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber $this->pid = getmypid(); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $commandName = $event->getCommandName(); @@ -33,11 +33,11 @@ class CommandLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s executes %s\n", $process, $commandName); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/session/bug1274-006.phpt b/tests/session/bug1274-006.phpt index 642a934a8..0b6f783ce 100644 --- a/tests/session/bug1274-006.phpt +++ b/tests/session/bug1274-006.phpt @@ -46,7 +46,7 @@ class SessionLogger implements MongoDB\Driver\Monitoring\CommandSubscriber $this->manager->executeBulkWrite($this->logNamespace, $bulk); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); @@ -60,11 +60,11 @@ class SessionLogger implements MongoDB\Driver\Monitoring\CommandSubscriber printf("%s executes %s\n", $process, $commandName); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/session/session-002.phpt b/tests/session/session-002.phpt index a83b3d539..02b82ef3a 100644 --- a/tests/session/session-002.phpt +++ b/tests/session/session-002.phpt @@ -94,7 +94,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber MongoDB\Driver\Monitoring\removeSubscriber($this); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { $command = $event->getCommand(); $hasClusterTime = isset($command->{'$clusterTime'}); @@ -106,7 +106,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { $reply = $event->getReply(); $hasClusterTime = isset($reply->{'$clusterTime'}); @@ -118,7 +118,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber } } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/session/session-commitTransaction-001.phpt b/tests/session/session-commitTransaction-001.phpt index 301935dca..1099af348 100644 --- a/tests/session/session-commitTransaction-001.phpt +++ b/tests/session/session-commitTransaction-001.phpt @@ -42,7 +42,7 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber MongoDB\Driver\Monitoring\removeSubscriber($this); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { if ($event->getCommandName() !== 'commitTransaction') { return; @@ -51,11 +51,11 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber printf("commitTransaction included write concern: %s\n", json_encode($event->getCommand()->writeConcern)); } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } diff --git a/tests/standalone/bug0545.phpt b/tests/standalone/bug0545.phpt index 026255e98..c085c3e3b 100644 --- a/tests/standalone/bug0545.phpt +++ b/tests/standalone/bug0545.phpt @@ -10,13 +10,14 @@ require_once __DIR__ . "/../utils/basic.inc"; class Book implements MongoDB\BSON\Persistable { + #[\ReturnTypeWillChange] public function bsonSerialize() { $data = get_object_vars($this); return $data; } - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { foreach ($data as $name => $value) { $this->{$name} = $value; @@ -26,13 +27,14 @@ class Book implements MongoDB\BSON\Persistable class Page implements MongoDB\BSON\Persistable { + #[\ReturnTypeWillChange] public function bsonSerialize() { $data = get_object_vars($this); return $data; } - public function bsonUnserialize(array $data) + public function bsonUnserialize(array $data): void { foreach ($data as $name => $value) { $this->{$name} = $value; diff --git a/tests/topologyDescription/topologyDescription-debug-001.phpt b/tests/topologyDescription/topologyDescription-debug-001.phpt index e96ebefcd..a45fa1b3b 100644 --- a/tests/topologyDescription/topologyDescription-debug-001.phpt +++ b/tests/topologyDescription/topologyDescription-debug-001.phpt @@ -11,26 +11,26 @@ class TopologyDescriptionProvider implements MongoDB\Driver\Monitoring\SDAMSubsc { private $topologyDescription; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void { $this->topologyDescription = $event->getNewDescription(); } - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} public function getTopologyDescription() { diff --git a/tests/topologyDescription/topologyDescription-getServers-001.phpt b/tests/topologyDescription/topologyDescription-getServers-001.phpt index 1ca2ccd78..102df1076 100644 --- a/tests/topologyDescription/topologyDescription-getServers-001.phpt +++ b/tests/topologyDescription/topologyDescription-getServers-001.phpt @@ -11,26 +11,26 @@ class TopologyDescriptionProvider implements MongoDB\Driver\Monitoring\SDAMSubsc { private $topologyDescription; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void { $this->topologyDescription = $event->getNewDescription(); } - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} public function getTopologyDescription() { diff --git a/tests/topologyDescription/topologyDescription-getType-001.phpt b/tests/topologyDescription/topologyDescription-getType-001.phpt index 64a6e3b0d..156e5de0a 100644 --- a/tests/topologyDescription/topologyDescription-getType-001.phpt +++ b/tests/topologyDescription/topologyDescription-getType-001.phpt @@ -11,26 +11,26 @@ class TopologyDescriptionProvider implements MongoDB\Driver\Monitoring\SDAMSubsc { private $topologyDescription; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void { $this->topologyDescription = $event->getNewDescription(); } - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} public function getTopologyDescription() { diff --git a/tests/topologyDescription/topologyDescription-hasReadableServer-001.phpt b/tests/topologyDescription/topologyDescription-hasReadableServer-001.phpt index 1f7c2d290..7baeaddd8 100644 --- a/tests/topologyDescription/topologyDescription-hasReadableServer-001.phpt +++ b/tests/topologyDescription/topologyDescription-hasReadableServer-001.phpt @@ -11,26 +11,26 @@ class TopologyDescriptionProvider implements MongoDB\Driver\Monitoring\SDAMSubsc { private $topologyDescription; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void { $this->topologyDescription = $event->getNewDescription(); } - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} public function getTopologyDescription() { diff --git a/tests/topologyDescription/topologyDescription-hasReadableServer-002.phpt b/tests/topologyDescription/topologyDescription-hasReadableServer-002.phpt index c0234ff3b..78ba72841 100644 --- a/tests/topologyDescription/topologyDescription-hasReadableServer-002.phpt +++ b/tests/topologyDescription/topologyDescription-hasReadableServer-002.phpt @@ -11,26 +11,26 @@ class TopologyDescriptionProvider implements MongoDB\Driver\Monitoring\SDAMSubsc { private $topologyDescription; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void { $this->topologyDescription = $event->getNewDescription(); } - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} public function getTopologyDescription() { diff --git a/tests/topologyDescription/topologyDescription-hasReadableServer_error-001.phpt b/tests/topologyDescription/topologyDescription-hasReadableServer_error-001.phpt index e6fc8e1fc..a278adaa7 100644 --- a/tests/topologyDescription/topologyDescription-hasReadableServer_error-001.phpt +++ b/tests/topologyDescription/topologyDescription-hasReadableServer_error-001.phpt @@ -11,26 +11,26 @@ class TopologyDescriptionProvider implements MongoDB\Driver\Monitoring\SDAMSubsc { private $topologyDescription; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void { $this->topologyDescription = $event->getNewDescription(); } - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} public function getTopologyDescription() { diff --git a/tests/topologyDescription/topologyDescription-hasWritableServer-001.phpt b/tests/topologyDescription/topologyDescription-hasWritableServer-001.phpt index 17be4fb7b..5a109e7d5 100644 --- a/tests/topologyDescription/topologyDescription-hasWritableServer-001.phpt +++ b/tests/topologyDescription/topologyDescription-hasWritableServer-001.phpt @@ -11,26 +11,26 @@ class TopologyDescriptionProvider implements MongoDB\Driver\Monitoring\SDAMSubsc { private $topologyDescription; - public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event) {} + public function serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event): void {} - public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event) {} + public function serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event): void {} - public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event) {} + public function serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event): void {} - public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event) {} + public function serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event): void {} - public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event) {} + public function serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event): void {} - public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event) {} + public function serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event): void {} - public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event) + public function topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event): void { $this->topologyDescription = $event->getNewDescription(); } - public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event) {} + public function topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event): void {} - public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event) {} + public function topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event): void {} public function getTopologyDescription() { diff --git a/tests/utils/classes.inc b/tests/utils/classes.inc index 57e4ae4be..f5a288cf5 100644 --- a/tests/utils/classes.inc +++ b/tests/utils/classes.inc @@ -7,19 +7,20 @@ class Person implements MongoDB\BSON\Persistable { protected $friends = array(); protected $secret = "none"; - function __construct($name, $age) { + public function __construct($name, $age) { $this->name = $name; $this->age = $age; $this->addresses = array(); $this->secret = "$name confidential info"; } - function addAddress(Address $address) { + public function addAddress(Address $address) { $this->addresses[] = $address; } - function addFriend(Person $friend) { + public function addFriend(Person $friend) { $this->friends[] = $friend; } - function bsonSerialize() { + #[\ReturnTypeWillChange] + public function bsonSerialize() { return array( "name" => $this->name, "age" => $this->age, @@ -27,7 +28,7 @@ class Person implements MongoDB\BSON\Persistable { "friends" => $this->friends, ); } - function bsonUnserialize(array $data) { + public function bsonUnserialize(array $data): void { $this->name = $data["name"]; $this->age = $data["age"]; $this->addresses = $data["addresses"]; @@ -38,17 +39,18 @@ class Address implements MongoDB\BSON\Persistable { protected $zip; protected $country; - function __construct($zip, $country) { + public function __construct($zip, $country) { $this->zip = $zip; $this->country = $country; } - function bsonSerialize() { + #[\ReturnTypeWillChange] + public function bsonSerialize() { return array( "zip" => $this->zip, "country" => $this->country, ); } - function bsonUnserialize(array $data) { + public function bsonUnserialize(array $data): void { $this->zip = $data["zip"]; $this->country = $data["country"]; } diff --git a/tests/utils/observer.php b/tests/utils/observer.php index cb424a09f..0f7432cfc 100644 --- a/tests/utils/observer.php +++ b/tests/utils/observer.php @@ -22,14 +22,14 @@ public function observe(callable $execution, callable $commandCallback) } } } - public function commandStarted(CommandStartedEvent $event) + public function commandStarted(CommandStartedEvent $event): void { $this->commands[] = $event->getCommand(); } - public function commandSucceeded(CommandSucceededEvent $event) + public function commandSucceeded(CommandSucceededEvent $event): void { } - public function commandFailed(CommandFailedEvent $event) + public function commandFailed(CommandFailedEvent $event): void { } } diff --git a/tests/writeError/writeerror-getInfo-002.phpt b/tests/writeError/writeerror-getInfo-002.phpt index ed1c0d9f6..d4ced2c80 100644 --- a/tests/writeError/writeerror-getInfo-002.phpt +++ b/tests/writeError/writeerror-getInfo-002.phpt @@ -46,18 +46,18 @@ class Test implements MongoDB\Driver\Monitoring\CommandSubscriber MongoDB\Driver\Monitoring\removeSubscriber($this); } - public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event) + public function commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event): void { } - public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event) + public function commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event): void { if ($event->getCommandName() === 'insert') { $this->errInfo = $event->getReply()->writeErrors[0]->errInfo ?? null; } } - public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event) + public function commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event): void { } } From 773ff9dffa2981bc2b7af4787286ceef7bf05ed3 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Fri, 29 Jul 2022 08:45:14 +0200 Subject: [PATCH 14/26] Add missing macro --- src/phongo_compat.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/phongo_compat.h b/src/phongo_compat.h index 9b0b9ffde..6dd877dc6 100644 --- a/src/phongo_compat.h +++ b/src/phongo_compat.h @@ -290,6 +290,12 @@ static inline zend_bool zend_ini_parse_bool(zend_string* str) ZEND_ARG_INFO(pass_by_ref, name) #endif +/* ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE was introduced in PHP 8.0. */ +#ifndef ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE +#define ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(pass_by_ref, name, classname, allow_null, default_value) \ + ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) +#endif + /* The ZEND_BEGIN_ARG_WITH_TENTATIVE_* set of macros was introduced in PHP 8.1 */ #ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX #define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ From d3e93a749cbbf3947bd829bfa28a1ec7887e7114 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Fri, 29 Jul 2022 14:32:03 +0200 Subject: [PATCH 15/26] Fix tests relying on value injection --- ...bulkwriteexception-getwriteresult-001.phpt | 60 +++++++++++++++---- ...ommandexception-getresultdocument-001.phpt | 2 +- .../readconcern-ctor_error-002.phpt | 10 ++-- .../session-advanceOperationTime-003.phpt | 6 +- ...ession-advanceOperationTime_error-001.phpt | 6 +- ...scription-hasReadableServer_error-001.phpt | 2 - 6 files changed, 61 insertions(+), 25 deletions(-) diff --git a/tests/exception/bulkwriteexception-getwriteresult-001.phpt b/tests/exception/bulkwriteexception-getwriteresult-001.phpt index 808ddceca..90a790aae 100644 --- a/tests/exception/bulkwriteexception-getwriteresult-001.phpt +++ b/tests/exception/bulkwriteexception-getwriteresult-001.phpt @@ -1,22 +1,60 @@ --TEST-- MongoDB\Driver\Exception\BulkWriteException::getWriteResult() +--SKIPIF-- + + + --FILE-- 1]; +$manager = create_test_manager(); -$reflection = new ReflectionClass($exception); - -$resultDocumentProperty = $reflection->getProperty('writeResult'); -$resultDocumentProperty->setAccessible(true); -$resultDocumentProperty->setValue($exception, $writeResult); - -var_dump($writeResult === $exception->getWriteResult()); +try { + $bulk = new MongoDB\Driver\BulkWrite; + $bulk->insert(['_id' => 1]); + $bulk->insert(['_id' => 1]); + $result = $manager->executeBulkWrite(NS, $bulk); +} catch (MongoDB\Driver\Exception\BulkWriteException $e) { + var_dump($e->getWriteResult()); +} ?> ===DONE=== ---EXPECT-- -bool(true) +--EXPECTF-- +object(MongoDB\Driver\WriteResult)#%d (9) { + ["nInserted"]=> + int(1) + ["nMatched"]=> + int(0) + ["nModified"]=> + int(0) + ["nRemoved"]=> + int(0) + ["nUpserted"]=> + int(0) + ["upsertedIds"]=> + array(0) { + } + ["writeErrors"]=> + array(1) { + [0]=> + object(MongoDB\Driver\WriteError)#%d (4) { + ["message"]=> + string(%d) %s + ["code"]=> + int(11000) + ["index"]=> + int(1) + ["info"]=> + NULL + } + } + ["writeConcernError"]=> + NULL + ["writeConcern"]=> + object(MongoDB\Driver\WriteConcern)#%d (0) { + } +} ===DONE=== diff --git a/tests/exception/commandexception-getresultdocument-001.phpt b/tests/exception/commandexception-getresultdocument-001.phpt index f8880cc20..40c8989f7 100644 --- a/tests/exception/commandexception-getresultdocument-001.phpt +++ b/tests/exception/commandexception-getresultdocument-001.phpt @@ -4,7 +4,7 @@ MongoDB\Driver\Exception\CommandException::getResultDocument() 1]; +$resultDocument = (object) ['x' => 1]; $reflection = new ReflectionClass($exception); diff --git a/tests/readConcern/readconcern-ctor_error-002.phpt b/tests/readConcern/readconcern-ctor_error-002.phpt index 48446ac70..7e142d738 100644 --- a/tests/readConcern/readconcern-ctor_error-002.phpt +++ b/tests/readConcern/readconcern-ctor_error-002.phpt @@ -15,15 +15,15 @@ $tests = [ foreach ($tests as $test) { echo throws(function() use ($test) { new MongoDB\Driver\ReadConcern($test); - }, 'MongoDB\Driver\Exception\InvalidArgumentException'), "\n"; + }, TypeError::class), "\n"; } ?> ===DONE=== --EXPECTF-- -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -%SMongoDB\Driver\ReadConcern::__construct()%sstring, array given -OK: Got MongoDB\Driver\Exception\InvalidArgumentException -%SMongoDB\Driver\ReadConcern::__construct()%sstring, %r(object|stdClass)%r given +OK: Got TypeError +%SMongoDB\Driver\ReadConcern::__construct()%sstring or null, array given +OK: Got TypeError +%SMongoDB\Driver\ReadConcern::__construct()%sstring or null, %r(object|stdClass)%r given ===DONE=== diff --git a/tests/session/session-advanceOperationTime-003.phpt b/tests/session/session-advanceOperationTime-003.phpt index 3c51346d6..3bcb5f88e 100644 --- a/tests/session/session-advanceOperationTime-003.phpt +++ b/tests/session/session-advanceOperationTime-003.phpt @@ -10,17 +10,17 @@ require_once __DIR__ . "/../utils/basic.inc"; class MyTimestamp implements MongoDB\BSON\TimestampInterface { - public function getIncrement() + public function getIncrement(): int { return 5678; } - public function getTimestamp() + public function getTimestamp(): int { return 1234; } - public function __toString() + public function __toString(): string { return sprintf('[%d:%d]', $this->getIncrement(), $this->getTimestamp()); } diff --git a/tests/session/session-advanceOperationTime_error-001.phpt b/tests/session/session-advanceOperationTime_error-001.phpt index 8192bfbf9..2cf429015 100644 --- a/tests/session/session-advanceOperationTime_error-001.phpt +++ b/tests/session/session-advanceOperationTime_error-001.phpt @@ -19,7 +19,7 @@ class MyTimestamp implements MongoDB\BSON\TimestampInterface $this->failTimestamp = $failTimestamp; } - public function getIncrement() + public function getIncrement(): int { if ($this->failIncrement) { throw new Exception('getIncrement() failed'); @@ -28,7 +28,7 @@ class MyTimestamp implements MongoDB\BSON\TimestampInterface return 5678; } - public function getTimestamp() + public function getTimestamp(): int { if ($this->failTimestamp) { throw new Exception('getTimestamp() failed'); @@ -37,7 +37,7 @@ class MyTimestamp implements MongoDB\BSON\TimestampInterface return 1234; } - public function __toString() + public function __toString(): string { return sprintf('[%d:%d]', $this->getIncrement(), $this->getTimestamp()); } diff --git a/tests/topologyDescription/topologyDescription-hasReadableServer_error-001.phpt b/tests/topologyDescription/topologyDescription-hasReadableServer_error-001.phpt index a278adaa7..a2e942bc8 100644 --- a/tests/topologyDescription/topologyDescription-hasReadableServer_error-001.phpt +++ b/tests/topologyDescription/topologyDescription-hasReadableServer_error-001.phpt @@ -44,7 +44,6 @@ class TopologyDescriptionProvider implements MongoDB\Driver\Monitoring\SDAMSubsc } $tests = [ - null, 1, [], ]; @@ -64,5 +63,4 @@ foreach ($tests as $test) { --EXPECT-- OK: Got TypeError OK: Got TypeError -OK: Got TypeError ===DONE=== From 1c670597629b815ebe25357ac65aebcf18229fc9 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Fri, 29 Jul 2022 14:45:56 +0200 Subject: [PATCH 16/26] Parse parameters in disabled constructor/wakup function --- php_phongo.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/php_phongo.h b/php_phongo.h index ecb74acdd..79b6cb3ac 100644 --- a/php_phongo.h +++ b/php_phongo.h @@ -112,12 +112,14 @@ zend_object_handlers* phongo_get_std_object_handlers(void); #define PHONGO_DISABLED_CONSTRUCTOR(classname) \ PHP_METHOD(classname, __construct) \ { \ + PHONGO_PARSE_PARAMETERS_NONE(); \ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Accessing private constructor"); \ } #define PHONGO_DISABLED_WAKEUP(classname) \ PHP_METHOD(classname, __wakeup) \ { \ + PHONGO_PARSE_PARAMETERS_NONE(); \ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "MongoDB\\Driver objects cannot be serialized"); \ } From fa78349376ecf810d458907545b68662b150d6a4 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Mon, 1 Aug 2022 09:18:53 +0200 Subject: [PATCH 17/26] Add note about arginfo files to contribution docs --- CONTRIBUTING.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9d16610ed..2d55529fd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,6 +21,13 @@ phpize > /dev/null && \ make clean > /dev/null && make all > /dev/null && make install ``` +## Generating arginfo from stub files + +Arginfo structures are generated from stub files using the `gen_stub.php` +file. Note that this requires `phpize` to be run for PHP 8.2 to make use +of all features. After changing a stub file, run `./build/gen_stub.php` +to regenerate the corresponding arginfo files and commit the results. + ## Testing The extension's test use the PHPT format from PHP internals. This format is From 4833b1bc79db41c591f0129deedd45eec6d9c750 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Mon, 1 Aug 2022 09:26:22 +0200 Subject: [PATCH 18/26] Add GitHub action to check generated arginfo files --- .github/workflows/arginfo-files.yml | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/arginfo-files.yml diff --git a/.github/workflows/arginfo-files.yml b/.github/workflows/arginfo-files.yml new file mode 100644 index 000000000..f47de21ae --- /dev/null +++ b/.github/workflows/arginfo-files.yml @@ -0,0 +1,45 @@ +name: "Check generated arginfo files" + +on: + pull_request: + branches: + - "v*.*" + - "master" + - "feature/*" + push: + branches: + - "v*.*" + - "master" + - "feature/*" + +jobs: + check-arginfo: + name: "Check generated arginfo files" + runs-on: "ubuntu-20.04" + + strategy: + matrix: + php-version: + - "8.2" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + with: + submodules: true + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + extensions: ":mongodb" + tools: "phpize" + + - name: "Run phpize" + run: phpize + + - name: "Rebuild arginfo files from stubs" + run: "php ./build/gen_stub.php" + + - name: "Check arginfo file diff" + run: git add . -N && git diff --exit-code From edde54c315036af46902ad0a63c80b7eb9b16b37 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Mon, 1 Aug 2022 12:22:16 +0200 Subject: [PATCH 19/26] PHPC-2115: Use DateTimeInterface in UTCDateTime constructor signature --- php_phongo.c | 6 ------ src/BSON/UTCDateTime.c | 6 ++---- src/BSON/UTCDateTime.stub.php | 4 ++-- src/BSON/UTCDateTime_arginfo.h | 4 ++-- src/phongo_classes.h | 1 - 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/php_phongo.c b/php_phongo.c index 7292a3447..e93f54c20 100644 --- a/php_phongo.c +++ b/php_phongo.c @@ -44,7 +44,6 @@ ZEND_TSRMLS_CACHE_DEFINE(); static int32_t phongo_num_threads = 0; /* Declare zend_class_entry dependencies, which are initialized in MINIT */ -zend_class_entry* php_phongo_date_immutable_ce; zend_class_entry* php_phongo_json_serializable_ce; /* {{{ phongo_std_object_handlers */ @@ -181,17 +180,12 @@ PHP_MINIT_FUNCTION(mongodb) /* {{{ */ phongo_std_object_handlers.get_gc = php_phongo_std_get_gc; /* Initialize zend_class_entry dependencies. - * - * Although DateTimeImmutable was introduced in PHP 5.5.0, - * php_date_get_immutable_ce() is not available in PHP versions before - * 5.5.24 and 5.6.8. * * Although JsonSerializable was introduced in PHP 5.4.0, * php_json_serializable_ce is not exported in PHP versions before 5.4.26 * and 5.5.10. For later PHP versions, looking up the class manually also * helps with distros that disable LTDL_LAZY for dlopen() (e.g. Fedora). */ - php_phongo_date_immutable_ce = php_phongo_fetch_internal_class(ZEND_STRL("datetimeimmutable")); php_phongo_json_serializable_ce = php_phongo_fetch_internal_class(ZEND_STRL("jsonserializable")); if (php_phongo_json_serializable_ce == NULL) { diff --git a/src/BSON/UTCDateTime.c b/src/BSON/UTCDateTime.c index b08054322..7056eee51 100644 --- a/src/BSON/UTCDateTime.c +++ b/src/BSON/UTCDateTime.c @@ -126,7 +126,7 @@ static HashTable* php_phongo_utcdatetime_get_properties_hash(phongo_compat_objec return props; } /* }}} */ -/* {{{ proto void MongoDB\BSON\UTCDateTime::__construct([int|float|string|DateTimeInterface $milliseconds = null]) +/* {{{ proto void MongoDB\BSON\UTCDateTime::__construct([int|float|string|DateTimeInterface|null $milliseconds = null]) Construct a new BSON UTCDateTime type from either the current time, milliseconds since the epoch, or a DateTimeInterface object. Defaults to the current time. */ @@ -148,9 +148,7 @@ static PHP_METHOD(MongoDB_BSON_UTCDateTime, __construct) } if (Z_TYPE_P(milliseconds) == IS_OBJECT) { - if (instanceof_function(Z_OBJCE_P(milliseconds), php_date_get_date_ce()) || - (php_phongo_date_immutable_ce && instanceof_function(Z_OBJCE_P(milliseconds), php_phongo_date_immutable_ce))) { - + if (instanceof_function(Z_OBJCE_P(milliseconds), php_date_get_interface_ce())) { php_phongo_utcdatetime_init_from_date(intern, Z_PHPDATE_P(milliseconds)); } else { phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected instance of DateTimeInterface, %s given", ZSTR_VAL(Z_OBJCE_P(milliseconds)->name)); diff --git a/src/BSON/UTCDateTime.stub.php b/src/BSON/UTCDateTime.stub.php index 4a856952a..b5ba5155d 100644 --- a/src/BSON/UTCDateTime.stub.php +++ b/src/BSON/UTCDateTime.stub.php @@ -10,9 +10,9 @@ final class UTCDateTime implements UTCDateTimeInterface, \JsonSerializable, Type, \Serializable { #if PHP_VERSION_ID >= 80000 - public final function __construct(int|string|float|\DateTime|\DateTimeImmutable|null $milliseconds = null) {} + public final function __construct(int|string|float|\DateTimeInterface|null $milliseconds = null) {} #else - /** @param int|string|float|\DateTime|\DateTimeImmutable|null $milliseconds */ + /** @param int|string|float|\DateTimeInterface|null $milliseconds */ public final function __construct($milliseconds = null) {} #endif diff --git a/src/BSON/UTCDateTime_arginfo.h b/src/BSON/UTCDateTime_arginfo.h index 0a3bd1be7..59e4d16c6 100644 --- a/src/BSON/UTCDateTime_arginfo.h +++ b/src/BSON/UTCDateTime_arginfo.h @@ -1,9 +1,9 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: dede7bbc4a90386a2fe9b891d1c3c7f1d19d4de9 */ + * Stub hash: 840ad5e10557cbc8d74bcd4c398581f69fd0b484 */ #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_BSON_UTCDateTime___construct, 0, 0, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, milliseconds, DateTime|DateTimeImmutable, MAY_BE_LONG|MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_NULL, "null") + ZEND_ARG_OBJ_TYPE_MASK(0, milliseconds, DateTimeInterface, MAY_BE_LONG|MAY_BE_STRING|MAY_BE_DOUBLE|MAY_BE_NULL, "null") ZEND_END_ARG_INFO() #endif diff --git a/src/phongo_classes.h b/src/phongo_classes.h index b304a6692..3d2a49e6e 100644 --- a/src/phongo_classes.h +++ b/src/phongo_classes.h @@ -20,7 +20,6 @@ #include "phongo_structs.h" /* Export zend_class_entry dependencies, which are initialized in MINIT */ -extern zend_class_entry* php_phongo_date_immutable_ce; extern zend_class_entry* php_phongo_json_serializable_ce; static inline php_phongo_bulkwrite_t* php_bulkwrite_fetch_object(zend_object* obj) From 767dd1a718b523edb4af23cfa30c8cf4f8c35ac1 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 2 Aug 2022 09:17:32 +0200 Subject: [PATCH 20/26] Don't install mongodb extension in GitHub actions workflows --- .github/workflows/arginfo-files.yml | 1 - .github/workflows/clang-format.yml | 1 - .github/workflows/tests.yml | 1 - 3 files changed, 3 deletions(-) diff --git a/.github/workflows/arginfo-files.yml b/.github/workflows/arginfo-files.yml index f47de21ae..95ab278d7 100644 --- a/.github/workflows/arginfo-files.yml +++ b/.github/workflows/arginfo-files.yml @@ -32,7 +32,6 @@ jobs: uses: "shivammathur/setup-php@v2" with: php-version: "${{ matrix.php-version }}" - extensions: ":mongodb" tools: "phpize" - name: "Run phpize" diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 72c162604..16fef612d 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -32,7 +32,6 @@ jobs: uses: "shivammathur/setup-php@v2" with: php-version: "${{ matrix.php-version }}" - extensions: ":mongodb" tools: "phpize" - name: "Configure driver" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 25fa7e71d..30fcaf853 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,7 +65,6 @@ jobs: uses: "shivammathur/setup-php@v2" with: php-version: "${{ matrix.php-version }}" - extensions: ":mongodb" tools: "phpize" - name: "Configure driver" From d4d1afe9109a4d9cc24989da7ba09cf55c24517e Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 2 Aug 2022 09:26:54 +0200 Subject: [PATCH 21/26] Change indentation in stub files --- src/MongoDB/BulkWrite.stub.php | 45 +++-- src/MongoDB/BulkWrite_arginfo.h | 2 +- src/MongoDB/ClientEncryption.stub.php | 85 ++++---- src/MongoDB/ClientEncryption_arginfo.h | 2 +- src/MongoDB/Command.stub.php | 13 +- src/MongoDB/Command_arginfo.h | 2 +- src/MongoDB/Cursor.stub.php | 33 ++-- src/MongoDB/CursorId.stub.php | 23 ++- src/MongoDB/CursorId_arginfo.h | 2 +- src/MongoDB/CursorInterface.stub.php | 27 ++- src/MongoDB/CursorInterface_arginfo.h | 2 +- src/MongoDB/Cursor_arginfo.h | 2 +- .../AuthenticationException.stub.php | 7 +- .../AuthenticationException_arginfo.h | 2 +- .../Exception/BulkWriteException.stub.php | 7 +- .../Exception/BulkWriteException_arginfo.h | 2 +- .../Exception/CommandException.stub.php | 13 +- .../Exception/CommandException_arginfo.h | 2 +- .../Exception/ConnectionException.stub.php | 7 +- .../Exception/ConnectionException_arginfo.h | 2 +- .../ConnectionTimeoutException.stub.php | 7 +- .../ConnectionTimeoutException_arginfo.h | 2 +- .../Exception/EncryptionException.stub.php | 8 +- .../Exception/EncryptionException_arginfo.h | 2 +- src/MongoDB/Exception/Exception.stub.php | 7 +- src/MongoDB/Exception/Exception_arginfo.h | 2 +- .../ExecutionTimeoutException.stub.php | 7 +- .../ExecutionTimeoutException_arginfo.h | 2 +- .../InvalidArgumentException.stub.php | 7 +- .../InvalidArgumentException_arginfo.h | 2 +- src/MongoDB/Exception/LogicException.stub.php | 7 +- .../Exception/LogicException_arginfo.h | 2 +- .../Exception/RuntimeException.stub.php | 13 +- .../Exception/RuntimeException_arginfo.h | 2 +- .../Exception/SSLConnectionException.stub.php | 7 +- .../SSLConnectionException_arginfo.h | 2 +- .../Exception/ServerException.stub.php | 7 +- .../Exception/ServerException_arginfo.h | 2 +- .../UnexpectedValueException.stub.php | 7 +- .../UnexpectedValueException_arginfo.h | 2 +- src/MongoDB/Exception/WriteException.stub.php | 13 +- .../Exception/WriteException_arginfo.h | 2 +- src/MongoDB/Manager.stub.php | 59 +++--- src/MongoDB/Manager_arginfo.h | 2 +- .../Monitoring/CommandFailedEvent.stub.php | 29 ++- .../Monitoring/CommandFailedEvent_arginfo.h | 2 +- .../Monitoring/CommandStartedEvent.stub.php | 27 ++- .../Monitoring/CommandStartedEvent_arginfo.h | 2 +- .../Monitoring/CommandSubscriber.stub.php | 19 +- .../Monitoring/CommandSubscriber_arginfo.h | 2 +- .../Monitoring/CommandSucceededEvent.stub.php | 27 ++- .../CommandSucceededEvent_arginfo.h | 2 +- .../Monitoring/SDAMSubscriber.stub.php | 43 ++-- .../Monitoring/SDAMSubscriber_arginfo.h | 2 +- .../Monitoring/ServerChangedEvent.stub.php | 21 +- .../Monitoring/ServerChangedEvent_arginfo.h | 2 +- .../Monitoring/ServerClosedEvent.stub.php | 17 +- .../Monitoring/ServerClosedEvent_arginfo.h | 2 +- .../ServerHeartbeatFailedEvent.stub.php | 21 +- .../ServerHeartbeatFailedEvent_arginfo.h | 2 +- .../ServerHeartbeatStartedEvent.stub.php | 17 +- .../ServerHeartbeatStartedEvent_arginfo.h | 2 +- .../ServerHeartbeatSucceededEvent.stub.php | 21 +- .../ServerHeartbeatSucceededEvent_arginfo.h | 2 +- .../Monitoring/ServerOpeningEvent.stub.php | 17 +- .../Monitoring/ServerOpeningEvent_arginfo.h | 2 +- src/MongoDB/Monitoring/Subscriber.stub.php | 7 +- src/MongoDB/Monitoring/Subscriber_arginfo.h | 2 +- .../Monitoring/TopologyChangedEvent.stub.php | 17 +- .../Monitoring/TopologyChangedEvent_arginfo.h | 2 +- .../Monitoring/TopologyClosedEvent.stub.php | 13 +- .../Monitoring/TopologyClosedEvent_arginfo.h | 2 +- .../Monitoring/TopologyOpeningEvent.stub.php | 13 +- .../Monitoring/TopologyOpeningEvent_arginfo.h | 2 +- src/MongoDB/Query.stub.php | 15 +- src/MongoDB/Query_arginfo.h | 2 +- src/MongoDB/ReadConcern.stub.php | 97 +++++----- src/MongoDB/ReadConcern_arginfo.h | 2 +- src/MongoDB/ReadPreference.stub.php | 183 +++++++++--------- src/MongoDB/ReadPreference_arginfo.h | 2 +- src/MongoDB/Server.stub.php | 179 +++++++++-------- src/MongoDB/ServerApi.stub.php | 31 ++- src/MongoDB/ServerApi_arginfo.h | 2 +- src/MongoDB/ServerDescription.stub.php | 153 ++++++++------- src/MongoDB/ServerDescription_arginfo.h | 2 +- src/MongoDB/Server_arginfo.h | 2 +- src/MongoDB/Session.stub.php | 105 +++++----- src/MongoDB/Session_arginfo.h | 2 +- src/MongoDB/TopologyDescription.stub.php | 97 +++++----- src/MongoDB/TopologyDescription_arginfo.h | 2 +- src/MongoDB/WriteConcern.stub.php | 53 +++-- src/MongoDB/WriteConcernError.stub.php | 17 +- src/MongoDB/WriteConcernError_arginfo.h | 2 +- src/MongoDB/WriteConcern_arginfo.h | 2 +- src/MongoDB/WriteError.stub.php | 19 +- src/MongoDB/WriteError_arginfo.h | 2 +- src/MongoDB/WriteResult.stub.php | 31 ++- src/MongoDB/WriteResult_arginfo.h | 2 +- 98 files changed, 874 insertions(+), 922 deletions(-) diff --git a/src/MongoDB/BulkWrite.stub.php b/src/MongoDB/BulkWrite.stub.php index e4a4ebd0e..a9137d969 100644 --- a/src/MongoDB/BulkWrite.stub.php +++ b/src/MongoDB/BulkWrite.stub.php @@ -5,35 +5,34 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class BulkWrite implements \Countable { - final class BulkWrite implements \Countable - { - public final function __construct(array $options = []) {} + public final function __construct(array $options = []) {} - public function count(): int {} + public function count(): int {} #if PHP_VERSION_ID >= 80000 - public function delete(array|object $filter, array $deleteOptions = []): void {} + public function delete(array|object $filter, array $deleteOptions = []): void {} - public final function insert(array|object $document): mixed {} + public final function insert(array|object $document): mixed {} - public function update(array|object $filter, array|object $newObj, array $updateOptions = []): void {} + public function update(array|object $filter, array|object $newObj, array $updateOptions = []): void {} #else - /** @param array|object $filter */ - public function delete($filter, array $deleteOptions = []): void {} - - /** - * @param array|object $document - * @return mixed - */ - public final function insert($document) {} - - /** - * @param array|object $filter - * @param array|object $newObj - */ - public function update($filter, $newObj, array $updateOptions = []): void {} + /** @param array|object $filter */ + public function delete($filter, array $deleteOptions = []): void {} + + /** + * @param array|object $document + * @return mixed + */ + public final function insert($document) {} + + /** + * @param array|object $filter + * @param array|object $newObj + */ + public function update($filter, $newObj, array $updateOptions = []): void {} #endif - } } diff --git a/src/MongoDB/BulkWrite_arginfo.h b/src/MongoDB/BulkWrite_arginfo.h index 291cfa7cd..09bea4f76 100644 --- a/src/MongoDB/BulkWrite_arginfo.h +++ b/src/MongoDB/BulkWrite_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ec9c23a8afe93c3ae9cd3c78733e67f808b48bcb */ + * Stub hash: 5b71b311ea4be170595b7616bf02af21b1379b1c */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") diff --git a/src/MongoDB/ClientEncryption.stub.php b/src/MongoDB/ClientEncryption.stub.php index 9d30eb31c..ccf22440b 100644 --- a/src/MongoDB/ClientEncryption.stub.php +++ b/src/MongoDB/ClientEncryption.stub.php @@ -5,54 +5,53 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class ClientEncryption { - final class ClientEncryption - { - /** - * @var string - * @cvalue MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC - */ - public const AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC = UNKNOWN; - - /** - * @var string - * @cvalue MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM - */ - public const AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM = UNKNOWN; - - /** - * @var string - * @cvalue MONGOC_ENCRYPT_ALGORITHM_INDEXED - */ - public const ALGORITHM_INDEXED = UNKNOWN; - - /** - * @var string - * @cvalue MONGOC_ENCRYPT_ALGORITHM_UNINDEXED - */ - public const ALGORITHM_UNINDEXED = UNKNOWN; - - /** - * @var string - * @cvalue MONGOC_ENCRYPT_QUERY_TYPE_EQUALITY - */ - public const QUERY_TYPE_EQUALITY = UNKNOWN; - - final public function __construct(array $options) {} - - final public function createDataKey(string $kmsProvider, array $options = []): \MongoDB\BSON\Binary {} + /** + * @var string + * @cvalue MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC + */ + public const AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC = UNKNOWN; + + /** + * @var string + * @cvalue MONGOC_AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM + */ + public const AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM = UNKNOWN; + + /** + * @var string + * @cvalue MONGOC_ENCRYPT_ALGORITHM_INDEXED + */ + public const ALGORITHM_INDEXED = UNKNOWN; + + /** + * @var string + * @cvalue MONGOC_ENCRYPT_ALGORITHM_UNINDEXED + */ + public const ALGORITHM_UNINDEXED = UNKNOWN; + + /** + * @var string + * @cvalue MONGOC_ENCRYPT_QUERY_TYPE_EQUALITY + */ + public const QUERY_TYPE_EQUALITY = UNKNOWN; + + final public function __construct(array $options) {} + + final public function createDataKey(string $kmsProvider, array $options = []): \MongoDB\BSON\Binary {} #if PHP_VERSION_ID >= 80000 - final public function decrypt(\MongoDB\BSON\Binary $value): mixed {} + final public function decrypt(\MongoDB\BSON\Binary $value): mixed {} - final public function encrypt(mixed $value, array $options = []): \MongoDB\BSON\Binary {} + final public function encrypt(mixed $value, array $options = []): \MongoDB\BSON\Binary {} #else - /** @return mixed */ - final public function decrypt(\MongoDB\BSON\Binary $value) {} + /** @return mixed */ + final public function decrypt(\MongoDB\BSON\Binary $value) {} - /** @param mixed $value */ - final public function encrypt($value, array $options = []): \MongoDB\BSON\Binary {} + /** @param mixed $value */ + final public function encrypt($value, array $options = []): \MongoDB\BSON\Binary {} #endif - } } diff --git a/src/MongoDB/ClientEncryption_arginfo.h b/src/MongoDB/ClientEncryption_arginfo.h index 8b3e42051..427992a0c 100644 --- a/src/MongoDB/ClientEncryption_arginfo.h +++ b/src/MongoDB/ClientEncryption_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 9ed4be3589f4aa9597adfc7104ab9c0f923d4c20 */ + * Stub hash: 8392a8f5e4e35893ddc65082a91cef47dde7facf */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0) diff --git a/src/MongoDB/Command.stub.php b/src/MongoDB/Command.stub.php index 0d53d38ae..16a1e192a 100644 --- a/src/MongoDB/Command.stub.php +++ b/src/MongoDB/Command.stub.php @@ -5,15 +5,14 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class Command { - final class Command - { #if PHP_VERSION_ID >= 80000 - final public function __construct(array|object $document, array $commandOptions = []) {} + final public function __construct(array|object $document, array $commandOptions = []) {} #else - /** @param array|object $document */ - final public function __construct($document, array $commandOptions = []) {} + /** @param array|object $document */ + final public function __construct($document, array $commandOptions = []) {} #endif - } } diff --git a/src/MongoDB/Command_arginfo.h b/src/MongoDB/Command_arginfo.h index 24b37309e..07460090b 100644 --- a/src/MongoDB/Command_arginfo.h +++ b/src/MongoDB/Command_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 4a6cf8ddc65e71bb5ba6f061b5129701ed49934f */ + * Stub hash: 7d4cd783815b6655add5530cfb6e4b085560687d */ #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Command___construct, 0, 0, 1) diff --git a/src/MongoDB/Cursor.stub.php b/src/MongoDB/Cursor.stub.php index 4166e7a7d..b0007046c 100644 --- a/src/MongoDB/Cursor.stub.php +++ b/src/MongoDB/Cursor.stub.php @@ -5,35 +5,34 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class Cursor implements \Iterator, CursorInterface { - final class Cursor implements \Iterator, CursorInterface - { - final private function __construct() {} + final private function __construct() {} #if PHP_VERSION_ID >= 80000 - public function current(): array|object|null {} + public function current(): array|object|null {} #else - /** @return array|object|null */ - public function current() {} + /** @return array|object|null */ + public function current() {} #endif - final public function getId(): CursorId {} + final public function getId(): CursorId {} - final public function getServer(): Server {} + final public function getServer(): Server {} - final public function isDead(): bool {} + final public function isDead(): bool {} - public function key(): ?int {} + public function key(): ?int {} - public function next(): void {} + public function next(): void {} - public function rewind(): void {} + public function rewind(): void {} - final public function setTypeMap(array $typemap): void {} + final public function setTypeMap(array $typemap): void {} - final public function toArray(): array {} + final public function toArray(): array {} - public function valid(): bool {} - } + public function valid(): bool {} } diff --git a/src/MongoDB/CursorId.stub.php b/src/MongoDB/CursorId.stub.php index 5270bc2d3..cb5543b8f 100644 --- a/src/MongoDB/CursorId.stub.php +++ b/src/MongoDB/CursorId.stub.php @@ -5,23 +5,22 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class CursorId implements \Serializable { - final class CursorId implements \Serializable - { - private final function __construct() {} + private final function __construct() {} - public static function __set_state(array $properties): CursorId {} + public static function __set_state(array $properties): CursorId {} - final public function __toString(): string {} + final public function __toString(): string {} - final public function serialize(): string {} + final public function serialize(): string {} - /** @param string $serialized */ - final public function unserialize($serialized): void {} + /** @param string $serialized */ + final public function unserialize($serialized): void {} - final public function __unserialize(array $data): void {} + final public function __unserialize(array $data): void {} - final public function __serialize(): array {} - } + final public function __serialize(): array {} } diff --git a/src/MongoDB/CursorId_arginfo.h b/src/MongoDB/CursorId_arginfo.h index 61b0e8ce2..e42d43cc4 100644 --- a/src/MongoDB/CursorId_arginfo.h +++ b/src/MongoDB/CursorId_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 4070f01bd322843b52b6086ca6af8b88a721acd9 */ + * Stub hash: da0685e03cb26f923e8fee5c93a7cf6f82641f40 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_CursorId___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/CursorInterface.stub.php b/src/MongoDB/CursorInterface.stub.php index 9ba9c07f7..112555e8b 100644 --- a/src/MongoDB/CursorInterface.stub.php +++ b/src/MongoDB/CursorInterface.stub.php @@ -5,23 +5,22 @@ * @generate-function-entries */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +interface CursorInterface extends \Traversable { - interface CursorInterface extends \Traversable - { - /** @tentative-return-type */ - public function getId(): CursorId; + /** @tentative-return-type */ + public function getId(): CursorId; - /** @tentative-return-type */ - public function getServer(): Server; + /** @tentative-return-type */ + public function getServer(): Server; - /** @tentative-return-type */ - public function isDead(): bool; + /** @tentative-return-type */ + public function isDead(): bool; - /** @tentative-return-type */ - public function setTypeMap(array $typemap): void; + /** @tentative-return-type */ + public function setTypeMap(array $typemap): void; - /** @tentative-return-type */ - public function toArray(): array; - } + /** @tentative-return-type */ + public function toArray(): array; } diff --git a/src/MongoDB/CursorInterface_arginfo.h b/src/MongoDB/CursorInterface_arginfo.h index 07ad6c740..5ebecdae3 100644 --- a/src/MongoDB/CursorInterface_arginfo.h +++ b/src/MongoDB/CursorInterface_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 54bb649a2d68fff4d9b05bae9a8e4f21d051cc86 */ + * Stub hash: 001f88edb710125420178d78e291fffc10bbfa1b */ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_CursorInterface_getId, 0, 0, MongoDB\\Driver\\CursorId, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Cursor_arginfo.h b/src/MongoDB/Cursor_arginfo.h index e8ce8b1e7..f8c14b9c9 100644 --- a/src/MongoDB/Cursor_arginfo.h +++ b/src/MongoDB/Cursor_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 717c37325f8163f830e30da1f9ea1371a3fe002d */ + * Stub hash: b94c509926df512855559d2c0ab4263b9d7dec63 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Cursor___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Exception/AuthenticationException.stub.php b/src/MongoDB/Exception/AuthenticationException.stub.php index 17fa68b05..a63b0f156 100644 --- a/src/MongoDB/Exception/AuthenticationException.stub.php +++ b/src/MongoDB/Exception/AuthenticationException.stub.php @@ -5,9 +5,8 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +class AuthenticationException extends ConnectionException { - class AuthenticationException extends ConnectionException - { - } } diff --git a/src/MongoDB/Exception/AuthenticationException_arginfo.h b/src/MongoDB/Exception/AuthenticationException_arginfo.h index b428c152c..10227d547 100644 --- a/src/MongoDB/Exception/AuthenticationException_arginfo.h +++ b/src/MongoDB/Exception/AuthenticationException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: fe7a688ceb0d1279b05338f8c92c4cbdfe6ff80b */ + * Stub hash: dfb57a5b65b8a075b239be872177213a182faf60 */ diff --git a/src/MongoDB/Exception/BulkWriteException.stub.php b/src/MongoDB/Exception/BulkWriteException.stub.php index 489add4ea..a8c562b0b 100644 --- a/src/MongoDB/Exception/BulkWriteException.stub.php +++ b/src/MongoDB/Exception/BulkWriteException.stub.php @@ -5,9 +5,8 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +class BulkWriteException extends WriteException { - class BulkWriteException extends WriteException - { - } } diff --git a/src/MongoDB/Exception/BulkWriteException_arginfo.h b/src/MongoDB/Exception/BulkWriteException_arginfo.h index 6eb41a33c..0646c0fc0 100644 --- a/src/MongoDB/Exception/BulkWriteException_arginfo.h +++ b/src/MongoDB/Exception/BulkWriteException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 4ffb6d0849ef79d13f83c3f61ca59adfa52e9016 */ + * Stub hash: 330d290dbbcd19c7f10afd7a08b3f57ad4497cd7 */ diff --git a/src/MongoDB/Exception/CommandException.stub.php b/src/MongoDB/Exception/CommandException.stub.php index f97b72c1d..5bca8fe42 100644 --- a/src/MongoDB/Exception/CommandException.stub.php +++ b/src/MongoDB/Exception/CommandException.stub.php @@ -5,13 +5,12 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +class CommandException extends ServerException { - class CommandException extends ServerException - { - /** @var object */ - protected $resultDocument; + /** @var object */ + protected $resultDocument; - final public function getResultDocument(): object {} - } + final public function getResultDocument(): object {} } diff --git a/src/MongoDB/Exception/CommandException_arginfo.h b/src/MongoDB/Exception/CommandException_arginfo.h index bbcadddb0..123e4daa6 100644 --- a/src/MongoDB/Exception/CommandException_arginfo.h +++ b/src/MongoDB/Exception/CommandException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 0ed4c93f7350ddb67ef6b481cf87a6e85d9e9c85 */ + * Stub hash: 55cb6773eee137316b8b5a78cd1050b061b2e24e */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Exception_CommandException_getResultDocument, 0, 0, IS_OBJECT, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Exception/ConnectionException.stub.php b/src/MongoDB/Exception/ConnectionException.stub.php index 43be5ccd1..74fc8401b 100644 --- a/src/MongoDB/Exception/ConnectionException.stub.php +++ b/src/MongoDB/Exception/ConnectionException.stub.php @@ -5,9 +5,8 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +class ConnectionException extends RuntimeException { - class ConnectionException extends RuntimeException - { - } } diff --git a/src/MongoDB/Exception/ConnectionException_arginfo.h b/src/MongoDB/Exception/ConnectionException_arginfo.h index f1c7b57d3..b1c7b6b8a 100644 --- a/src/MongoDB/Exception/ConnectionException_arginfo.h +++ b/src/MongoDB/Exception/ConnectionException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 40e103627b2d12301f87071e4bb06432fe34ef38 */ + * Stub hash: 722ab9f3f73ccb6493c68e6ce4ac888f1aec8955 */ diff --git a/src/MongoDB/Exception/ConnectionTimeoutException.stub.php b/src/MongoDB/Exception/ConnectionTimeoutException.stub.php index 6ececfe0c..aef91e752 100644 --- a/src/MongoDB/Exception/ConnectionTimeoutException.stub.php +++ b/src/MongoDB/Exception/ConnectionTimeoutException.stub.php @@ -5,9 +5,8 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +final class ConnectionTimeoutException extends ConnectionException { - final class ConnectionTimeoutException extends ConnectionException - { - } } diff --git a/src/MongoDB/Exception/ConnectionTimeoutException_arginfo.h b/src/MongoDB/Exception/ConnectionTimeoutException_arginfo.h index 4b37b1b27..c879338c1 100644 --- a/src/MongoDB/Exception/ConnectionTimeoutException_arginfo.h +++ b/src/MongoDB/Exception/ConnectionTimeoutException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3b2eb36849311de28b268c99eb32efc7df311497 */ + * Stub hash: 60470413296405ec96e76e4331835d8a27dd5ade */ diff --git a/src/MongoDB/Exception/EncryptionException.stub.php b/src/MongoDB/Exception/EncryptionException.stub.php index 9d27ac2fd..c0fa579ee 100644 --- a/src/MongoDB/Exception/EncryptionException.stub.php +++ b/src/MongoDB/Exception/EncryptionException.stub.php @@ -5,9 +5,9 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +class EncryptionException extends RuntimeException { - class EncryptionException extends RuntimeException - { - } } + diff --git a/src/MongoDB/Exception/EncryptionException_arginfo.h b/src/MongoDB/Exception/EncryptionException_arginfo.h index 320576275..ec5df7614 100644 --- a/src/MongoDB/Exception/EncryptionException_arginfo.h +++ b/src/MongoDB/Exception/EncryptionException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: b2aad1dc64819a9dbab4264d4da2d5674a857116 */ + * Stub hash: 432323bdeb13c6e1ce5e0201f0957290f412d26d */ diff --git a/src/MongoDB/Exception/Exception.stub.php b/src/MongoDB/Exception/Exception.stub.php index da2b2ffc0..f3cff6024 100644 --- a/src/MongoDB/Exception/Exception.stub.php +++ b/src/MongoDB/Exception/Exception.stub.php @@ -5,9 +5,8 @@ * @generate-function-entries */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +interface Exception extends \Throwable { - interface Exception extends \Throwable - { - } } diff --git a/src/MongoDB/Exception/Exception_arginfo.h b/src/MongoDB/Exception/Exception_arginfo.h index 9bc9fd860..d4a35cb39 100644 --- a/src/MongoDB/Exception/Exception_arginfo.h +++ b/src/MongoDB/Exception/Exception_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 40edf2bb7aece8bc438fb9039fc682b13bd9af01 */ + * Stub hash: 0e426c19c65154d51a01669619579b7ab2b7f60c */ diff --git a/src/MongoDB/Exception/ExecutionTimeoutException.stub.php b/src/MongoDB/Exception/ExecutionTimeoutException.stub.php index 2bb26f2d1..d1e67e5f0 100644 --- a/src/MongoDB/Exception/ExecutionTimeoutException.stub.php +++ b/src/MongoDB/Exception/ExecutionTimeoutException.stub.php @@ -5,9 +5,8 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +final class ExecutionTimeoutException extends ServerException { - final class ExecutionTimeoutException extends ServerException - { - } } diff --git a/src/MongoDB/Exception/ExecutionTimeoutException_arginfo.h b/src/MongoDB/Exception/ExecutionTimeoutException_arginfo.h index 5fd6438bf..76f6de25e 100644 --- a/src/MongoDB/Exception/ExecutionTimeoutException_arginfo.h +++ b/src/MongoDB/Exception/ExecutionTimeoutException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 03c4fbba5e52f76527bed3f0a9758d052aa6156b */ + * Stub hash: e152c0d8d8a6b9d5cd6f43479fb32972ecd585d5 */ diff --git a/src/MongoDB/Exception/InvalidArgumentException.stub.php b/src/MongoDB/Exception/InvalidArgumentException.stub.php index 22342247e..510ae77fc 100644 --- a/src/MongoDB/Exception/InvalidArgumentException.stub.php +++ b/src/MongoDB/Exception/InvalidArgumentException.stub.php @@ -5,9 +5,8 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +class InvalidArgumentException extends \InvalidArgumentException implements Exception { - class InvalidArgumentException extends \InvalidArgumentException implements Exception - { - } } diff --git a/src/MongoDB/Exception/InvalidArgumentException_arginfo.h b/src/MongoDB/Exception/InvalidArgumentException_arginfo.h index 1b2ab46f6..2948875cb 100644 --- a/src/MongoDB/Exception/InvalidArgumentException_arginfo.h +++ b/src/MongoDB/Exception/InvalidArgumentException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 6449ef13ea06c31ecfaaeda440ae737f893d08fa */ + * Stub hash: 275625c4d5dfb49b5608867b883711c5a4dc2057 */ diff --git a/src/MongoDB/Exception/LogicException.stub.php b/src/MongoDB/Exception/LogicException.stub.php index 8c3609f4d..ace77cf1b 100644 --- a/src/MongoDB/Exception/LogicException.stub.php +++ b/src/MongoDB/Exception/LogicException.stub.php @@ -5,9 +5,8 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +class LogicException extends \LogicException implements Exception { - class LogicException extends \LogicException implements Exception - { - } } diff --git a/src/MongoDB/Exception/LogicException_arginfo.h b/src/MongoDB/Exception/LogicException_arginfo.h index 4c61ac208..30c3eea9a 100644 --- a/src/MongoDB/Exception/LogicException_arginfo.h +++ b/src/MongoDB/Exception/LogicException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 9b0e9d5b1f67902502cd0d4ed8700e49e5ac9cc4 */ + * Stub hash: e3bbd956f358c9c22d22617be4d56c4018bd0441 */ diff --git a/src/MongoDB/Exception/RuntimeException.stub.php b/src/MongoDB/Exception/RuntimeException.stub.php index e3782cb07..cc0e7a426 100644 --- a/src/MongoDB/Exception/RuntimeException.stub.php +++ b/src/MongoDB/Exception/RuntimeException.stub.php @@ -5,13 +5,12 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +class RuntimeException extends \RuntimeException implements Exception { - class RuntimeException extends \RuntimeException implements Exception - { - /** @var bool */ - protected $errorLabels; + /** @var bool */ + protected $errorLabels; - final public function hasErrorLabel(string $errorLabel): bool {} - } + final public function hasErrorLabel(string $errorLabel): bool {} } diff --git a/src/MongoDB/Exception/RuntimeException_arginfo.h b/src/MongoDB/Exception/RuntimeException_arginfo.h index 034aeebd8..36ff63cfc 100644 --- a/src/MongoDB/Exception/RuntimeException_arginfo.h +++ b/src/MongoDB/Exception/RuntimeException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 87eef4019fdd539328d318869783f4b341caa792 */ + * Stub hash: c895df47a65fcadec95e6f0d4e3f98a0dae827d6 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Exception_RuntimeException_hasErrorLabel, 0, 1, _IS_BOOL, 0) ZEND_ARG_TYPE_INFO(0, errorLabel, IS_STRING, 0) diff --git a/src/MongoDB/Exception/SSLConnectionException.stub.php b/src/MongoDB/Exception/SSLConnectionException.stub.php index 7e238ad7d..5401b8844 100644 --- a/src/MongoDB/Exception/SSLConnectionException.stub.php +++ b/src/MongoDB/Exception/SSLConnectionException.stub.php @@ -5,9 +5,8 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +final class SSLConnectionException extends ConnectionException { - final class SSLConnectionException extends ConnectionException - { - } } diff --git a/src/MongoDB/Exception/SSLConnectionException_arginfo.h b/src/MongoDB/Exception/SSLConnectionException_arginfo.h index 587b6b732..668f79829 100644 --- a/src/MongoDB/Exception/SSLConnectionException_arginfo.h +++ b/src/MongoDB/Exception/SSLConnectionException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e3cc4f4277f2d94e7b02bf4d4d19ece6ed2b4279 */ + * Stub hash: 95855dc37941494d4bb81c28077c1fa79153d027 */ diff --git a/src/MongoDB/Exception/ServerException.stub.php b/src/MongoDB/Exception/ServerException.stub.php index cffe32b75..46ca310a7 100644 --- a/src/MongoDB/Exception/ServerException.stub.php +++ b/src/MongoDB/Exception/ServerException.stub.php @@ -5,9 +5,8 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +class ServerException extends RuntimeException { - class ServerException extends RuntimeException - { - } } diff --git a/src/MongoDB/Exception/ServerException_arginfo.h b/src/MongoDB/Exception/ServerException_arginfo.h index d247bb1b2..8d73cf6be 100644 --- a/src/MongoDB/Exception/ServerException_arginfo.h +++ b/src/MongoDB/Exception/ServerException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: d65173da597c4b41bdc980a3b1e6bbbbe132bc8f */ + * Stub hash: 62d8bf646599c54ba5a204b38042f80578435322 */ diff --git a/src/MongoDB/Exception/UnexpectedValueException.stub.php b/src/MongoDB/Exception/UnexpectedValueException.stub.php index 156119952..091b4f0d2 100644 --- a/src/MongoDB/Exception/UnexpectedValueException.stub.php +++ b/src/MongoDB/Exception/UnexpectedValueException.stub.php @@ -5,9 +5,8 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +class UnexpectedValueException extends \UnexpectedValueException implements Exception { - class UnexpectedValueException extends \UnexpectedValueException implements Exception - { - } } diff --git a/src/MongoDB/Exception/UnexpectedValueException_arginfo.h b/src/MongoDB/Exception/UnexpectedValueException_arginfo.h index de80c4a50..e9cfb0cc4 100644 --- a/src/MongoDB/Exception/UnexpectedValueException_arginfo.h +++ b/src/MongoDB/Exception/UnexpectedValueException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 9c6d689ac6d3ed6b5e2a0dffc38ca423b1d0eea4 */ + * Stub hash: 463206b30ddfa600327f4ba731476ab4196939de */ diff --git a/src/MongoDB/Exception/WriteException.stub.php b/src/MongoDB/Exception/WriteException.stub.php index 6dc7d4fb0..dc95a78b2 100644 --- a/src/MongoDB/Exception/WriteException.stub.php +++ b/src/MongoDB/Exception/WriteException.stub.php @@ -5,13 +5,12 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Exception +namespace MongoDB\Driver\Exception; + +abstract class WriteException extends RuntimeException { - abstract class WriteException extends RuntimeException - { - /** @var \MongoDB\Driver\WriteResult */ - protected $writeResult; + /** @var \MongoDB\Driver\WriteResult */ + protected $writeResult; - final public function getWriteResult(): \MongoDB\Driver\WriteResult {} - } + final public function getWriteResult(): \MongoDB\Driver\WriteResult {} } diff --git a/src/MongoDB/Exception/WriteException_arginfo.h b/src/MongoDB/Exception/WriteException_arginfo.h index 5e8cc8510..2692bac03 100644 --- a/src/MongoDB/Exception/WriteException_arginfo.h +++ b/src/MongoDB/Exception/WriteException_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: d09806b8d63899e3ea2d561f46cf16e173e3d968 */ + * Stub hash: 93ac52bdf35d69310a30f335be70489ba52edd51 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Exception_WriteException_getWriteResult, 0, 0, MongoDB\\Driver\\WriteResult, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Manager.stub.php b/src/MongoDB/Manager.stub.php index 37702b21e..5cb2bf0e2 100644 --- a/src/MongoDB/Manager.stub.php +++ b/src/MongoDB/Manager.stub.php @@ -5,60 +5,59 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class Manager { - final class Manager - { - final public function __construct(?string $uri = null, ?array $uriOptions = null, ?array $driverOptions = null) {} + final public function __construct(?string $uri = null, ?array $uriOptions = null, ?array $driverOptions = null) {} - final public function addSubscriber(Monitoring\Subscriber $subscriber): void {} + final public function addSubscriber(Monitoring\Subscriber $subscriber): void {} - final public function createClientEncryption(array $options): ClientEncryption {} + final public function createClientEncryption(array $options): ClientEncryption {} #if PHP_VERSION_ID >= 80000 - final public function executeBulkWrite(string $namespace, BulkWrite $bulk, array|WriteConcern|null $options = null): WriteResult {} + final public function executeBulkWrite(string $namespace, BulkWrite $bulk, array|WriteConcern|null $options = null): WriteResult {} - final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): Cursor {} + final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): Cursor {} - final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} + final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} #else - /** @param array|WriteConcern|null $options */ - final public function executeBulkWrite(string $namespace, BulkWrite $bulk, $options = null): WriteResult {} + /** @param array|WriteConcern|null $options */ + final public function executeBulkWrite(string $namespace, BulkWrite $bulk, $options = null): WriteResult {} - /** @param array|ReadPreference|null $options */ - final public function executeCommand(string $db, Command $command, $options = null): Cursor {} + /** @param array|ReadPreference|null $options */ + final public function executeCommand(string $db, Command $command, $options = null): Cursor {} - /** @param array|ReadPreference|null $options */ - final public function executeQuery(string $namespace, Query $query, $options = null): Cursor {} + /** @param array|ReadPreference|null $options */ + final public function executeQuery(string $namespace, Query $query, $options = null): Cursor {} #endif - final public function executeReadCommand(string $db, Command $command, array $options = []): Cursor {} + final public function executeReadCommand(string $db, Command $command, array $options = []): Cursor {} - final public function executeReadWriteCommand(string $db, Command $command, array $options = []): Cursor {} + final public function executeReadWriteCommand(string $db, Command $command, array $options = []): Cursor {} - final public function executeWriteCommand(string $db, Command $command, array $options = []): Cursor {} + final public function executeWriteCommand(string $db, Command $command, array $options = []): Cursor {} #if PHP_VERSION_ID >= 80000 - final public function getEncryptedFieldsMap(): array|object|null {} + final public function getEncryptedFieldsMap(): array|object|null {} #else - /** @return array|object|null */ - final public function getEncryptedFieldsMap() {} + /** @return array|object|null */ + final public function getEncryptedFieldsMap() {} #endif - final public function getReadConcern(): ReadConcern {} + final public function getReadConcern(): ReadConcern {} - final public function getReadPreference(): ReadPreference {} + final public function getReadPreference(): ReadPreference {} - final public function getServers(): array {} + final public function getServers(): array {} - final public function getWriteConcern(): WriteConcern {} + final public function getWriteConcern(): WriteConcern {} - final public function removeSubscriber(Monitoring\Subscriber $subscriber): void {} + final public function removeSubscriber(Monitoring\Subscriber $subscriber): void {} - final public function selectServer(?ReadPreference $readPreference = null): Server {} + final public function selectServer(?ReadPreference $readPreference = null): Server {} - final public function startSession(array $options = []): Session {} + final public function startSession(array $options = []): Session {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Manager_arginfo.h b/src/MongoDB/Manager_arginfo.h index 50aa26ad7..56313f22f 100644 --- a/src/MongoDB/Manager_arginfo.h +++ b/src/MongoDB/Manager_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7e357d21edd6839a1a7d80d75271be4b3c50231f */ + * Stub hash: c1c455c0a5c5622aa3ef8972f7911e653d01c997 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Manager___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, uri, IS_STRING, 1, "null") diff --git a/src/MongoDB/Monitoring/CommandFailedEvent.stub.php b/src/MongoDB/Monitoring/CommandFailedEvent.stub.php index 35cc819e6..56422072b 100644 --- a/src/MongoDB/Monitoring/CommandFailedEvent.stub.php +++ b/src/MongoDB/Monitoring/CommandFailedEvent.stub.php @@ -5,30 +5,29 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +final class CommandFailedEvent { - final class CommandFailedEvent - { - final private function __construct() {} + final private function __construct() {} - final public function getCommandName(): string {} + final public function getCommandName(): string {} - final public function getDurationMicros(): int {} + final public function getDurationMicros(): int {} - final public function getError(): \Throwable {} + final public function getError(): \Throwable {} - final public function getOperationId(): string {} + final public function getOperationId(): string {} - final public function getReply(): object {} + final public function getReply(): object {} - final public function getRequestId(): string {} + final public function getRequestId(): string {} - final public function getServer(): \MongoDB\Driver\Server {} + final public function getServer(): \MongoDB\Driver\Server {} - final public function getServiceId(): ?\MongoDB\BSON\ObjectId {} + final public function getServiceId(): ?\MongoDB\BSON\ObjectId {} - final public function getServerConnectionId(): ?int {} + final public function getServerConnectionId(): ?int {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h b/src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h index ab9ef8394..b17907ba2 100644 --- a/src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 5dfc42e8a80f3f8f2b42644403f2154a3fef5b6f */ + * Stub hash: 93e23af417425d45e8222ae0fd89b02ef5eb25a2 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Monitoring/CommandStartedEvent.stub.php b/src/MongoDB/Monitoring/CommandStartedEvent.stub.php index 557c7ba8c..c0f796eaf 100644 --- a/src/MongoDB/Monitoring/CommandStartedEvent.stub.php +++ b/src/MongoDB/Monitoring/CommandStartedEvent.stub.php @@ -5,28 +5,27 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +final class CommandStartedEvent { - final class CommandStartedEvent - { - final private function __construct() {} + final private function __construct() {} - final public function getCommand(): object {} + final public function getCommand(): object {} - final public function getCommandName(): string {} + final public function getCommandName(): string {} - final public function getDatabaseName(): string {} + final public function getDatabaseName(): string {} - final public function getOperationId(): string {} + final public function getOperationId(): string {} - final public function getRequestId(): string {} + final public function getRequestId(): string {} - final public function getServer(): \MongoDB\Driver\Server {} + final public function getServer(): \MongoDB\Driver\Server {} - final public function getServiceId(): ?\MongoDB\BSON\ObjectId {} + final public function getServiceId(): ?\MongoDB\BSON\ObjectId {} - final public function getServerConnectionId(): ?int {} + final public function getServerConnectionId(): ?int {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h b/src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h index 789d77ac4..5ff74db91 100644 --- a/src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 0d30dc31e8aa5fd29c7157b7483f09a704e9bfa7 */ + * Stub hash: 00e57d27ee9d61be1acc6913a97f7ee9b2394060 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Monitoring/CommandSubscriber.stub.php b/src/MongoDB/Monitoring/CommandSubscriber.stub.php index afbc5c6cb..587783241 100644 --- a/src/MongoDB/Monitoring/CommandSubscriber.stub.php +++ b/src/MongoDB/Monitoring/CommandSubscriber.stub.php @@ -5,17 +5,16 @@ * @generate-function-entries */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +interface CommandSubscriber extends Subscriber { - interface CommandSubscriber extends Subscriber - { - /** @tentative-return-type */ - public function commandStarted(CommandStartedEvent $event): void; + /** @tentative-return-type */ + public function commandStarted(CommandStartedEvent $event): void; - /** @tentative-return-type */ - public function commandSucceeded(CommandSucceededEvent $event): void; + /** @tentative-return-type */ + public function commandSucceeded(CommandSucceededEvent $event): void; - /** @tentative-return-type */ - public function commandFailed(CommandFailedEvent $event): void; - } + /** @tentative-return-type */ + public function commandFailed(CommandFailedEvent $event): void; } diff --git a/src/MongoDB/Monitoring/CommandSubscriber_arginfo.h b/src/MongoDB/Monitoring/CommandSubscriber_arginfo.h index 2433dcac9..de1b40e04 100644 --- a/src/MongoDB/Monitoring/CommandSubscriber_arginfo.h +++ b/src/MongoDB/Monitoring/CommandSubscriber_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: a0616fdba5c6bed6bd8a185ff493711483a6714d */ + * Stub hash: 3fb67ff709c10a3a2769af8572075da08cb100b4 */ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandSubscriber_commandStarted, 0, 1, IS_VOID, 0) ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\CommandStartedEvent, 0) diff --git a/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php b/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php index d60b5e148..a144392c6 100644 --- a/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php +++ b/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php @@ -5,28 +5,27 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +final class CommandSucceededEvent { - final class CommandSucceededEvent - { - final private function __construct() {} + final private function __construct() {} - final public function getCommandName(): string {} + final public function getCommandName(): string {} - final public function getDurationMicros(): int {} + final public function getDurationMicros(): int {} - final public function getOperationId(): string {} + final public function getOperationId(): string {} - final public function getReply(): object {} + final public function getReply(): object {} - final public function getRequestId(): string {} + final public function getRequestId(): string {} - final public function getServer(): \MongoDB\Driver\Server {} + final public function getServer(): \MongoDB\Driver\Server {} - final public function getServiceId(): ?\MongoDB\BSON\ObjectId {} + final public function getServiceId(): ?\MongoDB\BSON\ObjectId {} - final public function getServerConnectionId(): ?int {} + final public function getServerConnectionId(): ?int {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h b/src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h index eb1723445..d15b4b0b1 100644 --- a/src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h +++ b/src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c369196418ec5b97da5b9780db7ca59d8a56e247 */ + * Stub hash: 3df3433fd4acd7a35329f4d91f6f33b1a80fc360 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Monitoring/SDAMSubscriber.stub.php b/src/MongoDB/Monitoring/SDAMSubscriber.stub.php index 110e3c30a..ab4dfa492 100644 --- a/src/MongoDB/Monitoring/SDAMSubscriber.stub.php +++ b/src/MongoDB/Monitoring/SDAMSubscriber.stub.php @@ -5,35 +5,34 @@ * @generate-function-entries */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +interface SDAMSubscriber extends Subscriber { - interface SDAMSubscriber extends Subscriber - { - /** @tentative-return-type */ - public function serverChanged(ServerChangedEvent $event): void; + /** @tentative-return-type */ + public function serverChanged(ServerChangedEvent $event): void; - /** @tentative-return-type */ - public function serverClosed(ServerClosedEvent $event): void; + /** @tentative-return-type */ + public function serverClosed(ServerClosedEvent $event): void; - /** @tentative-return-type */ - public function serverOpening(ServerOpeningEvent $event): void; + /** @tentative-return-type */ + public function serverOpening(ServerOpeningEvent $event): void; - /** @tentative-return-type */ - public function serverHeartbeatFailed(ServerHeartbeatFailedEvent $event): void; + /** @tentative-return-type */ + public function serverHeartbeatFailed(ServerHeartbeatFailedEvent $event): void; - /** @tentative-return-type */ - public function serverHeartbeatStarted(ServerHeartbeatStartedEvent $event): void; + /** @tentative-return-type */ + public function serverHeartbeatStarted(ServerHeartbeatStartedEvent $event): void; - /** @tentative-return-type */ - public function serverHeartbeatSucceeded(ServerHeartbeatSucceededEvent $event): void; + /** @tentative-return-type */ + public function serverHeartbeatSucceeded(ServerHeartbeatSucceededEvent $event): void; - /** @tentative-return-type */ - public function topologyChanged(TopologyChangedEvent $event): void; + /** @tentative-return-type */ + public function topologyChanged(TopologyChangedEvent $event): void; - /** @tentative-return-type */ - public function topologyClosed(TopologyClosedEvent $event): void; + /** @tentative-return-type */ + public function topologyClosed(TopologyClosedEvent $event): void; - /** @tentative-return-type */ - public function topologyOpening(TopologyOpeningEvent $event): void; - } + /** @tentative-return-type */ + public function topologyOpening(TopologyOpeningEvent $event): void; } diff --git a/src/MongoDB/Monitoring/SDAMSubscriber_arginfo.h b/src/MongoDB/Monitoring/SDAMSubscriber_arginfo.h index 1f27e2d70..bd830dffe 100644 --- a/src/MongoDB/Monitoring/SDAMSubscriber_arginfo.h +++ b/src/MongoDB/Monitoring/SDAMSubscriber_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c3d297c7fa4e1baa82b69be11838921fad519816 */ + * Stub hash: 19ae065e2a8ad6c8f4945262d6cf58ea723e5aed */ ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_SDAMSubscriber_serverChanged, 0, 1, IS_VOID, 0) ZEND_ARG_OBJ_INFO(0, event, MongoDB\\Driver\\Monitoring\\ServerChangedEvent, 0) diff --git a/src/MongoDB/Monitoring/ServerChangedEvent.stub.php b/src/MongoDB/Monitoring/ServerChangedEvent.stub.php index a18086473..681db7e94 100644 --- a/src/MongoDB/Monitoring/ServerChangedEvent.stub.php +++ b/src/MongoDB/Monitoring/ServerChangedEvent.stub.php @@ -5,22 +5,21 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +final class ServerChangedEvent { - final class ServerChangedEvent - { - final private function __construct() {} + final private function __construct() {} - final public function getPort(): int {} + final public function getPort(): int {} - final public function getHost(): string {} + final public function getHost(): string {} - final public function getNewDescription(): \MongoDB\Driver\ServerDescription {} + final public function getNewDescription(): \MongoDB\Driver\ServerDescription {} - final public function getPreviousDescription(): \MongoDB\Driver\ServerDescription {} + final public function getPreviousDescription(): \MongoDB\Driver\ServerDescription {} - final public function getTopologyId(): \MongoDB\BSON\ObjectId {} + final public function getTopologyId(): \MongoDB\BSON\ObjectId {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Monitoring/ServerChangedEvent_arginfo.h b/src/MongoDB/Monitoring/ServerChangedEvent_arginfo.h index bbbc106fb..11d0179aa 100644 --- a/src/MongoDB/Monitoring/ServerChangedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/ServerChangedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: cdf0ea8dc23dc1d081c8b8d5eb9872c9df177ed1 */ + * Stub hash: 7eb7233a6a75c523ac6201583832d053ad1f3bc8 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_ServerChangedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Monitoring/ServerClosedEvent.stub.php b/src/MongoDB/Monitoring/ServerClosedEvent.stub.php index fbcaaabf6..7065b21cc 100644 --- a/src/MongoDB/Monitoring/ServerClosedEvent.stub.php +++ b/src/MongoDB/Monitoring/ServerClosedEvent.stub.php @@ -5,18 +5,17 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +final class ServerClosedEvent { - final class ServerClosedEvent - { - final private function __construct() {} + final private function __construct() {} - final public function getPort(): int {} + final public function getPort(): int {} - final public function getHost(): string {} + final public function getHost(): string {} - final public function getTopologyId(): \MongoDB\BSON\ObjectId {} + final public function getTopologyId(): \MongoDB\BSON\ObjectId {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Monitoring/ServerClosedEvent_arginfo.h b/src/MongoDB/Monitoring/ServerClosedEvent_arginfo.h index 360547955..3ee3ad3dc 100644 --- a/src/MongoDB/Monitoring/ServerClosedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/ServerClosedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 0fa0954d3f4101726f713df33d1a4c93b0405136 */ + * Stub hash: f4e790f6c43bb1cdbb24ad2d8755a7bb66d2c3a6 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_ServerClosedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.stub.php b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.stub.php index caa212fe8..ddda55609 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.stub.php +++ b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.stub.php @@ -5,22 +5,21 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +final class ServerHeartbeatFailedEvent { - final class ServerHeartbeatFailedEvent - { - final private function __construct() {} + final private function __construct() {} - final public function getDurationMicros() : int{} + final public function getDurationMicros() : int{} - final public function getError(): \Throwable {} + final public function getError(): \Throwable {} - final public function getPort(): int {} + final public function getPort(): int {} - final public function getHost(): string {} + final public function getHost(): string {} - final public function isAwaited(): bool {} + final public function isAwaited(): bool {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent_arginfo.h b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent_arginfo.h index 4c51a4027..214a48a3a 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/ServerHeartbeatFailedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e2534b685e4173cb232ad7c46ad0ba269ac6dcdf */ + * Stub hash: b8fb8dfe7e269cc0737210f5f2e92fd5359728eb */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_ServerHeartbeatFailedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.stub.php b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.stub.php index 75153cf4d..0ab363b91 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.stub.php +++ b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.stub.php @@ -5,18 +5,17 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +final class ServerHeartbeatStartedEvent { - final class ServerHeartbeatStartedEvent - { - final private function __construct() {} + final private function __construct() {} - final public function getPort(): int {} + final public function getPort(): int {} - final public function getHost(): string {} + final public function getHost(): string {} - final public function isAwaited(): bool {} + final public function isAwaited(): bool {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent_arginfo.h b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent_arginfo.h index 10b6eae1e..d27997110 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/ServerHeartbeatStartedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3a4ef8d389ef69e167171b578215b817f89ced1d */ + * Stub hash: 34ef69214b7b726a4b3a28a364cc0df4960c2c3c */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_ServerHeartbeatStartedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.stub.php b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.stub.php index f7fa3bb77..98ba6b24b 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.stub.php +++ b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.stub.php @@ -5,22 +5,21 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +final class ServerHeartbeatSucceededEvent { - final class ServerHeartbeatSucceededEvent - { - final private function __construct() {} + final private function __construct() {} - final public function getDurationMicros() : int{} + final public function getDurationMicros() : int{} - final public function getReply(): object {} + final public function getReply(): object {} - final public function getPort(): int {} + final public function getPort(): int {} - final public function getHost(): string {} + final public function getHost(): string {} - final public function isAwaited(): bool {} + final public function isAwaited(): bool {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent_arginfo.h b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent_arginfo.h index d31da21b8..c1d0ecde6 100644 --- a/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent_arginfo.h +++ b/src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: afb666c3c9e448379316a833084777f0c122838a */ + * Stub hash: a0d52df5d6fc354171792421cdad019ef5f95a0b */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_ServerHeartbeatSucceededEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Monitoring/ServerOpeningEvent.stub.php b/src/MongoDB/Monitoring/ServerOpeningEvent.stub.php index b32facb8a..bafa68ca8 100644 --- a/src/MongoDB/Monitoring/ServerOpeningEvent.stub.php +++ b/src/MongoDB/Monitoring/ServerOpeningEvent.stub.php @@ -5,18 +5,17 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +final class ServerOpeningEvent { - final class ServerOpeningEvent - { - final private function __construct() {} + final private function __construct() {} - final public function getPort(): int {} + final public function getPort(): int {} - final public function getHost(): string {} + final public function getHost(): string {} - final public function getTopologyId(): \MongoDB\BSON\ObjectId {} + final public function getTopologyId(): \MongoDB\BSON\ObjectId {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Monitoring/ServerOpeningEvent_arginfo.h b/src/MongoDB/Monitoring/ServerOpeningEvent_arginfo.h index 985f52356..e49ec03d1 100644 --- a/src/MongoDB/Monitoring/ServerOpeningEvent_arginfo.h +++ b/src/MongoDB/Monitoring/ServerOpeningEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 41da2f91f029194b348980dcc27076b1a20b6ae8 */ + * Stub hash: 6099b3429fb14cdb7ea618302fb1270e9c5011f0 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_ServerOpeningEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Monitoring/Subscriber.stub.php b/src/MongoDB/Monitoring/Subscriber.stub.php index 9a0052012..658b182e1 100644 --- a/src/MongoDB/Monitoring/Subscriber.stub.php +++ b/src/MongoDB/Monitoring/Subscriber.stub.php @@ -5,9 +5,8 @@ * @generate-function-entries */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +interface Subscriber { - interface Subscriber - { - } } diff --git a/src/MongoDB/Monitoring/Subscriber_arginfo.h b/src/MongoDB/Monitoring/Subscriber_arginfo.h index ee694dc60..8f5fef74b 100644 --- a/src/MongoDB/Monitoring/Subscriber_arginfo.h +++ b/src/MongoDB/Monitoring/Subscriber_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: f55238f976789ad8d46de70a8a572bd7c5ea59be */ + * Stub hash: f2e7d8f61aa5359716d9c2186c24ba68db5e96b4 */ diff --git a/src/MongoDB/Monitoring/TopologyChangedEvent.stub.php b/src/MongoDB/Monitoring/TopologyChangedEvent.stub.php index 04fb950b7..ed55a48a8 100644 --- a/src/MongoDB/Monitoring/TopologyChangedEvent.stub.php +++ b/src/MongoDB/Monitoring/TopologyChangedEvent.stub.php @@ -5,18 +5,17 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +final class TopologyChangedEvent { - final class TopologyChangedEvent - { - final private function __construct() {} + final private function __construct() {} - final public function getNewDescription(): \MongoDB\Driver\TopologyDescription {} + final public function getNewDescription(): \MongoDB\Driver\TopologyDescription {} - final public function getPreviousDescription(): \MongoDB\Driver\TopologyDescription {} + final public function getPreviousDescription(): \MongoDB\Driver\TopologyDescription {} - final public function getTopologyId(): \MongoDB\BSON\ObjectId {} + final public function getTopologyId(): \MongoDB\BSON\ObjectId {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Monitoring/TopologyChangedEvent_arginfo.h b/src/MongoDB/Monitoring/TopologyChangedEvent_arginfo.h index b3471dc3a..dd07325d2 100644 --- a/src/MongoDB/Monitoring/TopologyChangedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/TopologyChangedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 3067017ab97a4ff91614efc776291e01e48024d1 */ + * Stub hash: 446b61c79dc90b1d153ad449d4026c8c90619144 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_TopologyChangedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Monitoring/TopologyClosedEvent.stub.php b/src/MongoDB/Monitoring/TopologyClosedEvent.stub.php index 93f4dc596..039168b42 100644 --- a/src/MongoDB/Monitoring/TopologyClosedEvent.stub.php +++ b/src/MongoDB/Monitoring/TopologyClosedEvent.stub.php @@ -5,14 +5,13 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +final class TopologyClosedEvent { - final class TopologyClosedEvent - { - final private function __construct() {} + final private function __construct() {} - final public function getTopologyId(): \MongoDB\BSON\ObjectId {} + final public function getTopologyId(): \MongoDB\BSON\ObjectId {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Monitoring/TopologyClosedEvent_arginfo.h b/src/MongoDB/Monitoring/TopologyClosedEvent_arginfo.h index f87f1159a..4dfdffa3a 100644 --- a/src/MongoDB/Monitoring/TopologyClosedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/TopologyClosedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c415fcd57a020f6a7daefe55b1f093ee39684905 */ + * Stub hash: ce96aca6a81d1806e807d7a9f68dd6648872d80f */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_TopologyClosedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Monitoring/TopologyOpeningEvent.stub.php b/src/MongoDB/Monitoring/TopologyOpeningEvent.stub.php index 3cdcb3c06..2070ad11e 100644 --- a/src/MongoDB/Monitoring/TopologyOpeningEvent.stub.php +++ b/src/MongoDB/Monitoring/TopologyOpeningEvent.stub.php @@ -5,14 +5,13 @@ * @generate-function-entries static */ -namespace MongoDB\Driver\Monitoring +namespace MongoDB\Driver\Monitoring; + +final class TopologyOpeningEvent { - final class TopologyOpeningEvent - { - final private function __construct() {} + final private function __construct() {} - final public function getTopologyId(): \MongoDB\BSON\ObjectId {} + final public function getTopologyId(): \MongoDB\BSON\ObjectId {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Monitoring/TopologyOpeningEvent_arginfo.h b/src/MongoDB/Monitoring/TopologyOpeningEvent_arginfo.h index 6615e9301..7a6a577e3 100644 --- a/src/MongoDB/Monitoring/TopologyOpeningEvent_arginfo.h +++ b/src/MongoDB/Monitoring/TopologyOpeningEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: e1c9b1dbec4482fced6a1cb98e3b534ce05853e9 */ + * Stub hash: c72765c39e5f012ef819de515e42aa04bd19434b */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_TopologyOpeningEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Query.stub.php b/src/MongoDB/Query.stub.php index 143554aee..de08e6616 100644 --- a/src/MongoDB/Query.stub.php +++ b/src/MongoDB/Query.stub.php @@ -5,17 +5,16 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class Query { - final class Query - { #if PHP_VERSION_ID >= 80000 - final public function __construct(array|object $filter, array $queryOptions = []) {} + final public function __construct(array|object $filter, array $queryOptions = []) {} #else - /** @param array|object $filter */ - final public function __construct($filter, array $queryOptions = []) {} + /** @param array|object $filter */ + final public function __construct($filter, array $queryOptions = []) {} #endif - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Query_arginfo.h b/src/MongoDB/Query_arginfo.h index 3576ace0b..ab5951444 100644 --- a/src/MongoDB/Query_arginfo.h +++ b/src/MongoDB/Query_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 4c8de9c6f7a77a5428000f1843395a950c97f279 */ + * Stub hash: eac6cad75d3e8db014b69888b0d139d09cc5c51e */ #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Query___construct, 0, 0, 1) diff --git a/src/MongoDB/ReadConcern.stub.php b/src/MongoDB/ReadConcern.stub.php index 7584eb1da..310488ec7 100644 --- a/src/MongoDB/ReadConcern.stub.php +++ b/src/MongoDB/ReadConcern.stub.php @@ -5,63 +5,62 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class ReadConcern implements \MongoDB\BSON\Serializable, \Serializable { - final class ReadConcern implements \MongoDB\BSON\Serializable, \Serializable - { - /** - * @var string - * @cvalue MONGOC_READ_CONCERN_LEVEL_LINEARIZABLE - */ - public const LINEARIZABLE = UNKNOWN; - - /** - * @var string - * @cvalue MONGOC_READ_CONCERN_LEVEL_LOCAL - */ - public const LOCAL = UNKNOWN; - - /** - * @var string - * @cvalue MONGOC_READ_CONCERN_LEVEL_MAJORITY - */ - public const MAJORITY = UNKNOWN; - - /** - * @var string - * @cvalue MONGOC_READ_CONCERN_LEVEL_AVAILABLE - */ - public const AVAILABLE = UNKNOWN; - - /** - * @var string - * @cvalue MONGOC_READ_CONCERN_LEVEL_SNAPSHOT - */ - public const SNAPSHOT = UNKNOWN; - - final public function __construct(?string $level = null) {} - - final public function getLevel(): ?string {} - - final public function isDefault(): bool {} - - public static function __set_state(array $properties): ReadConcern {} + /** + * @var string + * @cvalue MONGOC_READ_CONCERN_LEVEL_LINEARIZABLE + */ + public const LINEARIZABLE = UNKNOWN; + + /** + * @var string + * @cvalue MONGOC_READ_CONCERN_LEVEL_LOCAL + */ + public const LOCAL = UNKNOWN; + + /** + * @var string + * @cvalue MONGOC_READ_CONCERN_LEVEL_MAJORITY + */ + public const MAJORITY = UNKNOWN; + + /** + * @var string + * @cvalue MONGOC_READ_CONCERN_LEVEL_AVAILABLE + */ + public const AVAILABLE = UNKNOWN; + + /** + * @var string + * @cvalue MONGOC_READ_CONCERN_LEVEL_SNAPSHOT + */ + public const SNAPSHOT = UNKNOWN; + + final public function __construct(?string $level = null) {} + + final public function getLevel(): ?string {} + + final public function isDefault(): bool {} + + public static function __set_state(array $properties): ReadConcern {} #if PHP_VERSION_ID >= 80000 - final public function bsonSerialize(): array|object {} + final public function bsonSerialize(): array|object {} #else - /** @return array|object */ - final public function bsonSerialize() {} + /** @return array|object */ + final public function bsonSerialize() {} #endif - final public function serialize(): string {} + final public function serialize(): string {} - /** @param string $serialized */ - final public function unserialize($serialized): void {} + /** @param string $serialized */ + final public function unserialize($serialized): void {} - final public function __unserialize(array $data): void {} + final public function __unserialize(array $data): void {} - final public function __serialize(): array {} + final public function __serialize(): array {} - } } diff --git a/src/MongoDB/ReadConcern_arginfo.h b/src/MongoDB/ReadConcern_arginfo.h index 6094d465b..40563ad4a 100644 --- a/src/MongoDB/ReadConcern_arginfo.h +++ b/src/MongoDB/ReadConcern_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 2b46ec105aab22bdcad264fa797d7f59a60aec22 */ + * Stub hash: 6b585fffb9a004ecfafc46c9e1fb60a73f8536a9 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, level, IS_STRING, 1, "null") diff --git a/src/MongoDB/ReadPreference.stub.php b/src/MongoDB/ReadPreference.stub.php index 843209c15..2ef7d4ee4 100644 --- a/src/MongoDB/ReadPreference.stub.php +++ b/src/MongoDB/ReadPreference.stub.php @@ -5,115 +5,114 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class ReadPreference implements \MongoDB\BSON\Serializable, \Serializable { - final class ReadPreference implements \MongoDB\BSON\Serializable, \Serializable - { - /** - * @var int - * @cvalue MONGOC_READ_PRIMARY - */ - public const RP_PRIMARY = UNKNOWN; - - /** - * @var int - * @cvalue MONGOC_READ_PRIMARY_PREFERRED - */ - public const RP_PRIMARY_PREFERRED = UNKNOWN; - - /** - * @var int - * @cvalue MONGOC_READ_SECONDARY - */ - public const RP_SECONDARY = UNKNOWN; - - /** - * @var int - * @cvalue MONGOC_READ_SECONDARY_PREFERRED - */ - public const RP_SECONDARY_PREFERRED = UNKNOWN; - - /** - * @var int - * @cvalue MONGOC_READ_NEAREST - */ - public const RP_NEAREST = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_READ_PRIMARY - */ - public const PRIMARY = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_READ_PRIMARY_PREFERRED - */ - public const PRIMARY_PREFERRED = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_READ_SECONDARY - */ - public const SECONDARY = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_READ_SECONDARY_PREFERRED - */ - public const SECONDARY_PREFERRED = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_READ_NEAREST - */ - public const NEAREST = UNKNOWN; - - /** - * @var int - * @cvalue MONGOC_NO_MAX_STALENESS - */ - public const NO_MAX_STALENESS = UNKNOWN; - - /** - * @var int - * @cvalue MONGOC_SMALLEST_MAX_STALENESS_SECONDS - */ - public const SMALLEST_MAX_STALENESS_SECONDS = UNKNOWN; + /** + * @var int + * @cvalue MONGOC_READ_PRIMARY + */ + public const RP_PRIMARY = UNKNOWN; + + /** + * @var int + * @cvalue MONGOC_READ_PRIMARY_PREFERRED + */ + public const RP_PRIMARY_PREFERRED = UNKNOWN; + + /** + * @var int + * @cvalue MONGOC_READ_SECONDARY + */ + public const RP_SECONDARY = UNKNOWN; + + /** + * @var int + * @cvalue MONGOC_READ_SECONDARY_PREFERRED + */ + public const RP_SECONDARY_PREFERRED = UNKNOWN; + + /** + * @var int + * @cvalue MONGOC_READ_NEAREST + */ + public const RP_NEAREST = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_READ_PRIMARY + */ + public const PRIMARY = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_READ_PRIMARY_PREFERRED + */ + public const PRIMARY_PREFERRED = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_READ_SECONDARY + */ + public const SECONDARY = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_READ_SECONDARY_PREFERRED + */ + public const SECONDARY_PREFERRED = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_READ_NEAREST + */ + public const NEAREST = UNKNOWN; + + /** + * @var int + * @cvalue MONGOC_NO_MAX_STALENESS + */ + public const NO_MAX_STALENESS = UNKNOWN; + + /** + * @var int + * @cvalue MONGOC_SMALLEST_MAX_STALENESS_SECONDS + */ + public const SMALLEST_MAX_STALENESS_SECONDS = UNKNOWN; #if PHP_VERSION_ID >= 80000 - final public function __construct(string|int $mode, ?array $tagSets = null, ?array $options = null) {} + final public function __construct(string|int $mode, ?array $tagSets = null, ?array $options = null) {} #else - /** @param string|int $mode */ - final public function __construct($mode, ?array $tagSets = null, ?array $options = null) {} + /** @param string|int $mode */ + final public function __construct($mode, ?array $tagSets = null, ?array $options = null) {} #endif - final public function getHedge(): ?object {} + final public function getHedge(): ?object {} - final public function getMaxStalenessSeconds(): int {} + final public function getMaxStalenessSeconds(): int {} - final public function getMode(): int {} + final public function getMode(): int {} - final public function getModeString(): string {} + final public function getModeString(): string {} - final public function getTagSets(): array {} + final public function getTagSets(): array {} - public static function __set_state(array $properties): ReadPreference {} + public static function __set_state(array $properties): ReadPreference {} #if PHP_VERSION_ID >= 80000 - final public function bsonSerialize(): array|object {} + final public function bsonSerialize(): array|object {} #else - /** @return array|object */ - final public function bsonSerialize() {} + /** @return array|object */ + final public function bsonSerialize() {} #endif - final public function serialize(): string {} + final public function serialize(): string {} - /** @param string $serialized */ - final public function unserialize($serialized): void {} + /** @param string $serialized */ + final public function unserialize($serialized): void {} - final public function __unserialize(array $data): void {} + final public function __unserialize(array $data): void {} - final public function __serialize(): array {} - } + final public function __serialize(): array {} } diff --git a/src/MongoDB/ReadPreference_arginfo.h b/src/MongoDB/ReadPreference_arginfo.h index b828653cc..47cc7c413 100644 --- a/src/MongoDB/ReadPreference_arginfo.h +++ b/src/MongoDB/ReadPreference_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 6b082596f6c7ba630d8b1dca86c89dff94968691 */ + * Stub hash: ed8a570b0c805aec5562830088257ff92068a721 */ #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference___construct, 0, 0, 1) diff --git a/src/MongoDB/Server.stub.php b/src/MongoDB/Server.stub.php index 6ed1b81f8..20ff03bcd 100644 --- a/src/MongoDB/Server.stub.php +++ b/src/MongoDB/Server.stub.php @@ -5,119 +5,118 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class Server { - final class Server - { - /** - * @var int - * @cvalue PHONGO_SERVER_UNKNOWN - */ - public const TYPE_UNKNOWN = UNKNOWN; - - /** - * @var int - * @cvalue PHONGO_SERVER_STANDALONE - */ - public const TYPE_STANDALONE = UNKNOWN; - - /** - * @var int - * @cvalue PHONGO_SERVER_MONGOS - */ - public const TYPE_MONGOS = UNKNOWN; - - /** - * @var int - * @cvalue PHONGO_SERVER_POSSIBLE_PRIMARY - */ - public const TYPE_POSSIBLE_PRIMARY = UNKNOWN; - - /** - * @var int - * @cvalue PHONGO_SERVER_RS_PRIMARY - */ - public const TYPE_RS_PRIMARY = UNKNOWN; - - /** - * @var int - * @cvalue PHONGO_SERVER_RS_SECONDARY - */ - public const TYPE_RS_SECONDARY = UNKNOWN; - - /** - * @var int - * @cvalue PHONGO_SERVER_RS_ARBITER - */ - public const TYPE_RS_ARBITER = UNKNOWN; - - /** - * @var int - * @cvalue PHONGO_SERVER_RS_OTHER - */ - public const TYPE_RS_OTHER = UNKNOWN; - - /** - * @var int - * @cvalue PHONGO_SERVER_RS_GHOST - */ - public const TYPE_RS_GHOST = UNKNOWN; - - /** - * @var int - * @cvalue PHONGO_SERVER_LOAD_BALANCER - */ - public const TYPE_LOAD_BALANCER = UNKNOWN; - - final private function __construct() {} + /** + * @var int + * @cvalue PHONGO_SERVER_UNKNOWN + */ + public const TYPE_UNKNOWN = UNKNOWN; + + /** + * @var int + * @cvalue PHONGO_SERVER_STANDALONE + */ + public const TYPE_STANDALONE = UNKNOWN; + + /** + * @var int + * @cvalue PHONGO_SERVER_MONGOS + */ + public const TYPE_MONGOS = UNKNOWN; + + /** + * @var int + * @cvalue PHONGO_SERVER_POSSIBLE_PRIMARY + */ + public const TYPE_POSSIBLE_PRIMARY = UNKNOWN; + + /** + * @var int + * @cvalue PHONGO_SERVER_RS_PRIMARY + */ + public const TYPE_RS_PRIMARY = UNKNOWN; + + /** + * @var int + * @cvalue PHONGO_SERVER_RS_SECONDARY + */ + public const TYPE_RS_SECONDARY = UNKNOWN; + + /** + * @var int + * @cvalue PHONGO_SERVER_RS_ARBITER + */ + public const TYPE_RS_ARBITER = UNKNOWN; + + /** + * @var int + * @cvalue PHONGO_SERVER_RS_OTHER + */ + public const TYPE_RS_OTHER = UNKNOWN; + + /** + * @var int + * @cvalue PHONGO_SERVER_RS_GHOST + */ + public const TYPE_RS_GHOST = UNKNOWN; + + /** + * @var int + * @cvalue PHONGO_SERVER_LOAD_BALANCER + */ + public const TYPE_LOAD_BALANCER = UNKNOWN; + + final private function __construct() {} #if PHP_VERSION_ID >= 80000 - final public function executeBulkWrite(string $namespace, BulkWrite $zwrite, array|WriteConcern|null $options = null): WriteResult {} + final public function executeBulkWrite(string $namespace, BulkWrite $zwrite, array|WriteConcern|null $options = null): WriteResult {} - final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): Cursor {} + final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): Cursor {} - final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} + final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} #else - /** @param array|WriteConcern|null $options */ - final public function executeBulkWrite(string $namespace, BulkWrite $zwrite, $options = null): WriteResult {} + /** @param array|WriteConcern|null $options */ + final public function executeBulkWrite(string $namespace, BulkWrite $zwrite, $options = null): WriteResult {} - /** @param array|ReadPreference|null $options */ - final public function executeCommand(string $db, Command $command, $options = null): Cursor {} + /** @param array|ReadPreference|null $options */ + final public function executeCommand(string $db, Command $command, $options = null): Cursor {} - /** @param array|ReadPreference|null $options */ - final public function executeQuery(string $namespace, Query $query, $options = null): Cursor {} + /** @param array|ReadPreference|null $options */ + final public function executeQuery(string $namespace, Query $query, $options = null): Cursor {} #endif - final public function executeReadCommand(string $db, Command $command, array $options = []): Cursor {} + final public function executeReadCommand(string $db, Command $command, array $options = []): Cursor {} - final public function executeReadWriteCommand(string $db, Command $command, array $options = []): Cursor {} + final public function executeReadWriteCommand(string $db, Command $command, array $options = []): Cursor {} - final public function executeWriteCommand(string $db, Command $command, array $options = []): Cursor {} + final public function executeWriteCommand(string $db, Command $command, array $options = []): Cursor {} - final public function getHost(): string {} + final public function getHost(): string {} - final public function getInfo(): array {} + final public function getInfo(): array {} - final public function getLatency(): ?int {} + final public function getLatency(): ?int {} - final public function getPort(): int {} + final public function getPort(): int {} - final public function getServerDescription(): ServerDescription {} + final public function getServerDescription(): ServerDescription {} - final public function getTags(): array {} + final public function getTags(): array {} - final public function getType(): int {} + final public function getType(): int {} - final public function isArbiter(): bool {} + final public function isArbiter(): bool {} - final public function isHidden(): bool {} + final public function isHidden(): bool {} - final public function isPassive(): bool {} + final public function isPassive(): bool {} - final public function isPrimary(): bool {} + final public function isPrimary(): bool {} - final public function isSecondary(): bool {} + final public function isSecondary(): bool {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/ServerApi.stub.php b/src/MongoDB/ServerApi.stub.php index d2140febf..166d41598 100644 --- a/src/MongoDB/ServerApi.stub.php +++ b/src/MongoDB/ServerApi.stub.php @@ -5,31 +5,30 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class ServerApi implements \MongoDB\BSON\Serializable, \Serializable { - final class ServerApi implements \MongoDB\BSON\Serializable, \Serializable - { - /** @var string */ - public const V1 = '1'; + /** @var string */ + public const V1 = '1'; - final public function __construct(string $version, ?bool $strict = null, ?bool $deprecationErrors = null) {} + final public function __construct(string $version, ?bool $strict = null, ?bool $deprecationErrors = null) {} - public static function __set_state(array $properties): ServerApi {} + public static function __set_state(array $properties): ServerApi {} #if PHP_VERSION_ID >= 80000 - final public function bsonSerialize(): array|object {} + final public function bsonSerialize(): array|object {} #else - /** @return array|object */ - final public function bsonSerialize() {} + /** @return array|object */ + final public function bsonSerialize() {} #endif - final public function serialize(): string {} + final public function serialize(): string {} - /** @param string $serialized */ - final public function unserialize($serialized): void {} + /** @param string $serialized */ + final public function unserialize($serialized): void {} - final public function __unserialize(array $data): void {} + final public function __unserialize(array $data): void {} - final public function __serialize(): array {} - } + final public function __serialize(): array {} } diff --git a/src/MongoDB/ServerApi_arginfo.h b/src/MongoDB/ServerApi_arginfo.h index d486d2d7b..779eed1b2 100644 --- a/src/MongoDB/ServerApi_arginfo.h +++ b/src/MongoDB/ServerApi_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 25126c36542ef56cab425ed42a44b862cb9e83f9 */ + * Stub hash: 561937975ec62eaa627924f744d3e4426a903851 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, version, IS_STRING, 0) diff --git a/src/MongoDB/ServerDescription.stub.php b/src/MongoDB/ServerDescription.stub.php index 3dde219b4..57a8f42ec 100644 --- a/src/MongoDB/ServerDescription.stub.php +++ b/src/MongoDB/ServerDescription.stub.php @@ -5,82 +5,81 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class ServerDescription { - final class ServerDescription - { - /** - * @var string - * @cvalue PHONGO_SERVER_TYPE_UNKNOWN - */ - public const TYPE_UNKNOWN = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_SERVER_TYPE_STANDALONE - */ - public const TYPE_STANDALONE = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_SERVER_TYPE_MONGOS - */ - public const TYPE_MONGOS = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_SERVER_TYPE_POSSIBLE_PRIMARY - */ - public const TYPE_POSSIBLE_PRIMARY = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_SERVER_TYPE_RS_PRIMARY - */ - public const TYPE_RS_PRIMARY = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_SERVER_TYPE_RS_SECONDARY - */ - public const TYPE_RS_SECONDARY = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_SERVER_TYPE_RS_ARBITER - */ - public const TYPE_RS_ARBITER = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_SERVER_TYPE_RS_OTHER - */ - public const TYPE_RS_OTHER = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_SERVER_TYPE_RS_GHOST - */ - public const TYPE_RS_GHOST = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_SERVER_TYPE_LOAD_BALANCER - */ - public const TYPE_LOAD_BALANCER = UNKNOWN; - - final private function __construct() {} - - final public function getHelloResponse(): array {} - - final public function getHost(): string {} - - final public function getLastUpdateTime(): int {} - - final public function getPort(): int {} - - final public function getRoundTripTime(): ?int {} - - final public function getType(): string {} - } + /** + * @var string + * @cvalue PHONGO_SERVER_TYPE_UNKNOWN + */ + public const TYPE_UNKNOWN = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_SERVER_TYPE_STANDALONE + */ + public const TYPE_STANDALONE = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_SERVER_TYPE_MONGOS + */ + public const TYPE_MONGOS = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_SERVER_TYPE_POSSIBLE_PRIMARY + */ + public const TYPE_POSSIBLE_PRIMARY = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_SERVER_TYPE_RS_PRIMARY + */ + public const TYPE_RS_PRIMARY = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_SERVER_TYPE_RS_SECONDARY + */ + public const TYPE_RS_SECONDARY = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_SERVER_TYPE_RS_ARBITER + */ + public const TYPE_RS_ARBITER = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_SERVER_TYPE_RS_OTHER + */ + public const TYPE_RS_OTHER = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_SERVER_TYPE_RS_GHOST + */ + public const TYPE_RS_GHOST = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_SERVER_TYPE_LOAD_BALANCER + */ + public const TYPE_LOAD_BALANCER = UNKNOWN; + + final private function __construct() {} + + final public function getHelloResponse(): array {} + + final public function getHost(): string {} + + final public function getLastUpdateTime(): int {} + + final public function getPort(): int {} + + final public function getRoundTripTime(): ?int {} + + final public function getType(): string {} } diff --git a/src/MongoDB/ServerDescription_arginfo.h b/src/MongoDB/ServerDescription_arginfo.h index 40e0e8b6a..83c7881e7 100644 --- a/src/MongoDB/ServerDescription_arginfo.h +++ b/src/MongoDB/ServerDescription_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c3b14320e4ef824a81c3b7aeba92e903e616f323 */ + * Stub hash: 85cce1e6824dec5cb0d659b841d893a849948eeb */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ServerDescription___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Server_arginfo.h b/src/MongoDB/Server_arginfo.h index 80bcb3a24..3749cfac7 100644 --- a/src/MongoDB/Server_arginfo.h +++ b/src/MongoDB/Server_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 1efac8a3f41afcdd1af63979404a44550174c40d */ + * Stub hash: dd17d7d68d739e54f3d8d6d6f412c2d8269068a8 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Server___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/Session.stub.php b/src/MongoDB/Session.stub.php index 6814475c4..eea01fcf4 100644 --- a/src/MongoDB/Session.stub.php +++ b/src/MongoDB/Session.stub.php @@ -5,75 +5,74 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class Session { - final class Session - { - /** - * @var string - * @cvalue PHONGO_TRANSACTION_NONE - */ - public const TRANSACTION_NONE = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_TRANSACTION_STARTING - */ - public const TRANSACTION_STARTING = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_TRANSACTION_IN_PROGRESS - */ - public const TRANSACTION_IN_PROGRESS = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_TRANSACTION_COMMITTED - */ - public const TRANSACTION_COMMITTED = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_TRANSACTION_ABORTED - */ - public const TRANSACTION_ABORTED = UNKNOWN; - - final private function __construct() {} - - final public function abortTransaction(): void {} + /** + * @var string + * @cvalue PHONGO_TRANSACTION_NONE + */ + public const TRANSACTION_NONE = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_TRANSACTION_STARTING + */ + public const TRANSACTION_STARTING = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_TRANSACTION_IN_PROGRESS + */ + public const TRANSACTION_IN_PROGRESS = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_TRANSACTION_COMMITTED + */ + public const TRANSACTION_COMMITTED = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_TRANSACTION_ABORTED + */ + public const TRANSACTION_ABORTED = UNKNOWN; + + final private function __construct() {} + + final public function abortTransaction(): void {} #if PHP_VERSION_ID >= 80000 - final public function advanceClusterTime(array|object $clusterTime): void {} + final public function advanceClusterTime(array|object $clusterTime): void {} #else - /** @param array|object $clusterTime */ - final public function advanceClusterTime($clusterTime): void {} + /** @param array|object $clusterTime */ + final public function advanceClusterTime($clusterTime): void {} #endif - final public function advanceOperationTime(\MongoDB\BSON\TimestampInterface $operationTime): void {} + final public function advanceOperationTime(\MongoDB\BSON\TimestampInterface $operationTime): void {} - final public function commitTransaction(): void {} + final public function commitTransaction(): void {} - final public function endSession(): void {} + final public function endSession(): void {} - final public function getClusterTime(): ?object {} + final public function getClusterTime(): ?object {} - final public function getLogicalSessionId(): object {} + final public function getLogicalSessionId(): object {} - final public function getOperationTime(): ?\MongoDB\BSON\Timestamp {} + final public function getOperationTime(): ?\MongoDB\BSON\Timestamp {} - final public function getServer(): ?Server {} + final public function getServer(): ?Server {} - final public function getTransactionOptions(): ?array {} + final public function getTransactionOptions(): ?array {} - final public function getTransactionState(): string {} + final public function getTransactionState(): string {} - final public function isDirty(): bool {} + final public function isDirty(): bool {} - final public function isInTransaction(): bool {} + final public function isInTransaction(): bool {} - final public function startTransaction(?array $options = []): void {} + final public function startTransaction(?array $options = []): void {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Session_arginfo.h b/src/MongoDB/Session_arginfo.h index 61e65f48b..aa94f27bd 100644 --- a/src/MongoDB/Session_arginfo.h +++ b/src/MongoDB/Session_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: b42d72ff67d80eaa211effcaa7827e462cf34552 */ + * Stub hash: fbf742d6b12a1bf6e04201a81b08e3b26b8e261c */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Session___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/TopologyDescription.stub.php b/src/MongoDB/TopologyDescription.stub.php index 7d6840ccf..46c8d045c 100644 --- a/src/MongoDB/TopologyDescription.stub.php +++ b/src/MongoDB/TopologyDescription.stub.php @@ -5,54 +5,53 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class TopologyDescription { - final class TopologyDescription - { - /** - * @var string - * @cvalue PHONGO_TOPOLOGY_UNKNOWN - */ - public const TYPE_UNKNOWN = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_TOPOLOGY_SINGLE - */ - public const TYPE_SINGLE = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_TOPOLOGY_SHARDED - */ - public const TYPE_SHARDED = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_TOPOLOGY_REPLICA_SET_NO_PRIMARY - */ - public const TYPE_REPLICA_SET_NO_PRIMARY = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_TOPOLOGY_REPLICA_SET_WITH_PRIMARY - */ - public const TYPE_REPLICA_SET_WITH_PRIMARY = UNKNOWN; - - /** - * @var string - * @cvalue PHONGO_TOPOLOGY_LOAD_BALANCED - */ - public const TYPE_LOAD_BALANCED = UNKNOWN; - - final private function __construct() {} - - final public function getServers(): array {} - - final public function getType(): string {} - - final public function hasReadableServer(?ReadPreference $readPreference = null): bool {} - - final public function hasWritableServer(): bool {} - } + /** + * @var string + * @cvalue PHONGO_TOPOLOGY_UNKNOWN + */ + public const TYPE_UNKNOWN = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_TOPOLOGY_SINGLE + */ + public const TYPE_SINGLE = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_TOPOLOGY_SHARDED + */ + public const TYPE_SHARDED = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_TOPOLOGY_REPLICA_SET_NO_PRIMARY + */ + public const TYPE_REPLICA_SET_NO_PRIMARY = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_TOPOLOGY_REPLICA_SET_WITH_PRIMARY + */ + public const TYPE_REPLICA_SET_WITH_PRIMARY = UNKNOWN; + + /** + * @var string + * @cvalue PHONGO_TOPOLOGY_LOAD_BALANCED + */ + public const TYPE_LOAD_BALANCED = UNKNOWN; + + final private function __construct() {} + + final public function getServers(): array {} + + final public function getType(): string {} + + final public function hasReadableServer(?ReadPreference $readPreference = null): bool {} + + final public function hasWritableServer(): bool {} } diff --git a/src/MongoDB/TopologyDescription_arginfo.h b/src/MongoDB/TopologyDescription_arginfo.h index beae41bd5..a3b6049db 100644 --- a/src/MongoDB/TopologyDescription_arginfo.h +++ b/src/MongoDB/TopologyDescription_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 8775861be8ba40186457e7ebe388c8b7dc3f1b1d */ + * Stub hash: 7c61addf17e525496c8755d437b4db423f6be59d */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_TopologyDescription___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/WriteConcern.stub.php b/src/MongoDB/WriteConcern.stub.php index 39c42c7a9..ffa00cc02 100644 --- a/src/MongoDB/WriteConcern.stub.php +++ b/src/MongoDB/WriteConcern.stub.php @@ -5,53 +5,52 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class WriteConcern implements \MongoDB\BSON\Serializable, \Serializable { - final class WriteConcern implements \MongoDB\BSON\Serializable, \Serializable - { - /** - * @var string - * @cvalue PHONGO_WRITE_CONCERN_W_MAJORITY - */ - public const MAJORITY = UNKNOWN; + /** + * @var string + * @cvalue PHONGO_WRITE_CONCERN_W_MAJORITY + */ + public const MAJORITY = UNKNOWN; #if PHP_VERSION_ID >= 80000 - final public function __construct(string|int $w, ?int $wtimeout = null, ?bool $journal = null) {} + final public function __construct(string|int $w, ?int $wtimeout = null, ?bool $journal = null) {} #else - /** @param string|int $w */ - final public function __construct($w, ?int $wtimeout = null, ?bool $journal = null) {} + /** @param string|int $w */ + final public function __construct($w, ?int $wtimeout = null, ?bool $journal = null) {} #endif - final public function getJournal(): ?bool {} + final public function getJournal(): ?bool {} #if PHP_VERSION_ID >= 80000 - final public function getW(): string|int|null {} + final public function getW(): string|int|null {} #else - /** @return string|int|null */ - final public function getW() {} + /** @return string|int|null */ + final public function getW() {} #endif - final public function getWtimeout(): ?int {} + final public function getWtimeout(): ?int {} - final public function isDefault(): bool {} + final public function isDefault(): bool {} - public static function __set_state(array $properties): WriteConcern {} + public static function __set_state(array $properties): WriteConcern {} #if PHP_VERSION_ID >= 80000 - final public function bsonSerialize(): array|object {} + final public function bsonSerialize(): array|object {} #else - /** @return array|object */ - final public function bsonSerialize() {} + /** @return array|object */ + final public function bsonSerialize() {} #endif - final public function serialize(): string {} + final public function serialize(): string {} - /** @param string $serialized */ - final public function unserialize($serialized): void {} + /** @param string $serialized */ + final public function unserialize($serialized): void {} - final public function __unserialize(array $data): void {} + final public function __unserialize(array $data): void {} - final public function __serialize(): array {} + final public function __serialize(): array {} - } } diff --git a/src/MongoDB/WriteConcernError.stub.php b/src/MongoDB/WriteConcernError.stub.php index c5bb98275..08480aebf 100644 --- a/src/MongoDB/WriteConcernError.stub.php +++ b/src/MongoDB/WriteConcernError.stub.php @@ -5,18 +5,17 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class WriteConcernError { - final class WriteConcernError - { - final private function __construct() {} + final private function __construct() {} - final public function getCode(): int {} + final public function getCode(): int {} - final public function getInfo(): ?object {} + final public function getInfo(): ?object {} - final public function getMessage(): string {} + final public function getMessage(): string {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/WriteConcernError_arginfo.h b/src/MongoDB/WriteConcernError_arginfo.h index 01fdf42b4..ed01d3d3b 100644 --- a/src/MongoDB/WriteConcernError_arginfo.h +++ b/src/MongoDB/WriteConcernError_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c49a16f0197d4db14ca9986ee4a62e1f45f3dc91 */ + * Stub hash: fe3a956a163d5a46651f7ab5cb6be71552191a9d */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcernError___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/WriteConcern_arginfo.h b/src/MongoDB/WriteConcern_arginfo.h index a1227e6fa..6e7a369ac 100644 --- a/src/MongoDB/WriteConcern_arginfo.h +++ b/src/MongoDB/WriteConcern_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 846d7edf5b49ec5553bcfc69134d14abbf07a71b */ + * Stub hash: ef3b593831b2de652f8bcac0a72eab5b75eeb073 */ #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern___construct, 0, 0, 1) diff --git a/src/MongoDB/WriteError.stub.php b/src/MongoDB/WriteError.stub.php index 44202dc42..f9abaa710 100644 --- a/src/MongoDB/WriteError.stub.php +++ b/src/MongoDB/WriteError.stub.php @@ -5,20 +5,19 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class WriteError { - final class WriteError - { - final private function __construct() {} + final private function __construct() {} - final public function getCode(): int {} + final public function getCode(): int {} - final public function getIndex(): int {} + final public function getIndex(): int {} - final public function getInfo(): ?object {} + final public function getInfo(): ?object {} - final public function getMessage(): string {} + final public function getMessage(): string {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/WriteError_arginfo.h b/src/MongoDB/WriteError_arginfo.h index b7711a9fe..8abdc1c77 100644 --- a/src/MongoDB/WriteError_arginfo.h +++ b/src/MongoDB/WriteError_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c674c3bfdd6c416a65bc62c4c909b7cd699a6caa */ + * Stub hash: fbea328dd2b5a0c806282daebd86ca7ec9ae3a16 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteError___construct, 0, 0, 0) ZEND_END_ARG_INFO() diff --git a/src/MongoDB/WriteResult.stub.php b/src/MongoDB/WriteResult.stub.php index 7c1fb8c66..dfb7766d4 100644 --- a/src/MongoDB/WriteResult.stub.php +++ b/src/MongoDB/WriteResult.stub.php @@ -5,32 +5,31 @@ * @generate-function-entries static */ -namespace MongoDB\Driver +namespace MongoDB\Driver; + +final class WriteResult { - final class WriteResult - { - final private function __construct() {} + final private function __construct() {} - final public function getInsertedCount(): ?int {} + final public function getInsertedCount(): ?int {} - final public function getMatchedCount(): ?int {} + final public function getMatchedCount(): ?int {} - final public function getModifiedCount(): ?int {} + final public function getModifiedCount(): ?int {} - final public function getDeletedCount(): ?int {} + final public function getDeletedCount(): ?int {} - final public function getUpsertedCount(): ?int {} + final public function getUpsertedCount(): ?int {} - final public function getServer(): Server {} + final public function getServer(): Server {} - final public function getUpsertedIds(): array {} + final public function getUpsertedIds(): array {} - final public function getWriteConcernError(): ?WriteConcernError {} + final public function getWriteConcernError(): ?WriteConcernError {} - final public function getWriteErrors(): array {} + final public function getWriteErrors(): array {} - final public function isAcknowledged(): bool {} + final public function isAcknowledged(): bool {} - final public function __wakeup(): void {} - } + final public function __wakeup(): void {} } diff --git a/src/MongoDB/WriteResult_arginfo.h b/src/MongoDB/WriteResult_arginfo.h index 925b9ed3f..a7e950633 100644 --- a/src/MongoDB/WriteResult_arginfo.h +++ b/src/MongoDB/WriteResult_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: b64ce8c4020c5ee5c9384229008d0f29b9637a82 */ + * Stub hash: eae27215b994b4941296f69331abd6d1a3173df7 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteResult___construct, 0, 0, 0) ZEND_END_ARG_INFO() From 27012ad95c21a6e6bcd3a1b4a6e0dfcdd9ed1b10 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 2 Aug 2022 09:29:55 +0200 Subject: [PATCH 22/26] Use individual #if conditions for each stub method --- src/MongoDB/BulkWrite.stub.php | 12 ++++-- src/MongoDB/BulkWrite_arginfo.h | 52 +++++++++++------------ src/MongoDB/ClientEncryption.stub.php | 6 ++- src/MongoDB/ClientEncryption_arginfo.h | 26 ++++++------ src/MongoDB/Manager.stub.php | 12 ++++-- src/MongoDB/Manager_arginfo.h | 58 +++++++++++++------------- src/MongoDB/Server.stub.php | 12 ++++-- src/MongoDB/Server_arginfo.h | 58 +++++++++++++------------- 8 files changed, 125 insertions(+), 111 deletions(-) diff --git a/src/MongoDB/BulkWrite.stub.php b/src/MongoDB/BulkWrite.stub.php index a9137d969..0f5d4b8a6 100644 --- a/src/MongoDB/BulkWrite.stub.php +++ b/src/MongoDB/BulkWrite.stub.php @@ -15,20 +15,24 @@ public function count(): int {} #if PHP_VERSION_ID >= 80000 public function delete(array|object $filter, array $deleteOptions = []): void {} - - public final function insert(array|object $document): mixed {} - - public function update(array|object $filter, array|object $newObj, array $updateOptions = []): void {} #else /** @param array|object $filter */ public function delete($filter, array $deleteOptions = []): void {} +#endif +#if PHP_VERSION_ID >= 80000 + public final function insert(array|object $document): mixed {} +#else /** * @param array|object $document * @return mixed */ public final function insert($document) {} +#endif +#if PHP_VERSION_ID >= 80000 + public function update(array|object $filter, array|object $newObj, array $updateOptions = []): void {} +#else /** * @param array|object $filter * @param array|object $newObj diff --git a/src/MongoDB/BulkWrite_arginfo.h b/src/MongoDB/BulkWrite_arginfo.h index 09bea4f76..e8490819e 100644 --- a/src/MongoDB/BulkWrite_arginfo.h +++ b/src/MongoDB/BulkWrite_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 5b71b311ea4be170595b7616bf02af21b1379b1c */ + * Stub hash: ccb88a8730d28fed822df1f0585988886dd806cb */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") @@ -15,30 +15,30 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_d ZEND_END_ARG_INFO() #endif -#if PHP_VERSION_ID >= 80000 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_insert, 0, 1, IS_MIXED, 0) - ZEND_ARG_TYPE_MASK(0, document, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_delete, 0, 1, IS_VOID, 0) + ZEND_ARG_INFO(0, filter) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, deleteOptions, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() #endif #if PHP_VERSION_ID >= 80000 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_update, 0, 2, IS_VOID, 0) - ZEND_ARG_TYPE_MASK(0, filter, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) - ZEND_ARG_TYPE_MASK(0, newObj, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, updateOptions, IS_ARRAY, 0, "[]") +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_insert, 0, 1, IS_MIXED, 0) + ZEND_ARG_TYPE_MASK(0, document, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) ZEND_END_ARG_INFO() #endif #if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_delete, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, filter) - ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, deleteOptions, IS_ARRAY, 0, "[]") +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_insert, 0, 0, 1) + ZEND_ARG_INFO(0, document) ZEND_END_ARG_INFO() #endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_insert, 0, 0, 1) - ZEND_ARG_INFO(0, document) +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_update, 0, 2, IS_VOID, 0) + ZEND_ARG_TYPE_MASK(0, filter, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) + ZEND_ARG_TYPE_MASK(0, newObj, MAY_BE_ARRAY|MAY_BE_OBJECT, NULL) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, updateOptions, IS_ARRAY, 0, "[]") ZEND_END_ARG_INFO() #endif @@ -56,18 +56,18 @@ static ZEND_METHOD(MongoDB_Driver_BulkWrite, count); #if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_BulkWrite, delete); #endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_BulkWrite, insert); -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_BulkWrite, update); -#endif #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_BulkWrite, delete); #endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_BulkWrite, insert); +#endif #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_BulkWrite, insert); #endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_BulkWrite, update); +#endif #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_BulkWrite, update); #endif @@ -79,18 +79,18 @@ static const zend_function_entry class_MongoDB_Driver_BulkWrite_methods[] = { #if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_Driver_BulkWrite, delete, arginfo_class_MongoDB_Driver_BulkWrite_delete, ZEND_ACC_PUBLIC) #endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_BulkWrite, insert, arginfo_class_MongoDB_Driver_BulkWrite_insert, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_BulkWrite, update, arginfo_class_MongoDB_Driver_BulkWrite_update, ZEND_ACC_PUBLIC) -#endif #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_BulkWrite, delete, arginfo_class_MongoDB_Driver_BulkWrite_delete, ZEND_ACC_PUBLIC) #endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_BulkWrite, insert, arginfo_class_MongoDB_Driver_BulkWrite_insert, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_BulkWrite, insert, arginfo_class_MongoDB_Driver_BulkWrite_insert, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_BulkWrite, update, arginfo_class_MongoDB_Driver_BulkWrite_update, ZEND_ACC_PUBLIC) +#endif #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_BulkWrite, update, arginfo_class_MongoDB_Driver_BulkWrite_update, ZEND_ACC_PUBLIC) #endif diff --git a/src/MongoDB/ClientEncryption.stub.php b/src/MongoDB/ClientEncryption.stub.php index ccf22440b..0b1772e29 100644 --- a/src/MongoDB/ClientEncryption.stub.php +++ b/src/MongoDB/ClientEncryption.stub.php @@ -45,12 +45,14 @@ final public function createDataKey(string $kmsProvider, array $options = []): \ #if PHP_VERSION_ID >= 80000 final public function decrypt(\MongoDB\BSON\Binary $value): mixed {} - - final public function encrypt(mixed $value, array $options = []): \MongoDB\BSON\Binary {} #else /** @return mixed */ final public function decrypt(\MongoDB\BSON\Binary $value) {} +#endif +#if PHP_VERSION_ID >= 80000 + final public function encrypt(mixed $value, array $options = []): \MongoDB\BSON\Binary {} +#else /** @param mixed $value */ final public function encrypt($value, array $options = []): \MongoDB\BSON\Binary {} #endif diff --git a/src/MongoDB/ClientEncryption_arginfo.h b/src/MongoDB/ClientEncryption_arginfo.h index 427992a0c..41247dbdb 100644 --- a/src/MongoDB/ClientEncryption_arginfo.h +++ b/src/MongoDB/ClientEncryption_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 8392a8f5e4e35893ddc65082a91cef47dde7facf */ + * Stub hash: d8e3bd42058296c2e67ff7107d08694de7164fdd */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0) @@ -16,6 +16,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncry ZEND_END_ARG_INFO() #endif +#if !(PHP_VERSION_ID >= 80000) +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_decrypt, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, value, MongoDB\\BSON\\Binary, 0) +ZEND_END_ARG_INFO() +#endif + #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, 0, 1, MongoDB\\BSON\\Binary, 0) ZEND_ARG_TYPE_INFO(0, value, IS_MIXED, 0) @@ -23,12 +29,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryp ZEND_END_ARG_INFO() #endif -#if !(PHP_VERSION_ID >= 80000) -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_decrypt, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, value, MongoDB\\BSON\\Binary, 0) -ZEND_END_ARG_INFO() -#endif - #if !(PHP_VERSION_ID >= 80000) ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, 0, 1, MongoDB\\BSON\\Binary, 0) ZEND_ARG_INFO(0, value) @@ -42,12 +42,12 @@ static ZEND_METHOD(MongoDB_Driver_ClientEncryption, createDataKey); #if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_ClientEncryption, decrypt); #endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_ClientEncryption, encrypt); -#endif #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_ClientEncryption, decrypt); #endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_ClientEncryption, encrypt); +#endif #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_ClientEncryption, encrypt); #endif @@ -59,12 +59,12 @@ static const zend_function_entry class_MongoDB_Driver_ClientEncryption_methods[] #if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_Driver_ClientEncryption, decrypt, arginfo_class_MongoDB_Driver_ClientEncryption_decrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_ClientEncryption, encrypt, arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_ClientEncryption, decrypt, arginfo_class_MongoDB_Driver_ClientEncryption_decrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_ClientEncryption, encrypt, arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_ClientEncryption, encrypt, arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif diff --git a/src/MongoDB/Manager.stub.php b/src/MongoDB/Manager.stub.php index 5cb2bf0e2..3e7a5b2da 100644 --- a/src/MongoDB/Manager.stub.php +++ b/src/MongoDB/Manager.stub.php @@ -17,17 +17,21 @@ final public function createClientEncryption(array $options): ClientEncryption { #if PHP_VERSION_ID >= 80000 final public function executeBulkWrite(string $namespace, BulkWrite $bulk, array|WriteConcern|null $options = null): WriteResult {} - - final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): Cursor {} - - final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} #else /** @param array|WriteConcern|null $options */ final public function executeBulkWrite(string $namespace, BulkWrite $bulk, $options = null): WriteResult {} +#endif +#if PHP_VERSION_ID >= 80000 + final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): Cursor {} +#else /** @param array|ReadPreference|null $options */ final public function executeCommand(string $db, Command $command, $options = null): Cursor {} +#endif +#if PHP_VERSION_ID >= 80000 + final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} +#else /** @param array|ReadPreference|null $options */ final public function executeQuery(string $namespace, Query $query, $options = null): Cursor {} #endif diff --git a/src/MongoDB/Manager_arginfo.h b/src/MongoDB/Manager_arginfo.h index 56313f22f..759e59ab9 100644 --- a/src/MongoDB/Manager_arginfo.h +++ b/src/MongoDB/Manager_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: c1c455c0a5c5622aa3ef8972f7911e653d01c997 */ + * Stub hash: 516a26c70864397ba986d9855f4f876fe84bceb9 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Manager___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, uri, IS_STRING, 1, "null") @@ -23,22 +23,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_exec ZEND_END_ARG_INFO() #endif -#if PHP_VERSION_ID >= 80000 -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) - ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) - ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") -ZEND_END_ARG_INFO() -#endif - #if !(PHP_VERSION_ID >= 80000) ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) @@ -47,6 +31,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_exec ZEND_END_ARG_INFO() #endif +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") +ZEND_END_ARG_INFO() +#endif + #if !(PHP_VERSION_ID >= 80000) ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) @@ -55,6 +47,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_exec ZEND_END_ARG_INFO() #endif +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") +ZEND_END_ARG_INFO() +#endif + #if !(PHP_VERSION_ID >= 80000) ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Manager_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) @@ -115,18 +115,18 @@ static ZEND_METHOD(MongoDB_Driver_Manager, createClientEncryption); #if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_Manager, executeBulkWrite); #endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_Manager, executeCommand); -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_Manager, executeQuery); -#endif #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Manager, executeBulkWrite); #endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Manager, executeCommand); +#endif #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Manager, executeCommand); #endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Manager, executeQuery); +#endif #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Manager, executeQuery); #endif @@ -156,18 +156,18 @@ static const zend_function_entry class_MongoDB_Driver_Manager_methods[] = { #if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_Driver_Manager, executeBulkWrite, arginfo_class_MongoDB_Driver_Manager_executeBulkWrite, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_Manager, executeCommand, arginfo_class_MongoDB_Driver_Manager_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_Manager, executeQuery, arginfo_class_MongoDB_Driver_Manager_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Manager, executeBulkWrite, arginfo_class_MongoDB_Driver_Manager_executeBulkWrite, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Manager, executeCommand, arginfo_class_MongoDB_Driver_Manager_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Manager, executeCommand, arginfo_class_MongoDB_Driver_Manager_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Manager, executeQuery, arginfo_class_MongoDB_Driver_Manager_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Manager, executeQuery, arginfo_class_MongoDB_Driver_Manager_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif diff --git a/src/MongoDB/Server.stub.php b/src/MongoDB/Server.stub.php index 20ff03bcd..2bfe94f8b 100644 --- a/src/MongoDB/Server.stub.php +++ b/src/MongoDB/Server.stub.php @@ -73,17 +73,21 @@ final private function __construct() {} #if PHP_VERSION_ID >= 80000 final public function executeBulkWrite(string $namespace, BulkWrite $zwrite, array|WriteConcern|null $options = null): WriteResult {} - - final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): Cursor {} - - final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} #else /** @param array|WriteConcern|null $options */ final public function executeBulkWrite(string $namespace, BulkWrite $zwrite, $options = null): WriteResult {} +#endif +#if PHP_VERSION_ID >= 80000 + final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): Cursor {} +#else /** @param array|ReadPreference|null $options */ final public function executeCommand(string $db, Command $command, $options = null): Cursor {} +#endif +#if PHP_VERSION_ID >= 80000 + final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} +#else /** @param array|ReadPreference|null $options */ final public function executeQuery(string $namespace, Query $query, $options = null): Cursor {} #endif diff --git a/src/MongoDB/Server_arginfo.h b/src/MongoDB/Server_arginfo.h index 3749cfac7..853908bf3 100644 --- a/src/MongoDB/Server_arginfo.h +++ b/src/MongoDB/Server_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: dd17d7d68d739e54f3d8d6d6f412c2d8269068a8 */ + * Stub hash: ecc61a2cd5bd8d189bb3c8ab276a79e5f2a6089f */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Server___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -12,22 +12,6 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_execu ZEND_END_ARG_INFO() #endif -#if PHP_VERSION_ID >= 80000 -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) - ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") -ZEND_END_ARG_INFO() -#endif - -#if PHP_VERSION_ID >= 80000 -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) - ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) - ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") -ZEND_END_ARG_INFO() -#endif - #if !(PHP_VERSION_ID >= 80000) ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) @@ -36,6 +20,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_execu ZEND_END_ARG_INFO() #endif +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, command, MongoDB\\Driver\\Command, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") +ZEND_END_ARG_INFO() +#endif + #if !(PHP_VERSION_ID >= 80000) ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeCommand, 0, 2, MongoDB\\Driver\\Cursor, 0) ZEND_ARG_TYPE_INFO(0, db, IS_STRING, 0) @@ -44,6 +36,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_execu ZEND_END_ARG_INFO() #endif +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) + ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, query, MongoDB\\Driver\\Query, 0) + ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\ReadPreference, MAY_BE_ARRAY|MAY_BE_NULL, "null") +ZEND_END_ARG_INFO() +#endif + #if !(PHP_VERSION_ID >= 80000) ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeQuery, 0, 2, MongoDB\\Driver\\Cursor, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) @@ -100,18 +100,18 @@ static ZEND_METHOD(MongoDB_Driver_Server, __construct); #if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_Server, executeBulkWrite); #endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_Server, executeCommand); -#endif -#if PHP_VERSION_ID >= 80000 -static ZEND_METHOD(MongoDB_Driver_Server, executeQuery); -#endif #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Server, executeBulkWrite); #endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Server, executeCommand); +#endif #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Server, executeCommand); #endif +#if PHP_VERSION_ID >= 80000 +static ZEND_METHOD(MongoDB_Driver_Server, executeQuery); +#endif #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Server, executeQuery); #endif @@ -138,18 +138,18 @@ static const zend_function_entry class_MongoDB_Driver_Server_methods[] = { #if PHP_VERSION_ID >= 80000 ZEND_ME(MongoDB_Driver_Server, executeBulkWrite, arginfo_class_MongoDB_Driver_Server_executeBulkWrite, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_Server, executeCommand, arginfo_class_MongoDB_Driver_Server_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif -#if PHP_VERSION_ID >= 80000 - ZEND_ME(MongoDB_Driver_Server, executeQuery, arginfo_class_MongoDB_Driver_Server_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) -#endif #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Server, executeBulkWrite, arginfo_class_MongoDB_Driver_Server_executeBulkWrite, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Server, executeCommand, arginfo_class_MongoDB_Driver_Server_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Server, executeCommand, arginfo_class_MongoDB_Driver_Server_executeCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif +#if PHP_VERSION_ID >= 80000 + ZEND_ME(MongoDB_Driver_Server, executeQuery, arginfo_class_MongoDB_Driver_Server_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) +#endif #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Server, executeQuery, arginfo_class_MongoDB_Driver_Server_executeQuery, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif From 0abee61964224b601d7d8d217176757d691967b4 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 2 Aug 2022 09:31:24 +0200 Subject: [PATCH 23/26] Make disabled constructor/wakeup methods static --- php_phongo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/php_phongo.h b/php_phongo.h index 79b6cb3ac..bd3a93828 100644 --- a/php_phongo.h +++ b/php_phongo.h @@ -110,14 +110,14 @@ zend_object_handlers* phongo_get_std_object_handlers(void); } while (0) #define PHONGO_DISABLED_CONSTRUCTOR(classname) \ - PHP_METHOD(classname, __construct) \ + static PHP_METHOD(classname, __construct) \ { \ PHONGO_PARSE_PARAMETERS_NONE(); \ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "Accessing private constructor"); \ } #define PHONGO_DISABLED_WAKEUP(classname) \ - PHP_METHOD(classname, __wakeup) \ + static PHP_METHOD(classname, __wakeup) \ { \ PHONGO_PARSE_PARAMETERS_NONE(); \ phongo_throw_exception(PHONGO_ERROR_RUNTIME, "MongoDB\\Driver objects cannot be serialized"); \ From c9eea9418b2ef7b9dcf55e4ac057bf8a800004ec Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 2 Aug 2022 09:32:19 +0200 Subject: [PATCH 24/26] Fix bulkWrite parameter name --- src/MongoDB/Server.stub.php | 4 ++-- src/MongoDB/Server_arginfo.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/MongoDB/Server.stub.php b/src/MongoDB/Server.stub.php index 2bfe94f8b..0cc6898c9 100644 --- a/src/MongoDB/Server.stub.php +++ b/src/MongoDB/Server.stub.php @@ -72,10 +72,10 @@ final class Server final private function __construct() {} #if PHP_VERSION_ID >= 80000 - final public function executeBulkWrite(string $namespace, BulkWrite $zwrite, array|WriteConcern|null $options = null): WriteResult {} + final public function executeBulkWrite(string $namespace, BulkWrite $bulkWrite, array|WriteConcern|null $options = null): WriteResult {} #else /** @param array|WriteConcern|null $options */ - final public function executeBulkWrite(string $namespace, BulkWrite $zwrite, $options = null): WriteResult {} + final public function executeBulkWrite(string $namespace, BulkWrite $bulkWrite, $options = null): WriteResult {} #endif #if PHP_VERSION_ID >= 80000 diff --git a/src/MongoDB/Server_arginfo.h b/src/MongoDB/Server_arginfo.h index 853908bf3..31c71e42a 100644 --- a/src/MongoDB/Server_arginfo.h +++ b/src/MongoDB/Server_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ecc61a2cd5bd8d189bb3c8ab276a79e5f2a6089f */ + * Stub hash: 8c4e8b2bd6a1a5b0047a69ea3cd79399aa474a05 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Server___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -7,7 +7,7 @@ ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, zwrite, MongoDB\\Driver\\BulkWrite, 0) + ZEND_ARG_OBJ_INFO(0, bulkWrite, MongoDB\\Driver\\BulkWrite, 0) ZEND_ARG_OBJ_TYPE_MASK(0, options, MongoDB\\Driver\\WriteConcern, MAY_BE_ARRAY|MAY_BE_NULL, "null") ZEND_END_ARG_INFO() #endif @@ -15,7 +15,7 @@ ZEND_END_ARG_INFO() #if !(PHP_VERSION_ID >= 80000) ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Server_executeBulkWrite, 0, 2, MongoDB\\Driver\\WriteResult, 0) ZEND_ARG_TYPE_INFO(0, namespace, IS_STRING, 0) - ZEND_ARG_OBJ_INFO(0, zwrite, MongoDB\\Driver\\BulkWrite, 0) + ZEND_ARG_OBJ_INFO(0, bulkWrite, MongoDB\\Driver\\BulkWrite, 0) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, options, "null") ZEND_END_ARG_INFO() #endif From f54546a4dd43aa7b264e9632760d5d6cf3ee4427 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 2 Aug 2022 09:42:01 +0200 Subject: [PATCH 25/26] Use %d to match property count in tests --- tests/exception/bulkwriteexception-getwriteresult-001.phpt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/exception/bulkwriteexception-getwriteresult-001.phpt b/tests/exception/bulkwriteexception-getwriteresult-001.phpt index 90a790aae..419e9c8e1 100644 --- a/tests/exception/bulkwriteexception-getwriteresult-001.phpt +++ b/tests/exception/bulkwriteexception-getwriteresult-001.phpt @@ -23,7 +23,7 @@ try { ===DONE=== --EXPECTF-- -object(MongoDB\Driver\WriteResult)#%d (9) { +object(MongoDB\Driver\WriteResult)#%d (%d) { ["nInserted"]=> int(1) ["nMatched"]=> @@ -40,7 +40,7 @@ object(MongoDB\Driver\WriteResult)#%d (9) { ["writeErrors"]=> array(1) { [0]=> - object(MongoDB\Driver\WriteError)#%d (4) { + object(MongoDB\Driver\WriteError)#%d (%d) { ["message"]=> string(%d) %s ["code"]=> @@ -54,7 +54,7 @@ object(MongoDB\Driver\WriteResult)#%d (9) { ["writeConcernError"]=> NULL ["writeConcern"]=> - object(MongoDB\Driver\WriteConcern)#%d (0) { + object(MongoDB\Driver\WriteConcern)#%d (%d) { } } ===DONE=== From 49e526e77d3be4698fbadde79033115f6fbaaf47 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Tue, 2 Aug 2022 10:15:40 +0200 Subject: [PATCH 26/26] Ensure all classes with disabled serialisation declare __wakeup --- src/MongoDB/BulkWrite.stub.php | 2 ++ src/MongoDB/BulkWrite_arginfo.h | 7 ++++++- src/MongoDB/ClientEncryption.stub.php | 2 ++ src/MongoDB/ClientEncryption_arginfo.h | 7 ++++++- src/MongoDB/Command.stub.php | 2 ++ src/MongoDB/Command_arginfo.h | 7 ++++++- src/MongoDB/Cursor.stub.php | 2 ++ src/MongoDB/Cursor_arginfo.h | 6 +++++- src/MongoDB/ServerDescription.c | 1 + src/MongoDB/ServerDescription.stub.php | 2 ++ src/MongoDB/ServerDescription_arginfo.h | 7 ++++++- src/MongoDB/TopologyDescription.c | 1 + src/MongoDB/TopologyDescription.stub.php | 2 ++ src/MongoDB/TopologyDescription_arginfo.h | 7 ++++++- 14 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/MongoDB/BulkWrite.stub.php b/src/MongoDB/BulkWrite.stub.php index 0f5d4b8a6..506cd4dec 100644 --- a/src/MongoDB/BulkWrite.stub.php +++ b/src/MongoDB/BulkWrite.stub.php @@ -39,4 +39,6 @@ public function update(array|object $filter, array|object $newObj, array $update */ public function update($filter, $newObj, array $updateOptions = []): void {} #endif + + final public function __wakeup(): void {} } diff --git a/src/MongoDB/BulkWrite_arginfo.h b/src/MongoDB/BulkWrite_arginfo.h index e8490819e..5c2434913 100644 --- a/src/MongoDB/BulkWrite_arginfo.h +++ b/src/MongoDB/BulkWrite_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: ccb88a8730d28fed822df1f0585988886dd806cb */ + * Stub hash: 3325b767b4321a1837fa7a8aef924a39e6e6816d */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite___construct, 0, 0, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "[]") @@ -50,6 +50,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite_u ZEND_END_ARG_INFO() #endif +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_BulkWrite___wakeup, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + static ZEND_METHOD(MongoDB_Driver_BulkWrite, __construct); static ZEND_METHOD(MongoDB_Driver_BulkWrite, count); @@ -71,6 +74,7 @@ static ZEND_METHOD(MongoDB_Driver_BulkWrite, update); #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_BulkWrite, update); #endif +static ZEND_METHOD(MongoDB_Driver_BulkWrite, __wakeup); static const zend_function_entry class_MongoDB_Driver_BulkWrite_methods[] = { @@ -94,6 +98,7 @@ static const zend_function_entry class_MongoDB_Driver_BulkWrite_methods[] = { #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_BulkWrite, update, arginfo_class_MongoDB_Driver_BulkWrite_update, ZEND_ACC_PUBLIC) #endif + ZEND_ME(MongoDB_Driver_BulkWrite, __wakeup, arginfo_class_MongoDB_Driver_BulkWrite___wakeup, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END }; diff --git a/src/MongoDB/ClientEncryption.stub.php b/src/MongoDB/ClientEncryption.stub.php index 0b1772e29..221fe0e35 100644 --- a/src/MongoDB/ClientEncryption.stub.php +++ b/src/MongoDB/ClientEncryption.stub.php @@ -56,4 +56,6 @@ final public function encrypt(mixed $value, array $options = []): \MongoDB\BSON\ /** @param mixed $value */ final public function encrypt($value, array $options = []): \MongoDB\BSON\Binary {} #endif + + final public function __wakeup(): void {} } diff --git a/src/MongoDB/ClientEncryption_arginfo.h b/src/MongoDB/ClientEncryption_arginfo.h index 41247dbdb..f4a0619aa 100644 --- a/src/MongoDB/ClientEncryption_arginfo.h +++ b/src/MongoDB/ClientEncryption_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: d8e3bd42058296c2e67ff7107d08694de7164fdd */ + * Stub hash: 169e941e986be2158c89ddba5d5f930cb8fa6bfe */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, options, IS_ARRAY, 0) @@ -36,6 +36,9 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryp ZEND_END_ARG_INFO() #endif +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ClientEncryption___wakeup, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + static ZEND_METHOD(MongoDB_Driver_ClientEncryption, __construct); static ZEND_METHOD(MongoDB_Driver_ClientEncryption, createDataKey); @@ -51,6 +54,7 @@ static ZEND_METHOD(MongoDB_Driver_ClientEncryption, encrypt); #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_ClientEncryption, encrypt); #endif +static ZEND_METHOD(MongoDB_Driver_ClientEncryption, __wakeup); static const zend_function_entry class_MongoDB_Driver_ClientEncryption_methods[] = { @@ -68,6 +72,7 @@ static const zend_function_entry class_MongoDB_Driver_ClientEncryption_methods[] #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_ClientEncryption, encrypt, arginfo_class_MongoDB_Driver_ClientEncryption_encrypt, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif + ZEND_ME(MongoDB_Driver_ClientEncryption, __wakeup, arginfo_class_MongoDB_Driver_ClientEncryption___wakeup, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END }; diff --git a/src/MongoDB/Command.stub.php b/src/MongoDB/Command.stub.php index 16a1e192a..17cb08257 100644 --- a/src/MongoDB/Command.stub.php +++ b/src/MongoDB/Command.stub.php @@ -15,4 +15,6 @@ final public function __construct(array|object $document, array $commandOptions /** @param array|object $document */ final public function __construct($document, array $commandOptions = []) {} #endif + + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Command_arginfo.h b/src/MongoDB/Command_arginfo.h index 07460090b..8708db47e 100644 --- a/src/MongoDB/Command_arginfo.h +++ b/src/MongoDB/Command_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7d4cd783815b6655add5530cfb6e4b085560687d */ + * Stub hash: 3902d0f3c6602053c90a7ee4bc97ece0d6534157 */ #if PHP_VERSION_ID >= 80000 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Command___construct, 0, 0, 1) @@ -15,6 +15,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Command___construct, 0, 0, 1 ZEND_END_ARG_INFO() #endif +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Command___wakeup, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + #if PHP_VERSION_ID >= 80000 static ZEND_METHOD(MongoDB_Driver_Command, __construct); @@ -22,6 +25,7 @@ static ZEND_METHOD(MongoDB_Driver_Command, __construct); #if !(PHP_VERSION_ID >= 80000) static ZEND_METHOD(MongoDB_Driver_Command, __construct); #endif +static ZEND_METHOD(MongoDB_Driver_Command, __wakeup); static const zend_function_entry class_MongoDB_Driver_Command_methods[] = { @@ -31,6 +35,7 @@ static const zend_function_entry class_MongoDB_Driver_Command_methods[] = { #if !(PHP_VERSION_ID >= 80000) ZEND_ME(MongoDB_Driver_Command, __construct, arginfo_class_MongoDB_Driver_Command___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) #endif + ZEND_ME(MongoDB_Driver_Command, __wakeup, arginfo_class_MongoDB_Driver_Command___wakeup, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END }; diff --git a/src/MongoDB/Cursor.stub.php b/src/MongoDB/Cursor.stub.php index b0007046c..69af69ec5 100644 --- a/src/MongoDB/Cursor.stub.php +++ b/src/MongoDB/Cursor.stub.php @@ -35,4 +35,6 @@ final public function setTypeMap(array $typemap): void {} final public function toArray(): array {} public function valid(): bool {} + + final public function __wakeup(): void {} } diff --git a/src/MongoDB/Cursor_arginfo.h b/src/MongoDB/Cursor_arginfo.h index f8c14b9c9..95b9782f7 100644 --- a/src/MongoDB/Cursor_arginfo.h +++ b/src/MongoDB/Cursor_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: b94c509926df512855559d2c0ab4263b9d7dec63 */ + * Stub hash: 2cbb89ebb247f650b26458f40f3cdc196cff386b */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Cursor___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -40,6 +40,8 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_Driver_Cursor_valid arginfo_class_MongoDB_Driver_Cursor_isDead +#define arginfo_class_MongoDB_Driver_Cursor___wakeup arginfo_class_MongoDB_Driver_Cursor_next + static ZEND_METHOD(MongoDB_Driver_Cursor, __construct); #if PHP_VERSION_ID >= 80000 @@ -57,6 +59,7 @@ static ZEND_METHOD(MongoDB_Driver_Cursor, rewind); static ZEND_METHOD(MongoDB_Driver_Cursor, setTypeMap); static ZEND_METHOD(MongoDB_Driver_Cursor, toArray); static ZEND_METHOD(MongoDB_Driver_Cursor, valid); +static ZEND_METHOD(MongoDB_Driver_Cursor, __wakeup); static const zend_function_entry class_MongoDB_Driver_Cursor_methods[] = { @@ -76,6 +79,7 @@ static const zend_function_entry class_MongoDB_Driver_Cursor_methods[] = { ZEND_ME(MongoDB_Driver_Cursor, setTypeMap, arginfo_class_MongoDB_Driver_Cursor_setTypeMap, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Cursor, toArray, arginfo_class_MongoDB_Driver_Cursor_toArray, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Cursor, valid, arginfo_class_MongoDB_Driver_Cursor_valid, ZEND_ACC_PUBLIC) + ZEND_ME(MongoDB_Driver_Cursor, __wakeup, arginfo_class_MongoDB_Driver_Cursor___wakeup, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END }; diff --git a/src/MongoDB/ServerDescription.c b/src/MongoDB/ServerDescription.c index 172f20de6..5cf93868e 100644 --- a/src/MongoDB/ServerDescription.c +++ b/src/MongoDB/ServerDescription.c @@ -45,6 +45,7 @@ php_phongo_server_description_type_map_t }; PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_ServerDescription) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_ServerDescription) /* {{{ proto array MongoDB\Driver\ServerDescription::getHelloResponse() Returns the most recent "hello" response */ diff --git a/src/MongoDB/ServerDescription.stub.php b/src/MongoDB/ServerDescription.stub.php index 57a8f42ec..c10f30ff3 100644 --- a/src/MongoDB/ServerDescription.stub.php +++ b/src/MongoDB/ServerDescription.stub.php @@ -82,4 +82,6 @@ final public function getPort(): int {} final public function getRoundTripTime(): ?int {} final public function getType(): string {} + + final public function __wakeup(): void {} } diff --git a/src/MongoDB/ServerDescription_arginfo.h b/src/MongoDB/ServerDescription_arginfo.h index 83c7881e7..8baf74c4b 100644 --- a/src/MongoDB/ServerDescription_arginfo.h +++ b/src/MongoDB/ServerDescription_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 85cce1e6824dec5cb0d659b841d893a849948eeb */ + * Stub hash: f08f0c45a9719ff708a03b5470cb6b0822f8f908 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ServerDescription___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -20,6 +20,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_Driver_ServerDescription_getType arginfo_class_MongoDB_Driver_ServerDescription_getHost +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ServerDescription___wakeup, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + static ZEND_METHOD(MongoDB_Driver_ServerDescription, __construct); static ZEND_METHOD(MongoDB_Driver_ServerDescription, getHelloResponse); @@ -28,6 +31,7 @@ static ZEND_METHOD(MongoDB_Driver_ServerDescription, getLastUpdateTime); static ZEND_METHOD(MongoDB_Driver_ServerDescription, getPort); static ZEND_METHOD(MongoDB_Driver_ServerDescription, getRoundTripTime); static ZEND_METHOD(MongoDB_Driver_ServerDescription, getType); +static ZEND_METHOD(MongoDB_Driver_ServerDescription, __wakeup); static const zend_function_entry class_MongoDB_Driver_ServerDescription_methods[] = { @@ -38,6 +42,7 @@ static const zend_function_entry class_MongoDB_Driver_ServerDescription_methods[ ZEND_ME(MongoDB_Driver_ServerDescription, getPort, arginfo_class_MongoDB_Driver_ServerDescription_getPort, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ServerDescription, getRoundTripTime, arginfo_class_MongoDB_Driver_ServerDescription_getRoundTripTime, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_ServerDescription, getType, arginfo_class_MongoDB_Driver_ServerDescription_getType, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_ServerDescription, __wakeup, arginfo_class_MongoDB_Driver_ServerDescription___wakeup, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END }; diff --git a/src/MongoDB/TopologyDescription.c b/src/MongoDB/TopologyDescription.c index ab24eb6ba..4af120f5b 100644 --- a/src/MongoDB/TopologyDescription.c +++ b/src/MongoDB/TopologyDescription.c @@ -32,6 +32,7 @@ zend_class_entry* php_phongo_topologydescription_ce; PHONGO_DISABLED_CONSTRUCTOR(MongoDB_Driver_TopologyDescription) +PHONGO_DISABLED_WAKEUP(MongoDB_Driver_TopologyDescription) /* {{{ proto array MongoDB\Driver\TopologyDescription::getServers() Returns an array of ServerDescription objects for all known servers in the topology */ diff --git a/src/MongoDB/TopologyDescription.stub.php b/src/MongoDB/TopologyDescription.stub.php index 46c8d045c..5c2c61163 100644 --- a/src/MongoDB/TopologyDescription.stub.php +++ b/src/MongoDB/TopologyDescription.stub.php @@ -54,4 +54,6 @@ final public function getType(): string {} final public function hasReadableServer(?ReadPreference $readPreference = null): bool {} final public function hasWritableServer(): bool {} + + final public function __wakeup(): void {} } diff --git a/src/MongoDB/TopologyDescription_arginfo.h b/src/MongoDB/TopologyDescription_arginfo.h index a3b6049db..5dd72cd7f 100644 --- a/src/MongoDB/TopologyDescription_arginfo.h +++ b/src/MongoDB/TopologyDescription_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7c61addf17e525496c8755d437b4db423f6be59d */ + * Stub hash: 6981655ece74ddf6f2cac7e5704c5f764bb0a2ef */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_TopologyDescription___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -17,12 +17,16 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_TopologyDescription_hasWritableServer, 0, 0, _IS_BOOL, 0) ZEND_END_ARG_INFO() +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_TopologyDescription___wakeup, 0, 0, IS_VOID, 0) +ZEND_END_ARG_INFO() + static ZEND_METHOD(MongoDB_Driver_TopologyDescription, __construct); static ZEND_METHOD(MongoDB_Driver_TopologyDescription, getServers); static ZEND_METHOD(MongoDB_Driver_TopologyDescription, getType); static ZEND_METHOD(MongoDB_Driver_TopologyDescription, hasReadableServer); static ZEND_METHOD(MongoDB_Driver_TopologyDescription, hasWritableServer); +static ZEND_METHOD(MongoDB_Driver_TopologyDescription, __wakeup); static const zend_function_entry class_MongoDB_Driver_TopologyDescription_methods[] = { @@ -31,6 +35,7 @@ static const zend_function_entry class_MongoDB_Driver_TopologyDescription_method ZEND_ME(MongoDB_Driver_TopologyDescription, getType, arginfo_class_MongoDB_Driver_TopologyDescription_getType, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_TopologyDescription, hasReadableServer, arginfo_class_MongoDB_Driver_TopologyDescription_hasReadableServer, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_TopologyDescription, hasWritableServer, arginfo_class_MongoDB_Driver_TopologyDescription_hasWritableServer, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_TopologyDescription, __wakeup, arginfo_class_MongoDB_Driver_TopologyDescription___wakeup, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END };