Skip to content

Commit 062b5db

Browse files
committed
Fix psalm error
1 parent 3b3deb8 commit 062b5db

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Operation/DropSearchIndex.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
namespace MongoDB\Operation;
1919

2020
use MongoDB\Driver\Command;
21-
use MongoDB\Driver\Cursor;
2221
use MongoDB\Driver\Exception\CommandException;
2322
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
2423
use MongoDB\Driver\Server;
@@ -54,11 +53,14 @@ public function __construct(private string $databaseName, private string $collec
5453
/**
5554
* Execute the operation.
5655
*
56+
* TODO PHP 8.2: Change return type to null
57+
*
5758
* @see Executable::execute()
5859
* @throws UnsupportedException if write concern is used and unsupported
5960
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
61+
* @return null
6062
*/
61-
public function execute(Server $server): Cursor
63+
public function execute(Server $server): mixed
6264
{
6365
$cmd = [
6466
'dropSearchIndex' => $this->collectionName,
@@ -70,12 +72,14 @@ public function execute(Server $server): Cursor
7072
}
7173

7274
try {
73-
return $server->executeCommand($this->databaseName, new Command($cmd));
75+
$server->executeCommand($this->databaseName, new Command($cmd));
7476
} catch (CommandException $e) {
7577
// Drop operations are idempotent. The server may return an error if the collection does not exist.
7678
if ($e->getCode() !== self::ERROR_CODE_NAMESPACE_NOT_FOUND) {
7779
throw $e;
7880
}
7981
}
82+
83+
return null;
8084
}
8185
}

0 commit comments

Comments
 (0)