Skip to content

Commit fc928f5

Browse files
committed
Narrow return type of bsonSerialize implementations
1 parent 76a13cb commit fc928f5

8 files changed

+12
-99
lines changed

src/MongoDB/ReadConcern.stub.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,7 @@ final public function isDefault(): bool {}
4747

4848
final public static function __set_state(array $properties): ReadConcern {}
4949

50-
#if PHP_VERSION_ID >= 80000
51-
final public function bsonSerialize(): array|\stdClass {}
52-
#else
53-
/** @return array|\stdClass */
54-
final public function bsonSerialize() {}
55-
#endif
50+
final public function bsonSerialize(): \stdClass {}
5651

5752
final public function serialize(): string {}
5853

src/MongoDB/ReadConcern_arginfo.h

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: b8616bced8b4b9fcc10eb931a081c4476ff5d134 */
2+
* Stub hash: da6e980fbfe2102334158e3018b827e0bb0a9ec3 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern___construct, 0, 0, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, level, IS_STRING, 1, "null")
@@ -15,15 +15,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern_
1515
ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0)
1616
ZEND_END_ARG_INFO()
1717

18-
#if PHP_VERSION_ID >= 80000
19-
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_ReadConcern_bsonSerialize, 0, 0, stdClass, MAY_BE_ARRAY)
20-
ZEND_END_ARG_INFO()
21-
#endif
22-
23-
#if !(PHP_VERSION_ID >= 80000)
24-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern_bsonSerialize, 0, 0, 0)
18+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern_bsonSerialize, 0, 0, stdClass, 0)
2519
ZEND_END_ARG_INFO()
26-
#endif
2720

