@@ -305,29 +305,28 @@ public function createCollection(string $collectionName, array $options = [])
305
305
}
306
306
307
307
/**
308
- * Create a new encrypted collection.
308
+ * Create a new encrypted collection explicitly .
309
309
*
310
310
* This function will automatically create data keys for any encrypted
311
311
* fields where the "keyId" option is null. This function will return a copy
312
312
* of the modified "encryptedFields" option in addition to the result from
313
- * createCollection().
314
- *
315
- * This function requires that the "encryptedFields" option be specified.
313
+ * createCollection(). The "encryptedFields" option is required.
316
314
*
317
315
* If any error is encountered while creating data keys or invoking
318
316
* createCollection(), a CreateEncryptedCollectionException will be thrown.
319
317
* The original exception and modified "encryptedFields" option can be
320
- * accessed via getPrevious() and getEncryptedFields(), respectively.
318
+ * accessed via the getPrevious() and getEncryptedFields() methods,
319
+ * respectively.
321
320
*
322
321
* @see CreateCollection::__construct() for supported options
323
322
* @return array A tuple consisting of the createCollection() result and modified "encryptedFields" option
324
323
* @throws InvalidArgumentException for parameter/option parsing errors
325
- * @throws CreateEncryptedCollectionException for errors generating data keys or invoking createCollection
324
+ * @throws CreateEncryptedCollectionException for any errors creating data keys or invoking createCollection()
326
325
*/
327
326
public function createEncryptedCollection (string $ collectionName , ClientEncryption $ clientEncryption , string $ kmsProvider , ?array $ masterKey , array $ options ): array
328
327
{
329
328
if (! isset ($ options ['encryptedFields ' ]) || ! is_array ($ options ['encryptedFields ' ]) && ! is_object ($ options ['encryptedFields ' ])) {
330
- throw InvalidArgumentException::invalidType ('"encryptedFields" option ' , $ options ['encryptedFields ' ] ?? null , 'array or object ' );
329
+ throw InvalidArgumentException::invalidType ('"encryptedFields" option ' , $ options ['encryptedFields ' ] ?? null , [ 'array ' , ' object '] );
331
330
}
332
331
333
332
$ encryptedFields = (array ) recursive_copy ($ options ['encryptedFields ' ]);
0 commit comments