Skip to content

Commit fe5d64d

Browse files
committed
Update documentation
1 parent 6793cce commit fe5d64d

File tree

7 files changed

+13
-18
lines changed

7 files changed

+13
-18
lines changed

docs/includes/apiargs-MongoDBCollection-method-rename-param.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ arg_name: param
22
name: $toCollectionName
33
type: string
44
description: |
5-
The new name of the collection. If a full namespace is not
6-
specified, the database of the original collection will be used. If the new
7-
namespace specifies a different database, the command copies the collection
8-
to the new database and drops the source collection.
5+
The new name of the collection.
96
interface: phpmethod
107
operation: ~
118
optional: false

docs/reference/method/MongoDBCollection-rename.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
MongoDB\\Collection::rename()
33
=============================
44

5-
.. versionadded:: 1.9
5+
.. versionadded:: 1.10
66

77
.. default-domain:: mongodb
88

docs/reference/method/MongoDBDatabase-renameCollection.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
MongoDB\\Database::renameCollection()
33
=====================================
44

5-
.. versionadded:: 1.9
5+
.. versionadded:: 1.10
66

77
.. default-domain:: mongodb
88

src/Collection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,9 +1009,9 @@ public function mapReduce(JavascriptInterface $map, JavascriptInterface $reduce,
10091009
* Renames the collection.
10101010
*
10111011
* @see RenameCollection::__construct() for supported options
1012-
* @param string $toCollectionName New name of the collection
1013-
* @param string $toDatabaseName New database name of the collection
1014-
* @param array $options Additional options
1012+
* @param string $toCollectionName New name of the collection
1013+
* @param ?string $toDatabaseName New database name of the collection. Defaults to the original database.
1014+
* @param array $options Additional options
10151015
* @return array|object Command result document
10161016
* @throws UnsupportedException if options are not supported by the selected server
10171017
* @throws InvalidArgumentException for parameter/option parsing errors

src/Database.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,10 @@ public function modifyCollection($collectionName, array $collectionOptions, arra
475475
* Rename a collection within this database.
476476
*
477477
* @see RenameCollection::__construct() for supported options
478-
* @param string $fromCollectionName Collection name
479-
* @param string $toCollectionName New name of the collection
480-
* @param string $toDatabaseName New database name of the collection
481-
* @param array $options Additional options
478+
* @param string $fromCollectionName Collection name
479+
* @param string $toCollectionName New name of the collection
480+
* @param ?string $toDatabaseName New database name of the collection. Defaults to the original database.
481+
* @param array $options Additional options
482482
* @return array|object Command result document
483483
* @throws UnsupportedException if options are unsupported on the selected server
484484
* @throws InvalidArgumentException for parameter/option parsing errors

src/Operation/RenameCollection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class RenameCollection implements Executable
7878
* @param array $options Command options
7979
* @throws InvalidArgumentException for parameter/option parsing errors
8080
*/
81-
public function __construct($fromDatabaseName, $fromCollectionName, $toDatabaseName, $toCollectionName, array $options = [])
81+
public function __construct(string $fromDatabaseName, string $fromCollectionName, string $toDatabaseName, string $toCollectionName, array $options = [])
8282
{
8383
if (isset($options['session']) && ! $options['session'] instanceof Session) {
8484
throw InvalidArgumentException::invalidType('"session" option', $options['session'], Session::class);
@@ -100,8 +100,8 @@ public function __construct($fromDatabaseName, $fromCollectionName, $toDatabaseN
100100
throw InvalidArgumentException::invalidType('"dropTarget" option', $options['dropTarget'], 'boolean');
101101
}
102102

103-
$this->fromNamespace = (string) $fromDatabaseName . '.' . (string) $fromCollectionName;
104-
$this->toNamespace = (string) $toDatabaseName . '.' . (string) $toCollectionName;
103+
$this->fromNamespace = $fromDatabaseName . '.' . $fromCollectionName;
104+
$this->toNamespace = $toDatabaseName . '.' . $toCollectionName;
105105
$this->options = $options;
106106
}
107107

tests/FunctionalTestCase.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ protected function assertCollectionDoesNotExist(string $collectionName, ?string
186186
* the given name is found, it will be passed to the callback, which may
187187
* perform additional assertions.
188188
*
189-
* @param string $collectionName
190-
* @param string $databaseName Defaults to TestCase::getDatabaseName()
191189
* @param callable $callback
192190
*/
193191
protected function assertCollectionExists(string $collectionName, ?string $databaseName = null, ?callable $callback = null): void

0 commit comments

Comments
 (0)