diff --git a/PhpStormStubsMap.php b/PhpStormStubsMap.php index 1924853eb..3b047654b 100644 --- a/PhpStormStubsMap.php +++ b/PhpStormStubsMap.php @@ -693,6 +693,7 @@ 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\\LogSubscriber' => 'mongodb/Monitoring/LogSubscriber.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', diff --git a/mongodb/BSON/Document.php b/mongodb/BSON/Document.php index 86cb17aec..37b3fe610 100644 --- a/mongodb/BSON/Document.php +++ b/mongodb/BSON/Document.php @@ -28,6 +28,18 @@ final public function toCanonicalExtendedJSON(): string {} final public function toRelaxedExtendedJSON(): string {} + /** @since 1.17.0 */ + public function offsetExists(mixed $offset): bool {} + + /** @since 1.17.0 */ + public function offsetGet(mixed $offset): mixed {} + + /** @since 1.17.0 */ + public function offsetSet(mixed $offset, mixed $value): void {} + + /** @since 1.17.0 */ + public function offsetUnset(mixed $offset): void {} + final public function __toString(): string {} final public static function __set_state(array $properties): Document {} diff --git a/mongodb/BSON/PackedArray.php b/mongodb/BSON/PackedArray.php index 4fc63d8d5..1cb83bfdb 100644 --- a/mongodb/BSON/PackedArray.php +++ b/mongodb/BSON/PackedArray.php @@ -20,6 +20,18 @@ final public function has(int $index): bool {} final public function toPHP(?array $typeMap = null): array|object {} + /** @since 1.17.0 */ + public function offsetExists(mixed $offset): bool {} + + /** @since 1.17.0 */ + public function offsetGet(mixed $offset): mixed {} + + /** @since 1.17.0 */ + public function offsetSet(mixed $offset, mixed $value): void {} + + /** @since 1.17.0 */ + public function offsetUnset(mixed $offset): void {} + final public function __toString(): string {} final public static function __set_state(array $properties): PackedArray {} diff --git a/mongodb/BSON/Persistable.php b/mongodb/BSON/Persistable.php index e31ca6bcb..23fc356b0 100644 --- a/mongodb/BSON/Persistable.php +++ b/mongodb/BSON/Persistable.php @@ -2,8 +2,14 @@ namespace MongoDB\BSON; +use stdClass; + /** * Classes may implement this interface to take advantage of automatic ODM (object document mapping) behavior in the driver. * @link https://php.net/manual/en/class.mongodb-bson-persistable.php */ -interface Persistable extends Unserializable, Serializable {} +interface Persistable extends Unserializable, Serializable +{ + /** @since 1.17.0 */ + public function bsonSerialize(): array|stdClass|Document; +} diff --git a/mongodb/BSON/Serializable.php b/mongodb/BSON/Serializable.php index 57b242f62..a6e6995ed 100644 --- a/mongodb/BSON/Serializable.php +++ b/mongodb/BSON/Serializable.php @@ -2,6 +2,8 @@ namespace MongoDB\BSON; +use stdClass; + /** * Classes that implement this interface may return data to be serialized as a BSON array or document in lieu of the object's public properties * @link https://php.net/manual/en/class.mongodb-bson-serializable.php @@ -14,7 +16,6 @@ interface Serializable extends Type * Root documents (e.g. a MongoDB\BSON\Serializable passed to MongoDB\BSON\fromPHP()) will always be serialized as a BSON document. * For field values, associative arrays and stdClass instances will be serialized as a BSON document and sequential arrays (i.e. sequential, numeric indexes starting at 0) will be serialized as a BSON array. * @link https://php.net/manual/en/mongodb-bson-serializable.bsonserialize.php - * @return array|object An array or stdClass to be serialized as a BSON array or document. */ - public function bsonSerialize(); + public function bsonSerialize(): array|stdClass|Document|PackedArray; } diff --git a/mongodb/Monitoring/LogSubscriber.php b/mongodb/Monitoring/LogSubscriber.php new file mode 100644 index 000000000..362251c91 --- /dev/null +++ b/mongodb/Monitoring/LogSubscriber.php @@ -0,0 +1,23 @@ +