diff --git a/PhpStormStubsMap.php b/PhpStormStubsMap.php index 0371a9654..b61fa2b53 100644 --- a/PhpStormStubsMap.php +++ b/PhpStormStubsMap.php @@ -682,13 +682,25 @@ final class PhpStormStubsMap 'MongoDB\\Driver\\Monitoring\\CommandStartedEvent' => 'mongodb/Monitoring/CommandStartedEvent.php', 'MongoDB\\Driver\\Monitoring\\CommandSubscriber' => 'mongodb/Monitoring/CommandSubscriber.php', 'MongoDB\\Driver\\Monitoring\\CommandSucceededEvent' => 'mongodb/Monitoring/CommandSucceededEvent.php', + 'MongoDB\\Driver\\Monitoring\\SDAMSubscriber' => 'mongodb/Monitoring/SDAMSubscriber.php', + 'MongoDB\\Driver\\Monitoring\\ServerChangedEvent' => 'mongodb/Monitoring/ServerChangedEvent.php', + 'MongoDB\\Driver\\Monitoring\\ServerClosedEvent' => 'mongodb/Monitoring/ServerClosedEvent.php', + 'MongoDB\\Driver\\Monitoring\\ServerHeartbeatFailedEvent' => 'mongodb/Monitoring/ServerHeartbeatFailedEvent.php', + 'MongoDB\\Driver\\Monitoring\\ServerHeartbeatStartedEvent' => 'mongodb/Monitoring/ServerHeartbeatStartedEvent.php', + 'MongoDB\\Driver\\Monitoring\\ServerHeartbeatSucceededEvent' => 'mongodb/Monitoring/ServerHeartbeatSucceededEvent.php', + 'MongoDB\\Driver\\Monitoring\\ServerOpeningEvent' => 'mongodb/Monitoring/ServerOpeningEvent.php', 'MongoDB\\Driver\\Monitoring\\Subscriber' => 'mongodb/Monitoring/Subscriber.php', + 'MongoDB\\Driver\\Monitoring\\TopologyChangedEvent' => 'mongodb/Monitoring/TopologyChangedEvent.php', + 'MongoDB\\Driver\\Monitoring\\TopologyClosedEvent' => 'mongodb/Monitoring/TopologyClosedEvent.php', + 'MongoDB\\Driver\\Monitoring\\TopologyOpeningEvent' => 'mongodb/Monitoring/TopologyOpeningEvent.php', 'MongoDB\\Driver\\Query' => 'mongodb/Query.php', 'MongoDB\\Driver\\ReadConcern' => 'mongodb/ReadConcern.php', 'MongoDB\\Driver\\ReadPreference' => 'mongodb/ReadPreference.php', 'MongoDB\\Driver\\Server' => 'mongodb/Server.php', 'MongoDB\\Driver\\ServerApi' => 'mongodb/ServerApi.php', + 'MongoDB\\Driver\\ServerDescription' => 'mongodb/ServerDescription.php', 'MongoDB\\Driver\\Session' => 'mongodb/Session.php', + 'MongoDB\\Driver\\TopologyDescription' => 'mongodb/TopologyDescription.php', 'MongoDB\\Driver\\WriteConcern' => 'mongodb/WriteConcern.php', 'MongoDB\\Driver\\WriteConcernError' => 'mongodb/WriteConcernError.php', 'MongoDB\\Driver\\WriteError' => 'mongodb/WriteError.php', diff --git a/mongodb/BSON/Binary.php b/mongodb/BSON/Binary.php index 3d4ab6137..92652ae2d 100644 --- a/mongodb/BSON/Binary.php +++ b/mongodb/BSON/Binary.php @@ -23,58 +23,55 @@ final class Binary implements Type, BinaryInterface, \Serializable, JsonSerializ * @since 1.7.0 */ public const TYPE_ENCRYPTED = 6; + + /** + * @since 1.12.0 + */ + public const TYPE_COLUMN = 7; public const TYPE_USER_DEFINED = 128; /** * Binary constructor. * @link https://php.net/manual/en/mongodb-bson-binary.construct.php - * @param string $data - * @param int $type */ - final public function __construct($data, $type) {} + final public function __construct(string $data, int $type = Binary::TYPE_GENERIC) {} /** * Returns the Binary's data * @link https://php.net/manual/en/mongodb-bson-binary.getdata.php - * @return string */ - final public function getData() {} + final public function getData(): string {} /** * Returns the Binary's type * @link https://php.net/manual/en/mongodb-bson-binary.gettype.php - * @return int */ - final public function getType() {} + final public function getType(): int {} public static function __set_state(array $properties) {} /** * Returns the Binary's data * @link https://www.php.net/manual/en/mongodb-bson-binary.tostring.php - * @return string */ - final public function __toString() {} + final public function __toString(): string {} /** * Serialize a Binary * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-binary.serialize.php - * @return string * @throws InvalidArgumentException */ - final public function serialize() {} + final public function serialize(): string {} /** * Unserialize a Binary * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-binary.unserialize.php - * @param string $serialized - * @return void * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) */ - final public function unserialize($serialized) {} + final public function unserialize(string $data) {} /** * Returns a representation that can be converted to JSON diff --git a/mongodb/BSON/DBPointer.php b/mongodb/BSON/DBPointer.php index 9bf110054..d383ecbbb 100644 --- a/mongodb/BSON/DBPointer.php +++ b/mongodb/BSON/DBPointer.php @@ -25,7 +25,7 @@ final private function __construct() {} * @return string * @throws InvalidArgumentException */ - final public function serialize() {} + final public function serialize(): string {} /** * Unserialize a DBPointer @@ -38,7 +38,7 @@ final public function serialize() {} * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) */ - final public function unserialize($serialized) {} + final public function unserialize(string $data): void {} /** * Returns a representation that can be converted to JSON @@ -54,5 +54,5 @@ final public function jsonSerialize() {} * * @return string Returns the string representation of this Symbol. */ - final public function __toString() {} + final public function __toString(): string {} } diff --git a/mongodb/BSON/Decimal128.php b/mongodb/BSON/Decimal128.php index ab4cf1355..5936979d8 100644 --- a/mongodb/BSON/Decimal128.php +++ b/mongodb/BSON/Decimal128.php @@ -17,14 +17,13 @@ final class Decimal128 implements Type, Decimal128Interface, \Serializable, Json * @link https://php.net/manual/en/mongodb-bson-decimal128.construct.php * @param string $value A decimal string. */ - final public function __construct($value = '') {} + final public function __construct(string $value = '') {} /** * Returns the string representation of this Decimal128 * @link https://php.net/manual/en/mongodb-bson-decimal128.tostring.php - * @return string */ - final public function __toString() {} + final public function __toString(): string {} public static function __set_state(array $properties) {} @@ -35,18 +34,16 @@ public static function __set_state(array $properties) {} * @return string * @throws InvalidArgumentException */ - final public function serialize() {} + final public function serialize(): string {} /** * Unserialize a Decimal128 * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-decimal128.unserialize.php - * @param string $serialized - * @return void * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) */ - final public function unserialize($serialized) {} + final public function unserialize(string $data): void {} /** * Returns a representation that can be converted to JSON diff --git a/mongodb/BSON/Document.php b/mongodb/BSON/Document.php index d358ec901..86cb17aec 100644 --- a/mongodb/BSON/Document.php +++ b/mongodb/BSON/Document.php @@ -34,8 +34,7 @@ final public static function __set_state(array $properties): Document {} final public function serialize(): string {} - /** @param string $serialized */ - final public function unserialize($serialized): void {} + final public function unserialize(string $data): void {} final public function __unserialize(array $data): void {} diff --git a/mongodb/BSON/Int64.php b/mongodb/BSON/Int64.php index 732216485..ba2145f17 100644 --- a/mongodb/BSON/Int64.php +++ b/mongodb/BSON/Int64.php @@ -19,22 +19,19 @@ final public function __construct(string|int $value) {} /** * Serialize an Int64 * @link https://www.php.net/manual/en/mongodb-bson-int64.serialize.php - * @return string * @throws InvalidArgumentException */ - final public function serialize() {} + final public function serialize(): string {} public static function __set_state(array $properties) {} /** * Unserialize an Int64 * @link https://www.php.net/manual/en/mongodb-bson-int64.unserialize.php - * @param string $serialized - * @return void * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) */ - final public function unserialize($serialized) {} + final public function unserialize(string $data): void {} /** * Returns a representation that can be converted to JSON @@ -48,5 +45,5 @@ final public function jsonSerialize() {} * Returns the Symbol as a string * @return string Returns the string representation of this Symbol. */ - final public function __toString() {} + final public function __toString(): string {} } diff --git a/mongodb/BSON/Javascript.php b/mongodb/BSON/Javascript.php index 12a4ead76..6201b7df8 100644 --- a/mongodb/BSON/Javascript.php +++ b/mongodb/BSON/Javascript.php @@ -15,53 +15,45 @@ final class Javascript implements Type, JavascriptInterface, \Serializable, Json /** * Construct a new Javascript * @link https://php.net/manual/en/mongodb-bson-javascript.construct.php - * @param string $javascript - * @param array|object $scope */ - final public function __construct($javascript, $scope = []) {} + final public function __construct(string $javascript, array|object|null $scope = null) {} public static function __set_state(array $properties) {} /** * Returns the Javascript's code - * @return string * @link https://secure.php.net/manual/en/mongodb-bson-javascript.getcode.php */ - final public function getCode() {} + final public function getCode(): string {} /** * Returns the Javascript's scope document - * @return object|null * @link https://secure.php.net/manual/en/mongodb-bson-javascript.getscope.php */ - final public function getScope() {} + final public function getScope(): ?object {} /** * Returns the Javascript's code - * @return string * @link https://secure.php.net/manual/en/mongodb-bson-javascript.tostring.php */ - final public function __toString() {} + final public function __toString(): string {} /** * Serialize a Javascript * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-javascript.serialize.php - * @return string * @throws InvalidArgumentException */ - final public function serialize() {} + final public function serialize(): string {} /** * Unserialize a Javascript * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-javascript.unserialize.php - * @param string $serialized - * @return void * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) */ - final public function unserialize($serialized) {} + final public function unserialize(string $data): void {} /** * Returns a representation that can be converted to JSON diff --git a/mongodb/BSON/MaxKey.php b/mongodb/BSON/MaxKey.php index 086d4cb4a..c9c65927a 100644 --- a/mongodb/BSON/MaxKey.php +++ b/mongodb/BSON/MaxKey.php @@ -18,21 +18,18 @@ public static function __set_state(array $properties) {} * Serialize a MaxKey * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-maxkey.serialize.php - * @return string * @throws InvalidArgumentException */ - final public function serialize() {} + final public function serialize(): string {} /** * Unserialize a MaxKey * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-maxkey.unserialize.php - * @param string $serialized - * @return void * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) */ - final public function unserialize($serialized) {} + final public function unserialize(string $data): void {} /** * Returns a representation that can be converted to JSON diff --git a/mongodb/BSON/MinKey.php b/mongodb/BSON/MinKey.php index 9926d68a7..c09e3846e 100644 --- a/mongodb/BSON/MinKey.php +++ b/mongodb/BSON/MinKey.php @@ -18,21 +18,18 @@ public static function __set_state(array $properties) {} * Serialize a MinKey * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-minkey.serialize.php - * @return string * @throws InvalidArgumentException */ - final public function serialize() {} + final public function serialize(): string {} /** * Unserialize a MinKey * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-minkey.unserialize.php - * @param string $serialized - * @return void * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) */ - final public function unserialize($serialized) {} + final public function unserialize(string $data): void {} /** * Returns a representation that can be converted to JSON diff --git a/mongodb/BSON/ObjectId.php b/mongodb/BSON/ObjectId.php index 47e5b113f..44d45301f 100644 --- a/mongodb/BSON/ObjectId.php +++ b/mongodb/BSON/ObjectId.php @@ -17,14 +17,13 @@ final class ObjectId implements Type, ObjectIdInterface, \Serializable, JsonSeri * @param string|null $id A 24-character hexadecimal string. If not provided, the driver will generate an ObjectId. * @throws InvalidArgumentException if id is not a 24-character hexadecimal string. */ - final public function __construct($id = null) {} + final public function __construct(?string $id = null) {} /** * Returns the hexadecimal representation of this ObjectId * @link https://php.net/manual/en/mongodb-bson-objectid.tostring.php - * @return string */ - final public function __toString() {} + final public function __toString(): string {} public static function __set_state(array $properties) {} @@ -34,7 +33,7 @@ public static function __set_state(array $properties) {} * @link https://secure.php.net/manual/en/mongodb-bson-objectid.gettimestamp.php * @return int the timestamp component of this ObjectId */ - final public function getTimestamp() {} + final public function getTimestamp(): int {} /** * Returns a representation that can be converted to JSON @@ -48,15 +47,13 @@ final public function jsonSerialize() {} * Serialize an ObjectId * @since 1.2.0 * @link https://secure.php.net/manual/en/mongodb-bson-objectid.serialize.php - * @return string the serialized representation of the object */ - final public function serialize() {} + final public function serialize(): string {} /** * Unserialize an ObjectId * @since 1.2.0 * @link https://secure.php.net/manual/en/mongodb-bson-objectid.unserialize.php - * @return void */ - final public function unserialize($serialized) {} + final public function unserialize(string $data): void {} } diff --git a/mongodb/BSON/PackedArray.php b/mongodb/BSON/PackedArray.php index c8a6d8dbe..4fc63d8d5 100644 --- a/mongodb/BSON/PackedArray.php +++ b/mongodb/BSON/PackedArray.php @@ -26,8 +26,7 @@ final public static function __set_state(array $properties): PackedArray {} final public function serialize(): string {} - /** @param string $serialized */ - final public function unserialize($serialized): void {} + final public function unserialize(string $data): void {} final public function __unserialize(array $data): void {} diff --git a/mongodb/BSON/Regex.php b/mongodb/BSON/Regex.php index 4eadc6b51..47ae2060f 100644 --- a/mongodb/BSON/Regex.php +++ b/mongodb/BSON/Regex.php @@ -15,30 +15,26 @@ final class Regex implements Type, RegexInterface, \Serializable, JsonSerializab /** * Construct a new Regex * @link https://php.net/manual/en/mongodb-bson-regex.construct.php - * @param string $pattern - * @param string $flags [optional] */ - final public function __construct($pattern, $flags = "") {} + final public function __construct(string $pattern, string $flags = '') {} /** * Returns the Regex's flags * @link https://php.net/manual/en/mongodb-bson-regex.getflags.php */ - final public function getFlags() {} + final public function getFlags(): string {} /** * Returns the Regex's pattern * @link https://php.net/manual/en/mongodb-bson-regex.getpattern.php - * @return string */ - final public function getPattern() {} + final public function getPattern(): string {} /** * Returns the string representation of this Regex * @link https://php.net/manual/en/mongodb-bson-regex.tostring.php - * @return string */ - final public function __toString() {} + final public function __toString(): string {} public static function __set_state(array $properties) {} @@ -46,21 +42,18 @@ public static function __set_state(array $properties) {} * Serialize a Regex * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-regex.serialize.php - * @return string * @throws InvalidArgumentException */ - final public function serialize() {} + final public function serialize(): string {} /** * Unserialize a Regex * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-regex.unserialize.php - * @param string $serialized - * @return void * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) */ - final public function unserialize($serialized) {} + final public function unserialize(string $data): void {} /** * Returns a representation that can be converted to JSON diff --git a/mongodb/BSON/Symbol.php b/mongodb/BSON/Symbol.php index 46f1094b1..a49cb54e4 100644 --- a/mongodb/BSON/Symbol.php +++ b/mongodb/BSON/Symbol.php @@ -21,21 +21,18 @@ final private function __construct() {} * Serialize a Symbol * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-symbol.serialize.php - * @return string * @throws InvalidArgumentException */ - final public function serialize() {} + final public function serialize(): string {} /** * Unserialize a Symbol * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-symbol.unserialize.php - * @param string $serialized - * @return void * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) */ - final public function unserialize($serialized) {} + final public function unserialize(string $data): void {} /** * Returns a representation that can be converted to JSON @@ -50,5 +47,5 @@ final public function jsonSerialize() {} * Returns the Symbol as a string * @return string Returns the string representation of this Symbol. */ - final public function __toString() {} + final public function __toString(): string {} } diff --git a/mongodb/BSON/Timestamp.php b/mongodb/BSON/Timestamp.php index 27effa941..47263fee3 100644 --- a/mongodb/BSON/Timestamp.php +++ b/mongodb/BSON/Timestamp.php @@ -15,55 +15,47 @@ final class Timestamp implements TimestampInterface, Type, \Serializable, JsonSe /** * Construct a new Timestamp * @link https://php.net/manual/en/mongodb-bson-timestamp.construct.php - * @param int $increment - * @param int $timestamp */ - final public function __construct($increment, $timestamp) {} + final public function __construct(int $increment, int $timestamp) {} /** * Returns the string representation of this Timestamp * @link https://php.net/manual/en/mongodb-bson-timestamp.tostring.php - * @return string */ - final public function __toString() {} + final public function __toString(): string {} public static function __set_state(array $properties) {} /** * Returns the increment component of this TimestampInterface * @link https://secure.php.net/manual/en/mongodb-bson-timestampinterface.getincrement.php - * @return int * @since 1.3.0 */ - final public function getIncrement() {} + final public function getIncrement(): int {} /** * Returns the timestamp component of this TimestampInterface * @link https://secure.php.net/manual/en/mongodb-bson-timestampinterface.gettimestamp.php - * @return int * @since 1.3.0 */ - final public function getTimestamp() {} + final public function getTimestamp(): int {} /** * Serialize a Timestamp * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-timestamp.serialize.php - * @return string * @throws InvalidArgumentException */ - final public function serialize() {} + final public function serialize(): string {} /** * Unserialize a Timestamp * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-timestamp.unserialize.php - * @param string $serialized - * @return void * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) */ - final public function unserialize($serialized) {} + final public function unserialize(string $data): void {} /** * Returns a representation that can be converted to JSON diff --git a/mongodb/BSON/UTCDateTime.php b/mongodb/BSON/UTCDateTime.php index 6aff6f0aa..5acc58eb5 100644 --- a/mongodb/BSON/UTCDateTime.php +++ b/mongodb/BSON/UTCDateTime.php @@ -15,45 +15,39 @@ final class UTCDateTime implements Type, UTCDateTimeInterface, \Serializable, \J /** * Construct a new UTCDateTime * @link https://php.net/manual/en/mongodb-bson-utcdatetime.construct.php - * @param int|float|string|DateTimeInterface $milliseconds */ - final public function __construct($milliseconds = null) {} + final public function __construct(int|string|float|DateTimeInterface|null $milliseconds = null) {} public static function __set_state(array $properties) {} /** * Returns the DateTime representation of this UTCDateTime * @link https://php.net/manual/en/mongodb-bson-utcdatetime.todatetime.php - * @return \DateTime */ - final public function toDateTime() {} + final public function toDateTime(): \DateTime {} /** * Returns the string representation of this UTCDateTime * @link https://php.net/manual/en/mongodb-bson-utcdatetime.tostring.php - * @return string */ - final public function __toString() {} + final public function __toString(): string {} /** * Serialize a UTCDateTime * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-utcdatetime.serialize.php - * @return string * @throws InvalidArgumentException */ - final public function serialize() {} + final public function serialize(): string {} /** * Unserialize a UTCDateTime * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-utcdatetime.unserialize.php - * @param string $serialized - * @return void * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) */ - final public function unserialize($serialized) {} + final public function unserialize(string $data): void {} /** * Returns a representation that can be converted to JSON diff --git a/mongodb/BSON/Undefined.php b/mongodb/BSON/Undefined.php index 0ef0ab1e7..9b69ad691 100644 --- a/mongodb/BSON/Undefined.php +++ b/mongodb/BSON/Undefined.php @@ -21,21 +21,18 @@ final private function __construct() {} * Serialize an Undefined * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-undefined.serialize.php - * @return string * @throws InvalidArgumentException */ - final public function serialize() {} + final public function serialize(): string {} /** * Unserialize an Undefined * @since 1.2.0 * @link https://www.php.net/manual/en/mongodb-bson-undefined.unserialize.php - * @param string $serialized - * @return void * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) */ - final public function unserialize($serialized) {} + final public function unserialize(string $data): void {} /** * Returns a representation that can be converted to JSON @@ -50,5 +47,5 @@ final public function jsonSerialize() {} * Returns the Undefined as a string * @return string Returns the string representation of this Symbol. */ - final public function __toString() {} + final public function __toString(): string {} } diff --git a/mongodb/BulkWrite.php b/mongodb/BulkWrite.php index 9dbf73c4c..15d749929 100644 --- a/mongodb/BulkWrite.php +++ b/mongodb/BulkWrite.php @@ -22,7 +22,7 @@ final class BulkWrite implements \Countable * @param array $options * @throws InvalidArgumentException on argument parsing errors. */ - final public function __construct(?array $options = []) {} + final public function __construct(?array $options = null) {} final public function __wakeup() {} @@ -33,34 +33,32 @@ final public function __wakeup() {} * @return int number of expected roundtrips to execute the BulkWrite. * @throws InvalidArgumentException on argument parsing errors. */ - final public function count() {} + final public function count(): int {} /** * Add a delete operation to the bulk * @link https://php.net/manual/en/mongodb-driver-bulkwrite.delete.php - * @param array|object $query The search filter - * @param array $deleteOptions + * @param array|object $filter The search filter + * @param array|null $deleteOptions * @throws InvalidArgumentException on argument parsing errors. */ - final public function delete($query, ?array $deleteOptions = []) {} + final public function delete(array|object $filter, ?array $deleteOptions = null): void {} /** * Add an insert operation to the bulk - * If the document did not have an _id, a MongoDB\BSON\ObjectId will be generated and returned; otherwise, no value is returned. * @link https://php.net/manual/en/mongodb-driver-bulkwrite.insert.php - * @param array|object $document - * @return mixed + * @return mixed If the document did not have an _id, a MongoDB\BSON\ObjectId will be generated and returned; otherwise, no value is returned. * @throws InvalidArgumentException on argument parsing errors. */ - final public function insert($document) {} + final public function insert(array|object $document) {} /** * Add an update operation to the bulk * @link https://php.net/manual/en/mongodb-driver-bulkwrite.update.php - * @param array|object $query The search filter + * @param array|object $filter The search filter * @param array|object $newObj A document containing either update operators (e.g. $set) or a replacement document (i.e. only field:value expressions) - * @param array $updateOptions + * @param array|null $updateOptions * @throws InvalidArgumentException on argument parsing errors. */ - final public function update($query, $newObj, ?array $updateOptions = []) {} + final public function update(array|object $filter, array|object $newObj, ?array $updateOptions = null) {} } diff --git a/mongodb/ClientEncryption.php b/mongodb/ClientEncryption.php index 4d4170f53..b087ea2cf 100644 --- a/mongodb/ClientEncryption.php +++ b/mongodb/ClientEncryption.php @@ -2,6 +2,7 @@ namespace MongoDB\Driver; +use MongoDB\BSON\Binary; use MongoDB\Driver\Exception\EncryptionException; use MongoDB\Driver\Exception\InvalidArgumentException; @@ -15,30 +16,59 @@ final class ClientEncryption public const AEAD_AES_256_CBC_HMAC_SHA_512_DETERMINISTIC = 'AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic'; public const AEAD_AES_256_CBC_HMAC_SHA_512_RANDOM = 'AEAD_AES_256_CBC_HMAC_SHA_512-Random'; - final private function __construct() {} + /** + * @since 1.14.0 + */ + public const ALGORITHM_INDEXED = 'Indexed'; + + /** + * @since 1.14.0 + */ + public const ALGORITHM_UNINDEXED = 'Unindexed'; + + /** + * @since 1.16.0 + */ + public const ALGORITHM_RANGE_PREVIEW = 'RangePreview'; + + /** + * @since 1.14.0 + */ + public const QUERY_TYPE_EQUALITY = 'equality'; + + /** + * @since 1.16.0 + */ + public const QUERY_TYPE_RANGE_PREVIEW = 'rangePreview'; + + /** + * @since 1.14.0 + */ + final public function __construct(array $options) {} final public function __wakeup() {} /** * Adds an alternate name to a key document * @link https://www.php.net/manual/en/mongodb-driver-clientencryption.addkeyaltname.php - * @param \MongoDB\BSON\Binary $keyId A MongoDB\BSON\Binary instance with subtype 4 (UUID) identifying the key document. + * @param Binary $keyId A MongoDB\BSON\Binary instance with subtype 4 (UUID) identifying the key document. * @param string $keyAltName Alternate name to add to the key document. * @return object|null Returns the previous version of the key document, or null if no document matched. * @throws InvalidArgumentException On argument parsing errors. + * @since 1.15.0 */ - final public function addKeyAltName(\MongoDB\BSON\Binary $keyId, string $keyAltName): ?object {} + final public function addKeyAltName(Binary $keyId, string $keyAltName): ?object {} /** * Creates a new key document and inserts into the key vault collection. * @link https://www.php.net/manual/en/mongodb-driver-clientencryption.createdatakey.php * @param string $kmsProvider The KMS provider ("local" or "aws") that will be used to encrypt the new encryption key. - * @param array $options [optional] - * @return \MongoDB\BSON\Binary Returns the identifier of the new key as a MongoDB\BSON\Binary object with subtype 4 (UUID). + * @param array|null $options [optional] + * @return Binary Returns the identifier of the new key as a MongoDB\BSON\Binary object with subtype 4 (UUID). * @throws InvalidArgumentException On argument parsing errors. * @throws EncryptionException If an error occurs while creating the data key. */ - final public function createDataKey($kmsProvider, ?array $options = []) {} + final public function createDataKey(string $kmsProvider, ?array $options = null): Binary {} /** * Decrypts an encrypted value (BSON binary of subtype 6). @@ -48,27 +78,28 @@ final public function createDataKey($kmsProvider, ?array $options = []) {} * @throws InvalidArgumentException On argument parsing errors. * @throws EncryptionException If an error occurs while decrypting the value. */ - final public function decrypt(\MongoDB\BSON\Binary $keyVaultClient) {} + final public function decrypt(Binary $keyVaultClient) {} /** * Deletes a key document * @link https://www.php.net/manual/en/mongodb-driver-clientencryption.deletekey.php - * @param \MongoDB\BSON\Binary $keyId A MongoDB\BSON\Binary instance with subtype 4 (UUID) identifying the key document. + * @param Binary $keyId A MongoDB\BSON\Binary instance with subtype 4 (UUID) identifying the key document. * @return object Returns the result of the internal deleteOne operation on the key vault collection. * @throws InvalidArgumentException On argument parsing errors. + * @since 1.15.0 */ - final public function deleteKey(\MongoDB\BSON\Binary $keyId): object {} + final public function deleteKey(Binary $keyId): object {} /** * Encrypts a value with a given key and algorithm. * @link https://www.php.net/manual/en/mongodb-driver-clientencryption.encrypt.php * @param mixed $value The value to be encrypted. Any value that can be inserted into MongoDB can be encrypted using this method. - * @param array $options [optional] - * @return \MongoDB\BSON\Binary Returns the encrypted value as MongoDB\BSON\Binary object with subtype 6. + * @param array|null $options [optional] + * @return Binary Returns the encrypted value as MongoDB\BSON\Binary object with subtype 6. * @throws InvalidArgumentException On argument parsing errors. * @throws EncryptionException If an error occurs while encrypting the value. */ - final public function encrypt($value, ?array $options = []): \MongoDB\BSON\Binary {} + final public function encrypt($value, ?array $options = null): Binary {} /** * Encrypts a Match Expression or Aggregate Expression to query a range index @@ -76,17 +107,19 @@ final public function encrypt($value, ?array $options = []): \MongoDB\BSON\Binar * @param array|null $options * @return object Returns the encrypted expression as a BSON document * @throws InvalidArgumentException On argument parsing errors. + * @since 1.16.0 */ final public function encryptExpression(array|object $expr, ?array $options = null): object {} /** * Gets a key document * @link https://www.php.net/manual/en/mongodb-driver-clientencryption.getkey.php - * @param \MongoDB\BSON\Binary $keyId A MongoDB\BSON\Binary instance with subtype 4 (UUID) identifying the key document. + * @param Binary $keyId A MongoDB\BSON\Binary instance with subtype 4 (UUID) identifying the key document. * @return object|null Returns the key document, or null if no document matched. * @throws InvalidArgumentException On argument parsing errors. + * @since 1.15.0 */ - final public function getKey(\MongoDB\BSON\Binary $keyId): ?object {} + final public function getKey(Binary $keyId): ?object {} /** * Gets a key document by an alternate name @@ -94,6 +127,7 @@ final public function getKey(\MongoDB\BSON\Binary $keyId): ?object {} * @param string $keyAltName Alternate name for the key document. * @return object|null Returns the key document, or null if no document matched. * @throws InvalidArgumentException On argument parsing errors. + * @since 1.15.0 */ final public function getKeyByAltName(string $keyAltName): ?object {} @@ -102,17 +136,19 @@ final public function getKeyByAltName(string $keyAltName): ?object {} * @link https://www.php.net/manual/en/mongodb-driver-clientencryption.getkeys.php * @return Cursor * @throws InvalidArgumentException On argument parsing errors. + * @since 1.15.0 */ final public function getKeys(): Cursor {} /** * Removes an alternate name from a key document * @link https://www.php.net/manual/en/mongodb-driver-clientencryption.removekeyaltname.php - * @param \MongoDB\BSON\Binary $keyId A MongoDB\BSON\Binary instance with subtype 4 (UUID) identifying the key document. + * @param Binary $keyId A MongoDB\BSON\Binary instance with subtype 4 (UUID) identifying the key document. * @param string $keyAltName Alternate name to remove from the key document. * @return object|null Returns the previous version of the key document, or null if no document matched. + * @since 1.15.0 */ - final public function removeKeyAltName(\MongoDB\BSON\Binary $keyId, string $keyAltName): ?object {} + final public function removeKeyAltName(Binary $keyId, string $keyAltName): ?object {} /** * Rewraps data keys @@ -120,6 +156,7 @@ final public function removeKeyAltName(\MongoDB\BSON\Binary $keyId, string $keyA * @param array|object $filter * @param array|null $options * @return object Returns an object, which will have an optional bulkWriteResult property containing the result of the internal bulkWrite operation as an object. If no data keys matched the filter or the write was unacknowledged, the bulkWriteResult property will be null. + * @since 1.16.0 */ final public function rewrapManyDataKey(array|object $filter, ?array $options = null): object {} } diff --git a/mongodb/Command.php b/mongodb/Command.php index 1c0d51f88..c96c8cda3 100644 --- a/mongodb/Command.php +++ b/mongodb/Command.php @@ -15,12 +15,12 @@ final class Command /** * Construct new Command * @param array|object $document The complete command to construct - * @param array $options Do not use this parameter to specify options described in the command's reference in the MongoDB manual. + * @param array|null $commandOptions Do not use this parameter to specify options described in the command's reference in the MongoDB manual. * @throws InvalidArgumentException on argument parsing errors. * @link https://secure.php.net/manual/en/mongodb-driver-command.construct.php * @since 1.0.0 */ - final public function __construct($document, ?array $options = []) {} + final public function __construct(array|object $document, ?array $commandOptions = null) {} final public function __wakeup() {} } diff --git a/mongodb/Cursor.php b/mongodb/Cursor.php index 196f7e6da..9befc9a71 100644 --- a/mongodb/Cursor.php +++ b/mongodb/Cursor.php @@ -22,25 +22,22 @@ final public function __wakeup() {} /** * Returns the current element. * @link https://www.php.net/manual/en/mongodb-driver-cursor.current.php - * @return array|object */ - public function current() {} + public function current(): array|object|null {} /** * Returns the MongoDB\Driver\CursorId associated with this cursor. A cursor ID cursor uniquely identifies the cursor on the server. * @link https://php.net/manual/en/mongodb-driver-cursor.getid.php - * @return CursorId for this Cursor * @throws InvalidArgumentException on argument parsing errors. */ - final public function getId() {} + final public function getId(): CursorId {} /** * Returns the MongoDB\Driver\Server associated with this cursor. This is the server that executed the query or command. * @link https://php.net/manual/en/mongodb-driver-cursor.getserver.php - * @return Server for this Cursor * @throws InvalidArgumentException on argument parsing errors. */ - final public function getServer() {} + final public function getServer(): Server {} /** * Checks if a cursor is still alive @@ -48,60 +45,53 @@ final public function getServer() {} * @return bool * @throws InvalidArgumentException On argument parsing errors */ - final public function isDead() {} + final public function isDead(): bool {} /** * Returns the current result's index within the cursor. * @link https://www.php.net/manual/en/mongodb-driver-cursor.key.php - * @return int */ - public function key() {} + public function key(): ?int {} /** * Advances the cursor to the next result. * @link https://www.php.net/manual/en/mongodb-driver-cursor.next.php - * @return void * @throws \MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors. * @throws \MongoDB\Driver\Exception\ConnectionException if connection to the server fails (for reasons other than authentication). * @throws \MongoDB\Driver\Exception\AuthenticationException if authentication is needed and fails. */ - public function next() {} + public function next(): void {} /** * Rewind the cursor to the first result. * @link https://www.php.net/manual/en/mongodb-driver-cursor.rewind.php - * @return void * @throws \MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors. * @throws \MongoDB\Driver\Exception\ConnectionException if connection to the server fails (for reasons other than authentication). * @throws \MongoDB\Driver\Exception\AuthenticationException if authentication is needed and fails. * @throws \MongoDB\Driver\Exception\LogicException if this method is called after the cursor has advanced beyond its first position. */ - public function rewind() {} + public function rewind(): void {} /** * Sets a type map to use for BSON unserialization * * @link https://php.net/manual/en/mongodb-driver-cursor.settypemap.php * - * @param array $typemap - * @return void * @throws InvalidArgumentException On argument parsing errors or if a class in the type map cannot * be instantiated or does not implement MongoDB\BSON\Unserializable */ - final public function setTypeMap(array $typemap) {} + final public function setTypeMap(array $typemap): void {} /** * Returns an array of all result documents for this cursor * @link https://php.net/manual/en/mongodb-driver-cursor.toarray.php - * @return array * @throws InvalidArgumentException On argument parsing errors */ - final public function toArray() {} + final public function toArray(): array {} /** * Checks if the current position in the cursor is valid. * @link https://www.php.net/manual/en/mongodb-driver-cursor.valid.php - * @return bool */ - public function valid() {} + public function valid(): bool {} } diff --git a/mongodb/CursorId.php b/mongodb/CursorId.php index ec34e07a6..ed8041735 100644 --- a/mongodb/CursorId.php +++ b/mongodb/CursorId.php @@ -25,7 +25,7 @@ final private function __construct() {} * @return string representation of the cursor ID. * @throws InvalidArgumentException on argument parsing errors. */ - final public function __toString() {} + final public function __toString(): string {} final public function __wakeup() {} @@ -35,19 +35,16 @@ public static function __set_state(array $properties) {} * Serialize a CursorId * @since 1.7.0 * @link https://php.net/manual/en/mongodb-driver-cursorid.serialize.php - * @return string * @throws InvalidArgumentException */ - final public function serialize() {} + final public function serialize(): string {} /** * Unserialize a CursorId * @since 1.7.0 * @link https://php.net/manual/en/mongodb-driver-cursorid.unserialize.php - * @param string $serialized - * @return void * @throws InvalidArgumentException on argument parsing errors or if the properties are invalid * @throws UnexpectedValueException if the properties cannot be unserialized (i.e. serialized was malformed) */ - final public function unserialize($serialized) {} + final public function unserialize(string $data): void {} } diff --git a/mongodb/Exception/CommandException.php b/mongodb/Exception/CommandException.php index eafbfc2c3..ef61293d1 100644 --- a/mongodb/Exception/CommandException.php +++ b/mongodb/Exception/CommandException.php @@ -15,8 +15,7 @@ class CommandException extends ServerException /** * Returns the result document for the failed command * @link https://secure.php.net/manual/en/mongodb-driver-commandexception.getresultdocument.php - * @return object * @since 1.5.0 */ - final public function getResultDocument() {} + final public function getResultDocument(): object {} } diff --git a/mongodb/Exception/RuntimeException.php b/mongodb/Exception/RuntimeException.php index 18acec26b..f0f152a45 100644 --- a/mongodb/Exception/RuntimeException.php +++ b/mongodb/Exception/RuntimeException.php @@ -18,9 +18,7 @@ class RuntimeException extends \RuntimeException implements Exception /** * Whether the given errorLabel is associated with this exception * - * @param string $label - * @return bool - *@since 1.6.0 + * @since 1.6.0 */ - final public function hasErrorLabel($label) {} + final public function hasErrorLabel(string $label): bool {} } diff --git a/mongodb/Exception/WriteException.php b/mongodb/Exception/WriteException.php index 5c847c0ca..a50621ff1 100644 --- a/mongodb/Exception/WriteException.php +++ b/mongodb/Exception/WriteException.php @@ -21,5 +21,5 @@ abstract class WriteException extends ServerException implements Exception * @return WriteResult for the failed write operation * @since 1.0.0 */ - final public function getWriteResult() {} + final public function getWriteResult(): WriteResult {} } diff --git a/mongodb/Manager.php b/mongodb/Manager.php index 960bcc3e6..4af626c6c 100644 --- a/mongodb/Manager.php +++ b/mongodb/Manager.php @@ -23,13 +23,13 @@ final class Manager /** * Manager constructor. * @link https://php.net/manual/en/mongodb-driver-manager.construct.php - * @param string $uri A mongodb:// connection URI - * @param array $options Connection string options - * @param array $driverOptions Any driver-specific options not included in MongoDB connection spec. + * @param string|null $uri A mongodb:// connection URI + * @param array|null $options Connection string options + * @param array|null $driverOptions Any driver-specific options not included in MongoDB connection spec. * @throws InvalidArgumentException on argument parsing errors * @throws RuntimeException if the uri format is invalid */ - final public function __construct($uri = '', array $options = [], array $driverOptions = []) {} + final public function __construct(?string $uri = null, ?array $options = null, ?array $driverOptions = null) {} final public function __wakeup() {} @@ -47,9 +47,8 @@ final public function createClientEncryption(array $options) {} * Execute one or more write operations * @link https://php.net/manual/en/mongodb-driver-manager.executebulkwrite.php * @param string $namespace A fully qualified namespace (databaseName.collectionName) - * @param BulkWrite $zbulk The MongoDB\Driver\BulkWrite to execute. - * @param array|WriteConcern $options WriteConcern type for backwards compatibility - * @return WriteResult + * @param BulkWrite $bulk The MongoDB\Driver\BulkWrite to execute. + * @param array|WriteConcern|null $options WriteConcern type for backwards compatibility * @throws InvalidArgumentException on argument parsing errors. * @throws ConnectionException if connection to the server fails for other then authentication reasons * @throws AuthenticationException if authentication is needed and fails @@ -57,14 +56,13 @@ final public function createClientEncryption(array $options) {} * @throws RuntimeException on other errors (invalid command, command arguments, ...) * @since 1.4.0 added $options argument */ - final public function executeBulkWrite($namespace, BulkWrite $zbulk, $options = []) {} + final public function executeBulkWrite(string $namespace, BulkWrite $bulk, array|WriteConcern|null $options = null): WriteResult {} /** * @link https://php.net/manual/en/mongodb-driver-manager.executecommand.php * @param string $db The name of the database on which to execute the command. * @param Command $command The command document. - * @param array|ReadPreference $options ReadPreference type for backwards compatibility - * @return Cursor + * @param array|ReadPreference|null $options ReadPreference type for backwards compatibility * @throws Exception * @throws AuthenticationException if authentication is needed and fails * @throws ConnectionException if connection to the server fails for other then authentication reasons @@ -73,29 +71,27 @@ final public function executeBulkWrite($namespace, BulkWrite $zbulk, $options = * @throws WriteConcernException on Write Concern failure * @since 1.4.0 added $options argument */ - final public function executeCommand($db, Command $command, $options = []) {} + final public function executeCommand(string $db, Command $command, array|ReadPreference|null $options = null): Cursor {} /** * Execute a MongoDB query * @link https://php.net/manual/en/mongodb-driver-manager.executequery.php * @param string $namespace A fully qualified namespace (databaseName.collectionName) - * @param Query $zquery A MongoDB\Driver\Query to execute. - * @param array|ReadPreference $options ReadPreference type for backwards compatibility - * @return Cursor + * @param Query $query A MongoDB\Driver\Query to execute. + * @param array|ReadPreference|null $options ReadPreference type for backwards compatibility * @throws Exception * @throws AuthenticationException if authentication is needed and fails * @throws ConnectionException if connection to the server fails for other then authentication reasons * @throws RuntimeException on other errors (invalid command, command arguments, ...) * @since 1.4.0 added $options argument */ - final public function executeQuery($namespace, Query $zquery, $options = []) {} + final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} /** * @link https://php.net/manual/en/mongodb-driver-manager.executereadcommand.php * @param string $db The name of the database on which to execute the command that reads. * @param Command $command The command document. - * @param array $options - * @return Cursor + * @param array|null $options * @throws Exception * @throws AuthenticationException if authentication is needed and fails * @throws ConnectionException if connection to the server fails for other then authentication reasons @@ -104,14 +100,13 @@ final public function executeQuery($namespace, Query $zquery, $options = []) {} * @throws WriteConcernException on Write Concern failure * @since 1.4.0 */ - final public function executeReadCommand($db, Command $command, array $options = []) {} + final public function executeReadCommand(string $db, Command $command, ?array $options = null): Cursor {} /** * @link https://php.net/manual/en/mongodb-driver-manager.executereadwritecommand.php * @param string $db The name of the database on which to execute the command that reads. * @param Command $command The command document. - * @param array $options - * @return Cursor + * @param array|null $options * @throws Exception * @throws AuthenticationException if authentication is needed and fails * @throws ConnectionException if connection to the server fails for other then authentication reasons @@ -120,14 +115,13 @@ final public function executeReadCommand($db, Command $command, array $options = * @throws WriteConcernException on Write Concern failure * @since 1.4.0 */ - final public function executeReadWriteCommand($db, Command $command, $options = []) {} + final public function executeReadWriteCommand(string $db, Command $command, ?array $options = null): Cursor {} /** * @link https://php.net/manual/en/mongodb-driver-manager.executewritecommand.php * @param string $db The name of the database on which to execute the command that writes. * @param Command $command The command document. - * @param array $options - * @return Cursor + * @param array|null $options * @throws Exception * @throws AuthenticationException if authentication is needed and fails * @throws ConnectionException if connection to the server fails for other then authentication reasons @@ -136,15 +130,21 @@ final public function executeReadWriteCommand($db, Command $command, $options = * @throws WriteConcernException on Write Concern failure * @since 1.4.0 */ - final public function executeWriteCommand($db, Command $command, array $options = []) {} + final public function executeWriteCommand(string $db, Command $command, ?array $options = null): Cursor {} + + /** + * Return the encryptedFieldsMap auto encryption option for the Manager + * @link https://www.php.net/manual/en/mongodb-driver-manager.getencryptedfieldsmap.php + * @since 1.14.0 + */ + final public function getEncryptedFieldsMap(): array|object|null {} /** * Return the ReadConcern for the Manager * @link https://php.net/manual/en/mongodb-driver-manager.getreadconcern.php * @throws InvalidArgumentException on argument parsing errors. - * @return ReadConcern */ - final public function getReadConcern() {} + final public function getReadConcern(): ReadConcern {} /** * Return the ReadPreference for the Manager @@ -152,7 +152,7 @@ final public function getReadConcern() {} * @throws InvalidArgumentException * @return ReadPreference */ - final public function getReadPreference() {} + final public function getReadPreference(): ReadPreference {} /** * Return the servers to which this manager is connected @@ -160,7 +160,7 @@ final public function getReadPreference() {} * @throws InvalidArgumentException on argument parsing errors * @return Server[] */ - final public function getServers() {} + final public function getServers(): array {} /** * Return the WriteConcern for the Manager @@ -168,32 +168,42 @@ final public function getServers() {} * @throws InvalidArgumentException on argument parsing errors. * @return WriteConcern */ - final public function getWriteConcern() {} + final public function getWriteConcern(): WriteConcern {} /** * Preselect a MongoDB node based on provided readPreference. This can be useful to guarantee a command runs on a specific server when operating in a mixed version cluster. * https://secure.php.net/manual/en/mongodb-driver-manager.selectserver.php - * @param ReadPreference $readPreference Optionally, a MongoDB\Driver\ReadPreference to route the command to. If none given, defaults to the Read Preferences set by the MongoDB Connection URI. + * @param ReadPreference|null $readPreference Optionally, a MongoDB\Driver\ReadPreference to route the command to. If none given, defaults to the Read Preferences set by the MongoDB Connection URI. * @throws InvalidArgumentException on argument parsing errors. * @throws ConnectionException if connection to the server fails (for reasons other than authentication). * @throws AuthenticationException if authentication is needed and fails. * @throws RuntimeException if a server matching the read preference could not be found. * @return Server */ - final public function selectServer(ReadPreference $readPreference = null) {} + final public function selectServer(?ReadPreference $readPreference = null) {} /** * Start a new client session for use with this client - * @param array $options + * @param array|null $options * @return \MongoDB\Driver\Session * @throws \MongoDB\Driver\Exception\InvalidArgumentException On argument parsing errors * @throws \MongoDB\Driver\Exception\RuntimeException If the session could not be created (e.g. libmongoc does not support crypto). * @link https://secure.php.net/manual/en/mongodb-driver-manager.startsession.php * @since 1.4.0 */ - final public function startSession(?array $options = []) {} + final public function startSession(?array $options = null) {} - final public function addSubscriber(Subscriber $subscriber) {} + /** + * Registers a monitoring event subscriber with this Manager + * @link https://www.php.net/manual/en/mongodb-driver-manager.addsubscriber.php + * @since 1.10.0 + */ + final public function addSubscriber(Subscriber $subscriber): void {} - final public function removeSubscriber(Subscriber $subscriber) {} + /** + * Unregisters a monitoring event subscriber with this Manager + * @link https://www.php.net/manual/en/mongodb-driver-manager.removesubscriber.php + * @since 1.10.0 + */ + final public function removeSubscriber(Subscriber $subscriber): void {} } diff --git a/mongodb/Monitoring/CommandFailedEvent.php b/mongodb/Monitoring/CommandFailedEvent.php index 5b8db2648..21fc93a92 100644 --- a/mongodb/Monitoring/CommandFailedEvent.php +++ b/mongodb/Monitoring/CommandFailedEvent.php @@ -2,6 +2,9 @@ namespace MongoDB\Driver\Monitoring; +use MongoDB\BSON\ObjectId; +use MongoDB\Driver\Server; + /** * Encapsulates information about a failed command. * @link https://secure.php.net/manual/en/class.mongodb-driver-monitoring-commandfailedevent.php @@ -20,7 +23,7 @@ final public function __wakeup() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getCommandName() {} + final public function getCommandName(): string {} /** * Returns the command's duration in microseconds @@ -30,7 +33,7 @@ final public function getCommandName() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getDurationMicros() {} + final public function getDurationMicros(): int {} /** * Returns the Exception associated with the failed command @@ -39,7 +42,7 @@ final public function getDurationMicros() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getError() {} + final public function getError(): \Exception {} /** * Returns the command's operation ID. @@ -50,7 +53,7 @@ final public function getError() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getOperationId() {} + final public function getOperationId(): string {} /** * Returns the command reply document. @@ -60,7 +63,7 @@ final public function getOperationId() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getReply() {} + final public function getReply(): object {} /** * Returns the command's request ID. @@ -70,7 +73,7 @@ final public function getReply() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getRequestId() {} + final public function getRequestId(): string {} /** * Returns the Server on which the command was executed. @@ -78,5 +81,19 @@ final public function getRequestId() {} * @return \MongoDB\Driver\Server on which the command was executed. * @since 1.3.0 */ - final public function getServer() {} + final public function getServer(): Server {} + + /** + * Returns the load balancer service ID for the command + * @link https://www.php.net/manual/en/mongodb-driver-monitoring-commandfailedevent.getserviceid.php + * @since 1.11.0 + */ + final public function getServiceId(): ?ObjectId {} + + /** + * Returns the server connection ID for the command + * @link https://www.php.net/manual/en/mongodb-driver-monitoring-commandfailedevent.getserverconnectionid.php + * @since 1.14.0 + */ + final public function getServerConnectionId(): ?int {} } diff --git a/mongodb/Monitoring/CommandStartedEvent.php b/mongodb/Monitoring/CommandStartedEvent.php index 3ab655e83..31b18d037 100644 --- a/mongodb/Monitoring/CommandStartedEvent.php +++ b/mongodb/Monitoring/CommandStartedEvent.php @@ -2,6 +2,9 @@ namespace MongoDB\Driver\Monitoring; +use MongoDB\BSON\ObjectId; +use MongoDB\Driver\Server; + /** * Encapsulates information about a failed command. * @link https://secure.php.net/manual/en/class.mongodb-driver-monitoring-commandstartedevent.php @@ -21,7 +24,7 @@ final public function __wakeup() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getCommand() {} + final public function getCommand(): object {} /** * Returns the command name. @@ -30,7 +33,7 @@ final public function getCommand() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getCommandName() {} + final public function getCommandName(): string {} /** * Returns the database on which the command was executed. @@ -39,7 +42,7 @@ final public function getCommandName() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getDatabaseName() {} + final public function getDatabaseName(): string {} /** * Returns the command's operation ID. @@ -50,7 +53,7 @@ final public function getDatabaseName() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getOperationId() {} + final public function getOperationId(): string {} /** * Returns the command's request ID. @@ -60,7 +63,7 @@ final public function getOperationId() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getRequestId() {} + final public function getRequestId(): string {} /** * Returns the Server on which the command was executed. @@ -68,5 +71,19 @@ final public function getRequestId() {} * @return \MongoDB\Driver\Server on which the command was executed. * @since 1.3.0 */ - final public function getServer() {} + final public function getServer(): Server {} + + /** + * Returns the load balancer service ID for the command + * @link https://www.php.net/manual/en/mongodb-driver-monitoring-commandstartedevent.getserviceid.php + * @since 1.11.0 + */ + final public function getServiceId(): ?ObjectId {} + + /** + * Returns the server connection ID for the command + * @link https://www.php.net/manual/en/mongodb-driver-monitoring-commandstartedevent.getserverconnectionid.php + * @since 1.14.0 + */ + final public function getServerConnectionId(): ?int {} } diff --git a/mongodb/Monitoring/CommandSucceededEvent.php b/mongodb/Monitoring/CommandSucceededEvent.php index 344a0a65b..d55afe0e0 100644 --- a/mongodb/Monitoring/CommandSucceededEvent.php +++ b/mongodb/Monitoring/CommandSucceededEvent.php @@ -2,6 +2,9 @@ namespace MongoDB\Driver\Monitoring; +use MongoDB\BSON\ObjectId; +use MongoDB\Driver\Server; + /** * Encapsulates information about a successful command. * @link https://secure.php.net/manual/en/class.mongodb-driver-monitoring-commandsucceededevent.php @@ -20,7 +23,7 @@ final public function __wakeup() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getCommandName() {} + final public function getCommandName(): string {} /** * Returns the command's duration in microseconds @@ -30,7 +33,7 @@ final public function getCommandName() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getDurationMicros() {} + final public function getDurationMicros(): int {} /** * Returns the command's operation ID. @@ -41,7 +44,7 @@ final public function getDurationMicros() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getOperationId() {} + final public function getOperationId(): string {} /** * Returns the command reply document. @@ -51,7 +54,7 @@ final public function getOperationId() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getReply() {} + final public function getReply(): object {} /** * Returns the command's request ID. @@ -61,7 +64,7 @@ final public function getReply() {} * @throws \InvalidArgumentException on argument parsing errors. * @since 1.3.0 */ - final public function getRequestId() {} + final public function getRequestId(): string {} /** * Returns the Server on which the command was executed. @@ -69,5 +72,19 @@ final public function getRequestId() {} * @return \MongoDB\Driver\Server on which the command was executed. * @since 1.3.0 */ - final public function getServer() {} + final public function getServer(): Server {} + + /** + * Returns the load balancer service ID for the command + * @link https://www.php.net/manual/en/mongodb-driver-monitoring-commandsucceededevent.getserviceid.php + * @since 1.11.0 + */ + final public function getServiceId(): ?ObjectId {} + + /** + * Returns the server connection ID for the command + * @link https://www.php.net/manual/en/mongodb-driver-monitoring-commandsucceededevent.getserverconnectionid.php + * @since 1.14.0 + */ + final public function getServerConnectionId(): ?int {} } diff --git a/mongodb/Monitoring/SDAMSubscriber.php b/mongodb/Monitoring/SDAMSubscriber.php new file mode 100644 index 000000000..0071d1af6 --- /dev/null +++ b/mongodb/Monitoring/SDAMSubscriber.php @@ -0,0 +1,64 @@ + - * options - * - * - * - * Option - * Type - * Description - * - * - * - * - * - * - * - * readPreference - * MongoDB\Driver\ReadPreference - * - *

