diff --git a/examples/persistable.php b/examples/persistable.php index faf18bf6f..b19faaf9e 100644 --- a/examples/persistable.php +++ b/examples/persistable.php @@ -7,6 +7,7 @@ use MongoDB\BSON\Persistable; use MongoDB\Client; use MongoDB\Model\BSONArray; +use stdClass; use UnexpectedValueException; use function getenv; @@ -34,7 +35,7 @@ public function getId(): ObjectId return $this->id; } - public function bsonSerialize(): object + public function bsonSerialize(): stdClass { return (object) [ '_id' => $this->id, @@ -73,7 +74,7 @@ public function __construct(string $type, string $address) $this->address = $address; } - public function bsonSerialize(): object + public function bsonSerialize(): stdClass { return (object) [ 'type' => $this->type, diff --git a/psalm-baseline.xml b/psalm-baseline.xml index f1db3e9fa..5c5addf71 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -5,6 +5,23 @@ decrypt($document->encryptedField)]]> + + + $this->id, + 'name' => $this->name, + 'emails' => $this->emails, + ]]]> + $this->type, + 'address' => $this->address, + ]]]> + + + stdClass + stdClass + + self::CURSOR_NOT_FOUND @@ -159,6 +176,9 @@ + + index]]> + $fieldName @@ -173,6 +193,17 @@ index['name']]]> + + stdClass + + + + + index]]> + + + stdClass + diff --git a/src/Model/IndexInput.php b/src/Model/IndexInput.php index 4a21bc6c5..ae1726550 100644 --- a/src/Model/IndexInput.php +++ b/src/Model/IndexInput.php @@ -19,6 +19,7 @@ use MongoDB\BSON\Serializable; use MongoDB\Exception\InvalidArgumentException; +use stdClass; use function is_float; use function is_int; @@ -86,7 +87,7 @@ public function __toString(): string * @see \MongoDB\Collection::createIndexes() * @see https://php.net/mongodb-bson-serializable.bsonserialize */ - public function bsonSerialize(): object + public function bsonSerialize(): stdClass { return (object) $this->index; } diff --git a/src/Model/SearchIndexInput.php b/src/Model/SearchIndexInput.php index 991159f6a..c6d87b094 100644 --- a/src/Model/SearchIndexInput.php +++ b/src/Model/SearchIndexInput.php @@ -19,6 +19,7 @@ use MongoDB\BSON\Serializable; use MongoDB\Exception\InvalidArgumentException; +use stdClass; use function is_string; use function MongoDB\is_document; @@ -66,7 +67,7 @@ public function __construct(array $index) * @see \MongoDB\Collection::createSearchIndexes() * @see https://php.net/mongodb-bson-serializable.bsonserialize */ - public function bsonSerialize(): object + public function bsonSerialize(): stdClass { return (object) $this->index; }