5454use Throwable ;
5555
5656use function is_array ;
57- use function sprintf ;
5857use function strlen ;
59- use function trigger_error ;
60-
61- use const E_USER_DEPRECATED ;
6258
6359class Database
6460{
@@ -274,19 +270,12 @@ public function command(array|object $command, array $options = []): CursorInter
274270 * @see CreateCollection::__construct() for supported options
275271 * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#create-collection-helper
276272 * @see https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/manage-collections/
277- * @return array|object Command result document
278273 * @throws UnsupportedException if options are not supported by the selected server
279274 * @throws InvalidArgumentException for parameter/option parsing errors
280275 * @throws DriverRuntimeException for other driver errors (e.g. connection errors)
281276 */
282- public function createCollection (string $ collectionName , array $ options = []): array | object
277+ public function createCollection (string $ collectionName , array $ options = []): void
283278 {
284- if (! isset ($ options ['typeMap ' ])) {
285- $ options ['typeMap ' ] = $ this ->typeMap ;
286- } else {
287- @trigger_error (sprintf ('The function %s() will return nothing in mongodb/mongodb v2.0, the "typeMap" option is deprecated ' , __FUNCTION__ ), E_USER_DEPRECATED );
288- }
289-
290279 if (! isset ($ options ['writeConcern ' ]) && ! is_in_transaction ($ options )) {
291280 $ options ['writeConcern ' ] = $ this ->writeConcern ;
292281 }
@@ -301,7 +290,7 @@ public function createCollection(string $collectionName, array $options = []): a
301290
302291 $ server = select_server_for_write ($ this ->manager , $ options );
303292
304- return $ operation ->execute ($ server );
293+ $ operation ->execute ($ server );
305294 }
306295
307296 /**
@@ -319,19 +308,13 @@ public function createCollection(string $collectionName, array $options = []): a
319308 * getPrevious() and getEncryptedFields() methods, respectively.
320309 *
321310 * @see CreateCollection::__construct() for supported options
322- * @return array A tuple containing the command result document from creating the collection and the modified "encryptedFields" option
311+ * @return array The modified "encryptedFields" option
323312 * @throws InvalidArgumentException for parameter/option parsing errors
324313 * @throws CreateEncryptedCollectionException for any errors creating data keys or creating the collection
325314 * @throws UnsupportedException if Queryable Encryption is not supported by the selected server
326315 */
327316 public function createEncryptedCollection (string $ collectionName , ClientEncryption $ clientEncryption , string $ kmsProvider , ?array $ masterKey , array $ options ): array
328317 {
329- if (! isset ($ options ['typeMap ' ])) {
330- $ options ['typeMap ' ] = $ this ->typeMap ;
331- } else {
332- @trigger_error (sprintf ('The function %s() will return nothing in mongodb/mongodb v2.0, the "typeMap" option is deprecated ' , __FUNCTION__ ), E_USER_DEPRECATED );
333- }
334-
335318 if (! isset ($ options ['writeConcern ' ]) && ! is_in_transaction ($ options )) {
336319 $ options ['writeConcern ' ] = $ this ->writeConcern ;
337320 }
@@ -340,10 +323,10 @@ public function createEncryptedCollection(string $collectionName, ClientEncrypti
340323 $ server = select_server_for_write ($ this ->manager , $ options );
341324
342325 try {
343- $ operation ->createDataKeys ($ clientEncryption , $ kmsProvider , $ masterKey, $ encryptedFields );
344- $ result = $ operation ->execute ($ server );
326+ $ encryptedFields = $ operation ->createDataKeys ($ clientEncryption , $ kmsProvider , $ masterKey );
327+ $ operation ->execute ($ server );
345328
346- return [ $ result , $ encryptedFields] ;
329+ return $ encryptedFields ;
347330 } catch (Throwable $ e ) {
348331 throw new CreateEncryptedCollectionException ($ e , $ encryptedFields ?? []);
349332 }
@@ -354,19 +337,12 @@ public function createEncryptedCollection(string $collectionName, ClientEncrypti
354337 *
355338 * @see DropDatabase::__construct() for supported options
356339 * @param array $options Additional options
357- * @return array|object Command result document
358340 * @throws UnsupportedException if options are unsupported on the selected server
359341 * @throws InvalidArgumentException for parameter/option parsing errors
360342 * @throws DriverRuntimeException for other driver errors (e.g. connection errors)
361343 */
362- public function drop (array $ options = []): array | object
344+ public function drop (array $ options = []): void
363345 {
364- if (! isset ($ options ['typeMap ' ])) {
365- $ options ['typeMap ' ] = $ this ->typeMap ;
366- } else {
367- @trigger_error (sprintf ('The function %s() will return nothing in mongodb/mongodb v2.0, the "typeMap" option is deprecated ' , __FUNCTION__ ), E_USER_DEPRECATED );
368- }
369-
370346 $ server = select_server_for_write ($ this ->manager , $ options );
371347
372348 if (! isset ($ options ['writeConcern ' ]) && ! is_in_transaction ($ options )) {
@@ -375,7 +351,7 @@ public function drop(array $options = []): array|object
375351
376352 $ operation = new DropDatabase ($ this ->databaseName , $ options );
377353
378- return $ operation ->execute ($ server );
354+ $ operation ->execute ($ server );
379355 }
380356
381357 /**
@@ -384,19 +360,12 @@ public function drop(array $options = []): array|object
384360 * @see DropCollection::__construct() for supported options
385361 * @param string $collectionName Collection name
386362 * @param array $options Additional options
387- * @return array|object Command result document
388363 * @throws UnsupportedException if options are unsupported on the selected server
389364 * @throws InvalidArgumentException for parameter/option parsing errors
390365 * @throws DriverRuntimeException for other driver errors (e.g. connection errors)
391366 */
392- public function dropCollection (string $ collectionName , array $ options = []): array | object
367+ public function dropCollection (string $ collectionName , array $ options = []): void
393368 {
394- if (! isset ($ options ['typeMap ' ])) {
395- $ options ['typeMap ' ] = $ this ->typeMap ;
396- } else {
397- @trigger_error (sprintf ('The function %s() will return nothing in mongodb/mongodb v2.0, the "typeMap" option is deprecated ' , __FUNCTION__ ), E_USER_DEPRECATED );
398- }
399-
400369 $ server = select_server_for_write ($ this ->manager , $ options );
401370
402371 if (! isset ($ options ['writeConcern ' ]) && ! is_in_transaction ($ options )) {
@@ -412,7 +381,7 @@ public function dropCollection(string $collectionName, array $options = []): arr
412381 ? new DropEncryptedCollection ($ this ->databaseName , $ collectionName , $ options )
413382 : new DropCollection ($ this ->databaseName , $ collectionName , $ options );
414383
415- return $ operation ->execute ($ server );
384+ $ operation ->execute ($ server );
416385 }
417386
418387 /**
@@ -534,21 +503,16 @@ public function modifyCollection(string $collectionName, array $collectionOption
534503 * @param string $toCollectionName New name of the collection
535504 * @param string|null $toDatabaseName New database name of the collection. Defaults to the original database.
536505 * @param array $options Additional options
537- * @return array|object Command result document
538506 * @throws UnsupportedException if options are unsupported on the selected server
539507 * @throws InvalidArgumentException for parameter/option parsing errors
540508 * @throws DriverRuntimeException for other driver errors (e.g. connection errors)
541509 */
542- public function renameCollection (string $ fromCollectionName , string $ toCollectionName , ?string $ toDatabaseName = null , array $ options = []): array | object
510+ public function renameCollection (string $ fromCollectionName , string $ toCollectionName , ?string $ toDatabaseName = null , array $ options = []): void
543511 {
544512 if (! isset ($ toDatabaseName )) {
545513 $ toDatabaseName = $ this ->databaseName ;
546514 }
547515
548- if (! isset ($ options ['typeMap ' ])) {
549- $ options ['typeMap ' ] = $ this ->typeMap ;
550- }
551-
552516 $ server = select_server_for_write ($ this ->manager , $ options );
553517
554518 if (! isset ($ options ['writeConcern ' ]) && ! is_in_transaction ($ options )) {
@@ -557,7 +521,7 @@ public function renameCollection(string $fromCollectionName, string $toCollectio
557521
558522 $ operation = new RenameCollection ($ this ->databaseName , $ fromCollectionName , $ toDatabaseName , $ toCollectionName , $ options );
559523
560- return $ operation ->execute ($ server );
524+ $ operation ->execute ($ server );
561525 }
562526
563527 /**
0 commit comments