- * A read preference to use for selecting a server for the operation. - *

- * - * - * - * session - * MongoDB\Driver\Session - * - *

- * A session to associate with the operation. - *

- * - * - * - * - * The third parameter is now an options array. For backwards compatibility, this parameter will still accept a MongoDB\Driver\ReadPreference object. + * @param Query $query The MongoDB\Driver\Query to execute. + * @param array|ReadPreference|null $options * @throws InvalidArgumentException on argument parsing errors. * @throws ConnectionException if connection to the server fails (for reasons other than authentication). * @throws AuthenticationException if authentication is needed and fails. * @throws RuntimeException on other errors (e.g. invalid command, issuing a write command to a secondary). * @return Cursor */ - final public function executeQuery($namespace, Query $zquery, $options = []) {} + final public function executeQuery(string $namespace, Query $query, array|ReadPreference|null $options = null): Cursor {} /** * Returns the hostname of this server * @link https://php.net/manual/en/mongodb-driver-server.gethost.php * @throws InvalidArgumentException on argument parsing errors. - * @return string */ - final public function getHost() {} + final public function getHost(): string {} /** * Returns an array of information about this server * @link https://php.net/manual/en/mongodb-driver-server.getinfo.php * @throws InvalidArgumentException on argument parsing errors. - * @return array */ - final public function getInfo() {} + final public function getInfo(): array {} /** * Returns the latency of this server * @link https://php.net/manual/en/mongodb-driver-server.getlatency.php * @throws InvalidArgumentException on argument parsing errors. - * @return int */ - final public function getLatency() {} + final public function getLatency(): int {} /** * Returns the port on which this server is listening * @link https://php.net/manual/en/mongodb-driver-server.getport.php * @throws InvalidArgumentException on argument parsing errors. - * @return int */ - final public function getPort() {} + final public function getPort(): int {} + + /** + * Returns a ServerDescription for this server + * https://www.php.net/manual/en/mongodb-driver-server.getserverdescription.php + * @since 1.13.0 + */ + final public function getServerDescription(): ServerDescription {} /** * Returns an array of tags describing this server in a replica set @@ -195,7 +165,7 @@ final public function getPort() {} * @throws InvalidArgumentException on argument parsing errors. * @return array An array of tags used to describe this server in a replica set. The array will contain zero or more string key and value pairs. */ - final public function getTags() {} + final public function getTags(): array {} /** * Returns an integer denoting the type of this server @@ -203,45 +173,40 @@ final public function getTags() {} * @throws InvalidArgumentException on argument parsing errors. * @return int denoting the type of this server */ - final public function getType() {} + final public function getType(): int {} /** * Checks if this server is an arbiter member of a replica set * @link https://php.net/manual/en/mongodb-driver-server.isarbiter.php * @throws InvalidArgumentException on argument parsing errors. - * @return bool */ - final public function isArbiter() {} + final public function isArbiter(): bool {} /** * Checks if this server is a hidden member of a replica set * @link https://php.net/manual/en/mongodb-driver-server.ishidden.php * @throws InvalidArgumentException on argument parsing errors. - * @return bool */ - final public function isHidden() {} + final public function isHidden(): bool {} /** * Checks if this server is a passive member of a replica set * @link https://php.net/manual/en/mongodb-driver-server.ispassive.php * @throws InvalidArgumentException on argument parsing errors. - * @return bool */ - final public function isPassive() {} + final public function isPassive(): bool {} /** * Checks if this server is a primary member of a replica set * @link https://php.net/manual/en/mongodb-driver-server.isprimary.php * @throws InvalidArgumentException on argument parsing errors. - * @return bool */ - final public function isPrimary() {} + final public function isPrimary(): bool {} /** * Checks if this server is a secondary member of a replica set * @link https://php.net/manual/en/mongodb-driver-server.issecondary.php * @throws InvalidArgumentException on argument parsing errors. - * @return bool */ - final public function isSecondary() {} + final public function isSecondary(): bool {} } diff --git a/mongodb/ServerApi.php b/mongodb/ServerApi.php index 30252e829..42a332398 100644 --- a/mongodb/ServerApi.php +++ b/mongodb/ServerApi.php @@ -10,9 +10,9 @@ final public function __construct(string $version, ?bool $strict = false, ?bool public static function __set_state(array $properties) {} - final public function unserialize(string $serialized) {} + final public function unserialize(string $data): void {} - final public function serialize() {} + final public function serialize(): string {} - final public function bsonSerialize() {} + final public function bsonSerialize(): array|object {} } diff --git a/mongodb/ServerDescription.php b/mongodb/ServerDescription.php new file mode 100644 index 000000000..1b1d130f2 --- /dev/null +++ b/mongodb/ServerDescription.php @@ -0,0 +1,60 @@ +