Skip to content

Commit 3bb9c8a

Browse files
alcaeusisfedorov
authored andcommitted
Add missing stubs
1 parent 614f009 commit 3bb9c8a

Some content is hidden

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

51 files changed

+863
-415
lines changed

PhpStormStubsMap.php

+12
Original file line numberDiff line numberDiff line change
@@ -682,13 +682,25 @@ final class PhpStormStubsMap
682682
'MongoDB\\Driver\\Monitoring\\CommandStartedEvent' => 'mongodb/Monitoring/CommandStartedEvent.php',
683683
'MongoDB\\Driver\\Monitoring\\CommandSubscriber' => 'mongodb/Monitoring/CommandSubscriber.php',
684684
'MongoDB\\Driver\\Monitoring\\CommandSucceededEvent' => 'mongodb/Monitoring/CommandSucceededEvent.php',
685+
'MongoDB\\Driver\\Monitoring\\SDAMSubscriber' => 'mongodb/Monitoring/SDAMSubscriber.php',
686+
'MongoDB\\Driver\\Monitoring\\ServerChangedEvent' => 'mongodb/Monitoring/ServerChangedEvent.php',
687+
'MongoDB\\Driver\\Monitoring\\ServerClosedEvent' => 'mongodb/Monitoring/ServerClosedEvent.php',
688+
'MongoDB\\Driver\\Monitoring\\ServerHeartbeatFailedEvent' => 'mongodb/Monitoring/ServerHeartbeatFailedEvent.php',
689+
'MongoDB\\Driver\\Monitoring\\ServerHeartbeatStartedEvent' => 'mongodb/Monitoring/ServerHeartbeatStartedEvent.php',
690+
'MongoDB\\Driver\\Monitoring\\ServerHeartbeatSucceededEvent' => 'mongodb/Monitoring/ServerHeartbeatSucceededEvent.php',
691+
'MongoDB\\Driver\\Monitoring\\ServerOpeningEvent' => 'mongodb/Monitoring/ServerOpeningEvent.php',
685692
'MongoDB\\Driver\\Monitoring\\Subscriber' => 'mongodb/Monitoring/Subscriber.php',
693+
'MongoDB\\Driver\\Monitoring\\TopologyChangedEvent' => 'mongodb/Monitoring/TopologyChangedEvent.php',
694+
'MongoDB\\Driver\\Monitoring\\TopologyClosedEvent' => 'mongodb/Monitoring/TopologyClosedEvent.php',
695+
'MongoDB\\Driver\\Monitoring\\TopologyOpeningEvent' => 'mongodb/Monitoring/TopologyOpeningEvent.php',
686696
'MongoDB\\Driver\\Query' => 'mongodb/Query.php',
687697
'MongoDB\\Driver\\ReadConcern' => 'mongodb/ReadConcern.php',
688698
'MongoDB\\Driver\\ReadPreference' => 'mongodb/ReadPreference.php',
689699
'MongoDB\\Driver\\Server' => 'mongodb/Server.php',
690700
'MongoDB\\Driver\\ServerApi' => 'mongodb/ServerApi.php',
701+
'MongoDB\\Driver\\ServerDescription' => 'mongodb/ServerDescription.php',
691702
'MongoDB\\Driver\\Session' => 'mongodb/Session.php',
703+
'MongoDB\\Driver\\TopologyDescription' => 'mongodb/TopologyDescription.php',
692704
'MongoDB\\Driver\\WriteConcern' => 'mongodb/WriteConcern.php',
693705
'MongoDB\\Driver\\WriteConcernError' => 'mongodb/WriteConcernError.php',
694706
'MongoDB\\Driver\\WriteError' => 'mongodb/WriteError.php',

mongodb/BSON/Binary.php

+11-14
Original file line numberDiff line numberDiff line change
@@ -23,58 +23,55 @@ final class Binary implements Type, BinaryInterface, \Serializable, JsonSerializ
2323
* @since 1.7.0
2424
*/
2525
public const TYPE_ENCRYPTED = 6;
26+
27+
/**
28+
* @since 1.12.0
29+
*/
30+
public const TYPE_COLUMN = 7;
2631
public const TYPE_USER_DEFINED = 128;
2732

