Skip to content

Commit 66ed280

Browse files
committed
Add NoDiscard attribute to 'withCollection' methods
1 parent 1befabe commit 66ed280

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"php": "^8.1",
1414
"ext-mongodb": "^2.0",
1515
"composer-runtime-api": "^2.0",
16-
"psr/log": "^1.1.4|^2|^3"
16+
"psr/log": "^1.1.4|^2|^3",
17+
"symfony/polyfill-php85": "^1.32"
1718
},
1819
"require-dev": {
1920
"doctrine/coding-standard": "^12.0",

src/ClientBulkWrite.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use MongoDB\Driver\BulkWriteCommand;
2525
use MongoDB\Driver\Manager;
2626
use MongoDB\Exception\InvalidArgumentException;
27+
use NoDiscard;
2728
use stdClass;
2829

2930
use function is_array;
@@ -42,6 +43,7 @@ private function __construct(
4243
) {
4344
}
4445

46+
#[NoDiscard]
4547
public static function createWithCollection(Collection $collection, array $options = []): self
4648
{
4749
$options += ['ordered' => true];
@@ -224,6 +226,7 @@ public function updateOne(array|object $filter, array|object $update, array $opt
224226
return $this;
225227
}
226228

229+
#[NoDiscard]
227230
public function withCollection(Collection $collection): self
228231
{
229232
/* Prohibit mixing Collections associated with different Manager

0 commit comments

Comments
 (0)