|
| 1 | +# UPGRADE FROM 1.x to 1.15 |
| 2 | + |
| 3 | +## Method signature changes |
| 4 | + |
| 5 | +### Parameter types |
| 6 | + |
| 7 | +Starting with 1.15, methods now declare types for their arguments. This will not |
| 8 | +cause BC breaks unless you've passed a type that was incompatible with the type |
| 9 | +previously documented in the PHPDoc comment. A list of changes can be found at |
| 10 | +the bottom of this document. |
| 11 | + |
| 12 | +### Return types |
| 13 | + |
| 14 | +Return types will be added in version 2.0. These types are documented in a |
| 15 | +PHPDoc comment and will eventually become a declared return type. You can |
| 16 | +prepare for this change (which will trigger a BC break in any class you may |
| 17 | +extend) by adding the correct return type to your class at this time. |
| 18 | + |
| 19 | +## Internal classes |
| 20 | + |
| 21 | +Internal classes (i.e. annotated with `@internal`) will become final where |
| 22 | +possible in a future release. At the same time, we will add return types to |
| 23 | +these internal classes. Note that internal classes are not covered by our |
| 24 | +backward compatibility promise, and you should not instantiate such classes |
| 25 | +directly. |
| 26 | + |
| 27 | +## Method signature changes by class |
| 28 | + |
| 29 | +### MongoDB\Client |
| 30 | + |
| 31 | +| 1.13 | 1.15 | |
| 32 | +|-----------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------| |
| 33 | +| `__construct($uri = 'mongodb://127.0.0.1', array $uriOptions = [], array $driverOptions = [])` | `__construct(?string $uri = null, array $uriOptions = [], array $driverOptions = [])` | |
| 34 | +| `__get($databaseName)` | `__get(string $databaseName)` | |
| 35 | +| `dropDatabase($databaseName, array $options = [])` | `dropDatabase(string $databaseName, array $options = [])` | |
| 36 | +| `selectCollection($databaseName, $collectionName, array $options = [])` | `selectCollection(string $databaseName, string $collectionName, array $options = [])` | |
| 37 | +| `selectDatabase($databaseName, array $options = [])` | `selectDatabase(string $databaseName, array $options = [])` | |
| 38 | + |
| 39 | +### MongoDB\Database |
| 40 | + |
| 41 | +| 1.13 | 1.15 | |
| 42 | +|-----------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------| |
| 43 | +| `__construct(MongoDB\Driver\Manager $manager, $databaseName, array $options = [])` | `__construct(MongoDB\Driver\Manager $manager, string $databaseName, array $options = [])` | |
| 44 | +| `__get($collectionName)` | `__get(string $collectionName)` | |
| 45 | +| `createCollection($collectionName, array $options = [])` | `createCollection(string $collectionName, array $options = [])` | |
| 46 | +| `dropCollection($collectionName, array $options = [])` | `dropCollection(string $collectionName, array $options = [])` | |
| 47 | +| `modifyCollection($collectionName, array $collectionOptions, array $options = [])` | `modifyCollection(string $collectionName, array $collectionOptions, array $options = [])` | |
| 48 | +| `selectCollection($collectionName, array $options = [])` | `selectCollection(string $collectionName, array $options = [])` | |
| 49 | + |
| 50 | +### MongoDB\Collection |
| 51 | + |
| 52 | +| 1.13 | 1.15 | |
| 53 | +|----------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------| |
| 54 | +| `__construct(MongoDB\Driver\Manager $manager, $databaseName, $collectionName, array $options = [])` | `__construct(MongoDB\Driver\Manager $manager, string $databaseName, string $collectionName, array $options = [])` | |
| 55 | +| `distinct($fieldName, $filter = [], array $options = [])` | `distinct(string $fieldName, $filter = [], array $options = [])` | |
| 56 | + |
| 57 | +### MongoDB\GridFS\Bucket |
| 58 | + |
| 59 | +| 1.13 | 1.15 | |
| 60 | +|-----------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------| |
| 61 | +| `__construct(MongoDB\Driver\Manager $manager, $databaseName, array $options = [])` | `__construct(MongoDB\Driver\Manager $manager, string $databaseName, array $options = [])` | |
| 62 | +| `downloadToStreamByName($filename, $destination, array $options = [])` | `downloadToStreamByName(string $filename, $destination, array $options = [])` | |
| 63 | +| `openDownloadStreamByName($filename, array $options = [])` | `openDownloadStreamByName(string $filename, array $options = [])` | |
| 64 | +| `openUploadStream($filename, array $options = [])` | `openUploadStream(string $filename, array $options = [])` | |
| 65 | +| `uploadFromStream($filename, $source, array $options = [])` | `uploadFromStream(string $filename, $source, array $options = [])` | |
| 66 | +| `rename($id, $newFilename)` | `rename($id, string $newFilename)` | |
0 commit comments