Skip to content

Commit 97a7482

Browse files
committed
Help BSON encoding by returning an object instead of an assoc array
1 parent b5f1e4b commit 97a7482

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

9696
/**

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)