Skip to content

Commit 234e544

Browse files
committed
Help BSON encoding by returning an object instead of an assoc array
1 parent a409ac9 commit 234e544

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Model/IndexInput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ public function __toString(): string
8787
* @see \MongoDB\Collection::createIndexes()
8888
* @see https://php.net/mongodb-bson-serializable.bsonserialize
8989
*/
90-
public function bsonSerialize(): array
90+
public function bsonSerialize(): object
9191
{
92-
return $this->index;
92+
return (object) $this->index;
9393
}
9494

9595
/**

src/Model/SearchIndexInput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public function __construct(array $index)
6767
* @see \MongoDB\Collection::createSearchIndexes()
6868
* @see https://php.net/mongodb-bson-serializable.bsonserialize
6969
*/
70-
public function bsonSerialize(): array
70+
public function bsonSerialize(): object
7171
{
72-
return $this->index;
72+
return (object) $this->index;
7373
}
7474
}

0 commit comments

Comments
 (0)