Skip to content

Commit f3d9047

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

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"phpunit/phpunit": "^10.5.35",
2121
"rector/rector": "^1.2",
2222
"squizlabs/php_codesniffer": "^3.7",
23+
"symfony/polyfill-php85": "^1.32",
2324
"vimeo/psalm": "6.5.*"
2425
},
2526
"replace": {

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)