2833
/**
2934
* Binary constructor.
3035
* @link https://php.net/manual/en/mongodb-bson-binary.construct.php
31-
* @param string $data
32-
* @param int $type
3336
*/
34-
final public function __construct($data, $type) {}
37+
final public function __construct(string $data, int $type = Binary::TYPE_GENERIC) {}
3538

3639
/**
3740
* Returns the Binary's data
3841
* @link https://php.net/manual/en/mongodb-bson-binary.getdata.php
39-
* @return string
4042
*/
41-
final public function getData() {}
43+
final public function getData(): string {}
4244

4345
/**
4446
* Returns the Binary's type
4547
* @link https://php.net/manual/en/mongodb-bson-binary.gettype.php
46-
* @return int
4748
*/
48-
final public function getType() {}
49+
final public function getType(): int {}
4950

5051
public static function __set_state(array $properties) {}
5152

5253
/**
5354
* Returns the Binary's data
5455
* @link https://www.php.net/manual/en/mongodb-bson-binary.tostring.php
55-
* @return string
5656
*/
57-
final public function __toString() {}
57+
final public function __toString(): string {}
5858

5959
/**
6060
* Serialize a Binary
6161
* @since 1.2.0
6262
* @link https://www.php.net/manual/en/mongodb-bson-binary.serialize.php
63-
* @return string
6463
* @throws InvalidArgumentException
6564
*/
66-
final public function serialize() {}
65+
final public function serialize(): string {}
6766

6867
/**
6968
* Unserialize a Binary
7069
* @since 1.2.0
7170
* @link https://www.php.net/manual/en/mongodb-bson-binary.unserialize.php
72-
* @param string $serialized
73-
* @return void
7471
* @throws InvalidArgumentException on argument parsing errors or if the properties are invalid
7572
* @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed)
7673
*/
77-
final public function unserialize($serialized) {}
74+
final public function unserialize(string $data) {}
7875

7976
/**
8077
* Returns a representation that can be converted to JSON

mongodb/BSON/DBPointer.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final private function __construct() {}
2525
* @return string
2626
* @throws InvalidArgumentException
2727
*/
28-
final public function serialize() {}
28+
final public function serialize(): string {}
2929

3030
/**
3131
* Unserialize a DBPointer
@@ -38,7 +38,7 @@ final public function serialize() {}
3838
* @throws InvalidArgumentException on argument parsing errors or if the properties are invalid
3939
* @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed)
4040
*/
41-
final public function unserialize($serialized) {}
41+
final public function unserialize(string $data): void {}
4242

4343
/**
4444
* Returns a representation that can be converted to JSON
@@ -54,5 +54,5 @@ final public function jsonSerialize() {}
5454
*
5555
* @return string Returns the string representation of this Symbol.
5656
*/
57-
final public function __toString() {}
57+
final public function __toString(): string {}
5858
}

mongodb/BSON/Decimal128.php

+4-7
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ final class Decimal128 implements Type, Decimal128Interface, \Serializable, Json
1717
* @link https://php.net/manual/en/mongodb-bson-decimal128.construct.php
1818
* @param string $value A decimal string.
1919
*/
20-
final public function __construct($value = '') {}
20+
final public function __construct(string $value = '') {}
2121

2222
/**
2323
* Returns the string representation of this Decimal128
2424
* @link https://php.net/manual/en/mongodb-bson-decimal128.tostring.php
25-
* @return string
2625
*/
27-
final public function __toString() {}
26+
final public function __toString(): string {}
2827

2928
public static function __set_state(array $properties) {}
3029

@@ -35,18 +34,16 @@ public static function __set_state(array $properties) {}
3534
* @return string
3635
* @throws InvalidArgumentException
3736
*/
38-
final public function serialize() {}
37+
final public function serialize(): string {}
3938

4039
/**
4140
* Unserialize a Decimal128
4241
* @since 1.2.0
4342
* @link https://www.php.net/manual/en/mongodb-bson-decimal128.unserialize.php
44-
* @param string $serialized
45-
* @return void
4643
* @throws InvalidArgumentException on argument parsing errors or if the properties are invalid
4744
* @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed)
4845
*/
49-
final public function unserialize($serialized) {}
46+
final public function unserialize(string $data): void {}
5047

