Skip to content

Commit f4b38dc

Browse files
committed
Help BSON encoding by returning an object instead of an assoc array
1 parent b081578 commit f4b38dc

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
@@ -86,9 +86,9 @@ public function __toString(): string
8686
* @see \MongoDB\Collection::createIndexes()
8787
* @see https://php.net/mongodb-bson-serializable.bsonserialize
8888
*/
89-
public function bsonSerialize(): array
89+
public function bsonSerialize(): object
9090
{
91-
return $this->index;
91+
return (object) $this->index;
9292
}
9393

9494
/**

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)