Skip to content

Commit e116b0e

Browse files
committed
Default BulkWriteCommandBuilder options to empty arrays
This is actually required for the union assignment in createWithCollection(). The nullable arrays were copied from the extension, but are inconsistent with other PHPLIB APIs.
1 parent 648e851 commit e116b0e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/BulkWriteCommandBuilder.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private function __construct(
3838
) {
3939
}
4040

41-
public static function createWithCollection(Collection $collection, array $options): self
41+
public static function createWithCollection(Collection $collection, array $options = []): self
4242
{
4343
$options += ['ordered' => true];
4444

@@ -67,7 +67,7 @@ public static function createWithCollection(Collection $collection, array $optio
6767
);
6868
}
6969

70-
public function deleteMany(array|object $filter, ?array $options = null): self
70+
public function deleteMany(array|object $filter, array $options = []): self
7171
{
7272
$filter = $this->builderEncoder->encodeIfSupported($filter);
7373

@@ -84,7 +84,7 @@ public function deleteMany(array|object $filter, ?array $options = null): self
8484
return $this;
8585
}
8686

87-
public function deleteOne(array|object $filter, ?array $options = null): self
87+
public function deleteOne(array|object $filter, array $options = []): self
8888
{
8989
$filter = $this->builderEncoder->encodeIfSupported($filter);
9090

@@ -113,7 +113,7 @@ public function insertOne(array|object $document, mixed &$id = null): self
113113
return $this;
114114
}
115115

116-
public function replaceOne(array|object $filter, array|object $replacement, ?array $options = null): self
116+
public function replaceOne(array|object $filter, array|object $replacement, array $options = []): self
117117
{
118118
$filter = $this->builderEncoder->encodeIfSupported($filter);
119119

@@ -155,7 +155,7 @@ public function replaceOne(array|object $filter, array|object $replacement, ?arr
155155
return $this;
156156
}
157157

158-
public function updateMany(array|object $filter, array|object $update, ?array $options = null): self
158+
public function updateMany(array|object $filter, array|object $update, array $options = []): self
159159
{
160160
$filter = $this->builderEncoder->encodeIfSupported($filter);
161161
$update = $this->builderEncoder->encodeIfSupported($update);
@@ -185,7 +185,7 @@ public function updateMany(array|object $filter, array|object $update, ?array $o
185185
return $this;
186186
}
187187

188-
public function updateOne(array|object $filter, array|object $update, ?array $options = null): self
188+
public function updateOne(array|object $filter, array|object $update, array $options = []): self
189189
{
190190
$filter = $this->builderEncoder->encodeIfSupported($filter);
191191
$update = $this->builderEncoder->encodeIfSupported($update);

0 commit comments

Comments
 (0)