5148
/**
5249
* Returns a representation that can be converted to JSON

mongodb/BSON/Document.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ final public static function __set_state(array $properties): Document {}
3434

3535
final public function serialize(): string {}
3636

37-
/** @param string $serialized */
38-
final public function unserialize($serialized): void {}
37+
final public function unserialize(string $data): void {}
3938

4039
final public function __unserialize(array $data): void {}
4140

mongodb/BSON/Int64.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,19 @@ final public function __construct(string|int $value) {}
1919
/**
2020
* Serialize an Int64
2121
* @link https://www.php.net/manual/en/mongodb-bson-int64.serialize.php
22-
* @return string
2322
* @throws InvalidArgumentException
2423
*/
25-
final public function serialize() {}
24+
final public function serialize(): string {}
2625

2726
public static function __set_state(array $properties) {}
2827

2928
/**
3029
* Unserialize an Int64
3130
* @link https://www.php.net/manual/en/mongodb-bson-int64.unserialize.php
32-
* @param string $serialized
33-
* @return void
3431
* @throws InvalidArgumentException on argument parsing errors or if the properties are invalid
3532
* @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed)
3633
*/
37-
final public function unserialize($serialized) {}
34+
final public function unserialize(string $data): void {}
3835

3936
/**
4037
* Returns a representation that can be converted to JSON
@@ -48,5 +45,5 @@ final public function jsonSerialize() {}
4845
* Returns the Symbol as a string
4946
* @return string Returns the string representation of this Symbol.
5047
*/
51-
final public function __toString() {}
48+
final public function __toString(): string {}
5249
}

mongodb/BSON/Javascript.php

+6-14
Original file line numberDiff line numberDiff line change
@@ -15,53 +15,45 @@ final class Javascript implements Type, JavascriptInterface, \Serializable, Json
1515
/**
1616
* Construct a new Javascript
1717
* @link https://php.net/manual/en/mongodb-bson-javascript.construct.php
18-
* @param string $javascript
19-
* @param array|object $scope
2018
*/
21-
final public function __construct($javascript, $scope = []) {}
19+
final public function __construct(string $javascript, array|object|null $scope = null) {}
2220

2321
public static function __set_state(array $properties) {}
2422

2523
/**
2624
* Returns the Javascript's code
27-
* @return string
2825
* @link https://secure.php.net/manual/en/mongodb-bson-javascript.getcode.php
2926
*/
30-
final public function getCode() {}
27+
final public function getCode(): string {}
3128

3229
/**
3330
* Returns the Javascript's scope document
34-
* @return object|null
3531
* @link https://secure.php.net/manual/en/mongodb-bson-javascript.getscope.php
3632
*/
37-
final public function getScope() {}
33+
final public function getScope(): ?object {}
3834

3935
/**
4036
* Returns the Javascript's code
41-
* @return string
4237
* @link https://secure.php.net/manual/en/mongodb-bson-javascript.tostring.php
4338
*/
44-
final public function __toString() {}
39+
final public function __toString(): string {}
4540

4641
/**
4742
* Serialize a Javascript
4843
* @since 1.2.0
4944
* @link https://www.php.net/manual/en/mongodb-bson-javascript.serialize.php
50-
* @return string
5145
* @throws InvalidArgumentException
5246
*/
53-
final public function serialize() {}
47+
final public function serialize(): string {}
5448

5549
/**
5650
* Unserialize a Javascript
5751
* @since 1.2.0
5852
* @link https://www.php.net/manual/en/mongodb-bson-javascript.unserialize.php
59-
* @param string $serialized
60-
* @return void
6153
* @throws InvalidArgumentException on argument parsing errors or if the properties are invalid
6254
* @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed)
6355
*/
64-
final public function unserialize($serialized) {}
56+
final public function unserialize(string $data): void {}
6557

