Skip to content

Commit

Permalink
Add missing stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus authored and isfedorov committed Jul 14, 2023
1 parent 614f009 commit 3bb9c8a
Show file tree
Hide file tree
Showing 51 changed files with 863 additions and 415 deletions.
12 changes: 12 additions & 0 deletions PhpStormStubsMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
25 changes: 11 additions & 14 deletions mongodb/BSON/Binary.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions mongodb/BSON/DBPointer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final private function __construct() {}
* @return string
* @throws InvalidArgumentException
*/
final public function serialize() {}
final public function serialize(): string {}

/**
* Unserialize a DBPointer
Expand All @@ -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
Expand All @@ -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 {}
}
11 changes: 4 additions & 7 deletions mongodb/BSON/Decimal128.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions mongodb/BSON/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}

Expand Down
9 changes: 3 additions & 6 deletions mongodb/BSON/Int64.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {}
}
20 changes: 6 additions & 14 deletions mongodb/BSON/Javascript.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions mongodb/BSON/MaxKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 2 additions & 5 deletions mongodb/BSON/MinKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 5 additions & 8 deletions mongodb/BSON/ObjectId.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

Expand All @@ -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
Expand All @@ -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 {}
}
3 changes: 1 addition & 2 deletions mongodb/BSON/PackedArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}

Expand Down
Loading

0 comments on commit 3bb9c8a

Please sign in to comment.