2821
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ReadConcern_serialize, 0, 0, IS_STRING, 0)
2922
ZEND_END_ARG_INFO()
@@ -52,12 +45,7 @@ static ZEND_METHOD(MongoDB_Driver_ReadConcern, __construct);
5245
static ZEND_METHOD(MongoDB_Driver_ReadConcern, getLevel);
5346
static ZEND_METHOD(MongoDB_Driver_ReadConcern, isDefault);
5447
static ZEND_METHOD(MongoDB_Driver_ReadConcern, __set_state);
55-
#if PHP_VERSION_ID >= 80000
56-
static ZEND_METHOD(MongoDB_Driver_ReadConcern, bsonSerialize);
57-
#endif
58-
#if !(PHP_VERSION_ID >= 80000)
5948
static ZEND_METHOD(MongoDB_Driver_ReadConcern, bsonSerialize);
60-
#endif
6149
static ZEND_METHOD(MongoDB_Driver_ReadConcern, serialize);
6250
#if PHP_VERSION_ID >= 80000
6351
static ZEND_METHOD(MongoDB_Driver_ReadConcern, unserialize);
@@ -74,12 +62,7 @@ static const zend_function_entry class_MongoDB_Driver_ReadConcern_methods[] = {
7462
ZEND_ME(MongoDB_Driver_ReadConcern, getLevel, arginfo_class_MongoDB_Driver_ReadConcern_getLevel, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
7563
ZEND_ME(MongoDB_Driver_ReadConcern, isDefault, arginfo_class_MongoDB_Driver_ReadConcern_isDefault, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
7664
ZEND_ME(MongoDB_Driver_ReadConcern, __set_state, arginfo_class_MongoDB_Driver_ReadConcern___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
77-
#if PHP_VERSION_ID >= 80000
7865
ZEND_ME(MongoDB_Driver_ReadConcern, bsonSerialize, arginfo_class_MongoDB_Driver_ReadConcern_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
79-
#endif
80-
#if !(PHP_VERSION_ID >= 80000)
81-
ZEND_ME(MongoDB_Driver_ReadConcern, bsonSerialize, arginfo_class_MongoDB_Driver_ReadConcern_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
82-
#endif
8366
ZEND_ME(MongoDB_Driver_ReadConcern, serialize, arginfo_class_MongoDB_Driver_ReadConcern_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
8467
#if PHP_VERSION_ID >= 80000
8568
ZEND_ME(MongoDB_Driver_ReadConcern, unserialize, arginfo_class_MongoDB_Driver_ReadConcern_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)

src/MongoDB/ReadPreference.stub.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,7 @@ final public function getTagSets(): array {}
100100

101101
final public static function __set_state(array $properties): ReadPreference {}
102102

103-
#if PHP_VERSION_ID >= 80000
104-
final public function bsonSerialize(): array|\stdClass {}
105-
#else
106-
/** @return array|\stdClass */
107-
final public function bsonSerialize() {}
108-
#endif
103+
final public function bsonSerialize(): \stdClass {}
109104

110105
final public function serialize(): string {}
111106

src/MongoDB/ReadPreference_arginfo.h

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 9868e4e3be9c2df920f996b7b881c67e2d46e6ea */
2+
* Stub hash: 1a1a31ef5910ddfbe66ba6c350df216ffe25b5dd */
33

44
#if PHP_VERSION_ID >= 80000
55
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference___construct, 0, 0, 1)
@@ -35,15 +35,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreferen
3535
ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0)
3636
ZEND_END_ARG_INFO()
3737

38-
#if PHP_VERSION_ID >= 80000
39-
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_ReadPreference_bsonSerialize, 0, 0, stdClass, MAY_BE_ARRAY)
40-
ZEND_END_ARG_INFO()
41-
#endif
42-
43-
#if !(PHP_VERSION_ID >= 80000)
44-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference_bsonSerialize, 0, 0, 0)
38+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ReadPreference_bsonSerialize, 0, 0, stdClass, 0)
4539
ZEND_END_ARG_INFO()
46-
#endif
4740

4841
#define arginfo_class_MongoDB_Driver_ReadPreference_serialize arginfo_class_MongoDB_Driver_ReadPreference_getModeString
4942

@@ -78,12 +71,7 @@ static ZEND_METHOD(MongoDB_Driver_ReadPreference, getMode);
7871
static ZEND_METHOD(MongoDB_Driver_ReadPreference, getModeString);
7972
static ZEND_METHOD(MongoDB_Driver_ReadPreference, getTagSets);
8073
static ZEND_METHOD(MongoDB_Driver_ReadPreference, __set_state);
81-
#if PHP_VERSION_ID >= 80000
82-
static ZEND_METHOD(MongoDB_Driver_ReadPreference, bsonSerialize);
83-
#endif
84-
#if !(PHP_VERSION_ID >= 80000)
8574
static ZEND_METHOD(MongoDB_Driver_ReadPreference, bsonSerialize);
86-
#endif
8775
static ZEND_METHOD(MongoDB_Driver_ReadPreference, serialize);
8876
#if PHP_VERSION_ID >= 80000
8977
static ZEND_METHOD(MongoDB_Driver_ReadPreference, unserialize);
@@ -108,12 +96,7 @@ static const zend_function_entry class_MongoDB_Driver_ReadPreference_methods[] =
10896
ZEND_ME(MongoDB_Driver_ReadPreference, getModeString, arginfo_class_MongoDB_Driver_ReadPreference_getModeString, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
10997
ZEND_ME(MongoDB_Driver_ReadPreference, getTagSets, arginfo_class_MongoDB_Driver_ReadPreference_getTagSets, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
11098
ZEND_ME(MongoDB_Driver_ReadPreference, __set_state, arginfo_class_MongoDB_Driver_ReadPreference___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
111-
#if PHP_VERSION_ID >= 80000
11299
ZEND_ME(MongoDB_Driver_ReadPreference, bsonSerialize, arginfo_class_MongoDB_Driver_ReadPreference_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
113-
#endif
114-
#if !(PHP_VERSION_ID >= 80000)
115-
ZEND_ME(MongoDB_Driver_ReadPreference, bsonSerialize, arginfo_class_MongoDB_Driver_ReadPreference_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
116-
#endif
117100
ZEND_ME(MongoDB_Driver_ReadPreference, serialize, arginfo_class_MongoDB_Driver_ReadPreference_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
118101
#if PHP_VERSION_ID >= 80000
119102
ZEND_ME(MongoDB_Driver_ReadPreference, unserialize, arginfo_class_MongoDB_Driver_ReadPreference_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)

src/MongoDB/ServerApi.stub.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ final public function __construct(string $version, ?bool $strict = null, ?bool $
1616

1717
final public static function __set_state(array $properties): ServerApi {}
1818

19-
#if PHP_VERSION_ID >= 80000
20-
final public function bsonSerialize(): array|\stdClass {}
21-
#else
22-
/** @return array|\stdClass */
23-
final public function bsonSerialize() {}
24-
#endif
19+
final public function bsonSerialize(): \stdClass {}
2520

2621
final public function serialize(): string {}
2722

src/MongoDB/ServerApi_arginfo.h

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 50ac33dea8943336b9c562a90e189036c90f1479 */
2+
* Stub hash: 7678bfacdb398a3528feb4226a5ca1b8a21b9516 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, version, IS_STRING, 0)
@@ -11,15 +11,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi___
1111
ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0)
1212
ZEND_END_ARG_INFO()
1313

14-
#if PHP_VERSION_ID >= 80000
15-
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_ServerApi_bsonSerialize, 0, 0, stdClass, MAY_BE_ARRAY)
16-
ZEND_END_ARG_INFO()
17-
#endif
18-
19-
#if !(PHP_VERSION_ID >= 80000)
20-
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi_bsonSerialize, 0, 0, 0)
14+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi_bsonSerialize, 0, 0, stdClass, 0)
2115
ZEND_END_ARG_INFO()
22-
#endif
2316

2417
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_ServerApi_serialize, 0, 0, IS_STRING, 0)
2518
ZEND_END_ARG_INFO()
@@ -46,12 +39,7 @@ ZEND_END_ARG_INFO()
4639

4740
static ZEND_METHOD(MongoDB_Driver_ServerApi, __construct);
4841
static ZEND_METHOD(MongoDB_Driver_ServerApi, __set_state);
49-
#if PHP_VERSION_ID >= 80000
50-
static ZEND_METHOD(MongoDB_Driver_ServerApi, bsonSerialize);
51-
#endif
52-
#if !(PHP_VERSION_ID >= 80000)
5342
static ZEND_METHOD(MongoDB_Driver_ServerApi, bsonSerialize);
54-
#endif
5543
static ZEND_METHOD(MongoDB_Driver_ServerApi, serialize);
5644
#if PHP_VERSION_ID >= 80000
5745
static ZEND_METHOD(MongoDB_Driver_ServerApi, unserialize);
@@ -66,12 +54,7 @@ static ZEND_METHOD(MongoDB_Driver_ServerApi, __serialize);
6654
static const zend_function_entry class_MongoDB_Driver_ServerApi_methods[] = {
6755
ZEND_ME(MongoDB_Driver_ServerApi, __construct, arginfo_class_MongoDB_Driver_ServerApi___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
6856
ZEND_ME(MongoDB_Driver_ServerApi, __set_state, arginfo_class_MongoDB_Driver_ServerApi___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
69-
#if PHP_VERSION_ID >= 80000
7057
ZEND_ME(MongoDB_Driver_ServerApi, bsonSerialize, arginfo_class_MongoDB_Driver_ServerApi_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
71-
#endif
72-
#if !(PHP_VERSION_ID >= 80000)
73-
ZEND_ME(MongoDB_Driver_ServerApi, bsonSerialize, arginfo_class_MongoDB_Driver_ServerApi_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
74-
#endif
7558
ZEND_ME(MongoDB_Driver_ServerApi, serialize, arginfo_class_MongoDB_Driver_ServerApi_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
7659
#if PHP_VERSION_ID >= 80000
7760
ZEND_ME(MongoDB_Driver_ServerApi, unserialize, arginfo_class_MongoDB_Driver_ServerApi_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)

src/MongoDB/WriteConcern.stub.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,7 @@ final public function isDefault(): bool {}
3737

3838
final public static function __set_state(array $properties): WriteConcern {}
3939

40-
#if PHP_VERSION_ID >= 80000
41-
final public function bsonSerialize(): array|\stdClass {}
42-
#else
43-
/** @return array|\stdClass */
44-
final public function bsonSerialize() {}
45-
#endif
40+
final public function bsonSerialize(): \stdClass {}
4641

4742
final public function serialize(): string {}
4843

src/MongoDB/WriteConcern_arginfo.h

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: bc052f233ec885eb7209a77d32fd9290a2a101e3 */
2+
* Stub hash: 690913f0505161b1b2ca35495c4cdb06c263aacb */
33

44
#if PHP_VERSION_ID >= 80000
55
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern___construct, 0, 0, 1)
@@ -40,14 +40,8 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern
4040
ZEND_ARG_TYPE_INFO(0, properties, IS_ARRAY, 0)
4141
ZEND_END_ARG_INFO()
4242

43-
#if PHP_VERSION_ID >= 80000
44-
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_MongoDB_Driver_WriteConcern_bsonSerialize, 0, 0, stdClass, MAY_BE_ARRAY)
43+
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_bsonSerialize, 0, 0, stdClass, 0)
4544
ZEND_END_ARG_INFO()
46-
#endif
47-
48-
#if !(PHP_VERSION_ID >= 80000)
49-
#define arginfo_class_MongoDB_Driver_WriteConcern_bsonSerialize arginfo_class_MongoDB_Driver_WriteConcern_getW
50-
#endif
5145

5246
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_WriteConcern_serialize, 0, 0, IS_STRING, 0)
5347
ZEND_END_ARG_INFO()
@@ -88,12 +82,7 @@ static ZEND_METHOD(MongoDB_Driver_WriteConcern, getW);
8882
static ZEND_METHOD(MongoDB_Driver_WriteConcern, getWtimeout);
8983
static ZEND_METHOD(MongoDB_Driver_WriteConcern, isDefault);
9084
static ZEND_METHOD(MongoDB_Driver_WriteConcern, __set_state);
91-
#if PHP_VERSION_ID >= 80000
9285
static ZEND_METHOD(MongoDB_Driver_WriteConcern, bsonSerialize);
93-
#endif
94-
#if !(PHP_VERSION_ID >= 80000)
95-
static ZEND_METHOD(MongoDB_Driver_WriteConcern, bsonSerialize);
96-
#endif
9786
static ZEND_METHOD(MongoDB_Driver_WriteConcern, serialize);
9887
#if PHP_VERSION_ID >= 80000
9988
static ZEND_METHOD(MongoDB_Driver_WriteConcern, unserialize);
@@ -122,12 +111,7 @@ static const zend_function_entry class_MongoDB_Driver_WriteConcern_methods[] = {
122111
ZEND_ME(MongoDB_Driver_WriteConcern, getWtimeout, arginfo_class_MongoDB_Driver_WriteConcern_getWtimeout, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
123112
ZEND_ME(MongoDB_Driver_WriteConcern, isDefault, arginfo_class_MongoDB_Driver_WriteConcern_isDefault, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
124113
ZEND_ME(MongoDB_Driver_WriteConcern, __set_state, arginfo_class_MongoDB_Driver_WriteConcern___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
125-
#if PHP_VERSION_ID >= 80000
126114
ZEND_ME(MongoDB_Driver_WriteConcern, bsonSerialize, arginfo_class_MongoDB_Driver_WriteConcern_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
127-
#endif
128-
#if !(PHP_VERSION_ID >= 80000)
129-
ZEND_ME(MongoDB_Driver_WriteConcern, bsonSerialize, arginfo_class_MongoDB_Driver_WriteConcern_bsonSerialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
130-
#endif
131115
ZEND_ME(MongoDB_Driver_WriteConcern, serialize, arginfo_class_MongoDB_Driver_WriteConcern_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
132116
#if PHP_VERSION_ID >= 80000
133117
ZEND_ME(MongoDB_Driver_WriteConcern, unserialize, arginfo_class_MongoDB_Driver_WriteConcern_unserialize, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)

0 commit comments

Comments
 (0)