6658
/**
6759
* Returns a representation that can be converted to JSON

mongodb/BSON/MaxKey.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,18 @@ public static function __set_state(array $properties) {}
1818
* Serialize a MaxKey
1919
* @since 1.2.0
2020
* @link https://www.php.net/manual/en/mongodb-bson-maxkey.serialize.php
21-
* @return string
2221
* @throws InvalidArgumentException
2322
*/
24-
final public function serialize() {}
23+
final public function serialize(): string {}
2524

2625
/**
2726
* Unserialize a MaxKey
2827
* @since 1.2.0
2928
* @link https://www.php.net/manual/en/mongodb-bson-maxkey.unserialize.php
30-
* @param string $serialized
31-
* @return void
3229
* @throws InvalidArgumentException on argument parsing errors or if the properties are invalid
3330
* @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed)
3431
*/
35-
final public function unserialize($serialized) {}
32+
final public function unserialize(string $data): void {}
3633

3734
/**
3835
* Returns a representation that can be converted to JSON

mongodb/BSON/MinKey.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,18 @@ public static function __set_state(array $properties) {}
1818
* Serialize a MinKey
1919
* @since 1.2.0
2020
* @link https://www.php.net/manual/en/mongodb-bson-minkey.serialize.php
21-
* @return string
2221
* @throws InvalidArgumentException
2322
*/
24-
final public function serialize() {}
23+
final public function serialize(): string {}
2524

2625
/**
2726
* Unserialize a MinKey
2827
* @since 1.2.0
2928
* @link https://www.php.net/manual/en/mongodb-bson-minkey.unserialize.php
30-
* @param string $serialized
31-
* @return void
3229
* @throws InvalidArgumentException on argument parsing errors or if the properties are invalid
3330
* @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed)
3431
*/
35-
final public function unserialize($serialized) {}
32+
final public function unserialize(string $data): void {}
3633

3734
/**
3835
* Returns a representation that can be converted to JSON

mongodb/BSON/ObjectId.php

+5-8
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ final class ObjectId implements Type, ObjectIdInterface, \Serializable, JsonSeri
1717
* @param string|null $id A 24-character hexadecimal string. If not provided, the driver will generate an ObjectId.
1818
* @throws InvalidArgumentException if id is not a 24-character hexadecimal string.
1919
*/
20-
final public function __construct($id = null) {}
20+
final public function __construct(?string $id = null) {}
2121

2222
/**
2323
* Returns the hexadecimal representation of this ObjectId
2424
* @link https://php.net/manual/en/mongodb-bson-objectid.tostring.php
25-
* @return string
2625
*/
27-
final public function __toString() {}
26+
final public function __toString(): string {}
2827

2928
public static function __set_state(array $properties) {}
3029

@@ -34,7 +33,7 @@ public static function __set_state(array $properties) {}
3433
* @link https://secure.php.net/manual/en/mongodb-bson-objectid.gettimestamp.php
3534
* @return int the timestamp component of this ObjectId
3635
*/
37-
final public function getTimestamp() {}
36+
final public function getTimestamp(): int {}
3837

3938
/**
4039
* Returns a representation that can be converted to JSON
@@ -48,15 +47,13 @@ final public function jsonSerialize() {}
4847
* Serialize an ObjectId
4948
* @since 1.2.0
5049
* @link https://secure.php.net/manual/en/mongodb-bson-objectid.serialize.php
51-
* @return string the serialized representation of the object
5250
*/
53-
final public function serialize() {}
51+
final public function serialize(): string {}
5452

5553
/**
5654
* Unserialize an ObjectId
5755
* @since 1.2.0
5856
* @link https://secure.php.net/manual/en/mongodb-bson-objectid.unserialize.php
59-
* @return void
6057
*/
61-
final public function unserialize($serialized) {}
58+
final public function unserialize(string $data): void {}
6259
}

mongodb/BSON/PackedArray.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ final public static function __set_state(array $properties): PackedArray {}
2626

2727
final public function serialize(): string {}
2828

29-
/** @param string $serialized */
30-
final public function unserialize($serialized): void {}
29+
final public function unserialize(string $data): void {}
3130

3231
final public function __unserialize(array $data): void {}
3332

0 commit comments

Comments
 (0)