From 701b39d7b3aa79c011112f3c8cdbf8f59fc47cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Thu, 12 Sep 2024 14:41:13 +0200 Subject: [PATCH 1/3] PHPLIB-953 Make internal classes final --- src/Command/ListCollections.php | 2 +- src/Command/ListDatabases.php | 2 +- src/GridFS/CollectionWrapper.php | 2 +- src/GridFS/ReadableStream.php | 2 +- src/GridFS/StreamWrapper.php | 4 ++-- src/GridFS/WritableStream.php | 2 +- src/Model/CachingIterator.php | 2 +- src/Model/CallbackIterator.php | 2 +- src/Model/ChangeStreamIterator.php | 2 +- src/Model/CollectionInfoCommandIterator.php | 2 +- src/Model/DatabaseInfoLegacyIterator.php | 2 +- src/Model/IndexInfoIteratorIterator.php | 2 +- src/Model/IndexInput.php | 2 +- src/Model/SearchIndexInput.php | 2 +- src/Operation/CreateEncryptedCollection.php | 2 +- src/Operation/Delete.php | 2 +- src/Operation/DropEncryptedCollection.php | 2 +- src/Operation/FindAndModify.php | 2 +- src/Operation/Update.php | 2 +- src/Operation/WithTransaction.php | 2 +- 20 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Command/ListCollections.php b/src/Command/ListCollections.php index 454e145f3..f2fb2410f 100644 --- a/src/Command/ListCollections.php +++ b/src/Command/ListCollections.php @@ -36,7 +36,7 @@ * @internal * @see https://mongodb.com/docs/manual/reference/command/listCollections/ */ -class ListCollections implements Executable +final class ListCollections implements Executable { /** * Constructs a listCollections command. diff --git a/src/Command/ListDatabases.php b/src/Command/ListDatabases.php index 5386559db..7ceeb4206 100644 --- a/src/Command/ListDatabases.php +++ b/src/Command/ListDatabases.php @@ -37,7 +37,7 @@ * @internal * @see https://mongodb.com/docs/manual/reference/command/listDatabases/ */ -class ListDatabases implements Executable +final class ListDatabases implements Executable { /** * Constructs a listDatabases command. diff --git a/src/GridFS/CollectionWrapper.php b/src/GridFS/CollectionWrapper.php index 0c6b9b96c..a28185cb0 100644 --- a/src/GridFS/CollectionWrapper.php +++ b/src/GridFS/CollectionWrapper.php @@ -39,7 +39,7 @@ * * @internal */ -class CollectionWrapper +final class CollectionWrapper { private Collection $chunksCollection; diff --git a/src/GridFS/ReadableStream.php b/src/GridFS/ReadableStream.php index 980e3e19f..c8441d18c 100644 --- a/src/GridFS/ReadableStream.php +++ b/src/GridFS/ReadableStream.php @@ -38,7 +38,7 @@ * * @internal */ -class ReadableStream +final class ReadableStream { private ?string $buffer = null; diff --git a/src/GridFS/StreamWrapper.php b/src/GridFS/StreamWrapper.php index cc1d89fc9..302a63385 100644 --- a/src/GridFS/StreamWrapper.php +++ b/src/GridFS/StreamWrapper.php @@ -49,7 +49,7 @@ * @see Bucket::openDownloadStream() * @psalm-type ContextOptions = array{collectionWrapper: CollectionWrapper, file: object}|array{collectionWrapper: CollectionWrapper, filename: string, options: array} */ -class StreamWrapper +final class StreamWrapper { /** @var resource|null Stream context (set by PHP) */ public $context; @@ -89,7 +89,7 @@ public static function register(string $protocol = 'gridfs'): void stream_wrapper_unregister($protocol); } - stream_wrapper_register($protocol, static::class, STREAM_IS_URL); + stream_wrapper_register($protocol, self::class, STREAM_IS_URL); } /** diff --git a/src/GridFS/WritableStream.php b/src/GridFS/WritableStream.php index 65b35de90..75b4610d4 100644 --- a/src/GridFS/WritableStream.php +++ b/src/GridFS/WritableStream.php @@ -42,7 +42,7 @@ * * @internal */ -class WritableStream +final class WritableStream { private const DEFAULT_CHUNK_SIZE_BYTES = 261120; diff --git a/src/Model/CachingIterator.php b/src/Model/CachingIterator.php index 15ba7ca1a..2f4fcb29f 100644 --- a/src/Model/CachingIterator.php +++ b/src/Model/CachingIterator.php @@ -40,7 +40,7 @@ * @template TValue * @template-implements Iterator */ -class CachingIterator implements Countable, Iterator +final class CachingIterator implements Countable, Iterator { private const FIELD_KEY = 0; private const FIELD_VALUE = 1; diff --git a/src/Model/CallbackIterator.php b/src/Model/CallbackIterator.php index ea429ccbc..cf7e60fa5 100644 --- a/src/Model/CallbackIterator.php +++ b/src/Model/CallbackIterator.php @@ -34,7 +34,7 @@ * @template TCallbackValue * @template-implements Iterator */ -class CallbackIterator implements Iterator +final class CallbackIterator implements Iterator { /** @var callable(TValue, TKey): TCallbackValue */ private $callback; diff --git a/src/Model/ChangeStreamIterator.php b/src/Model/ChangeStreamIterator.php index aa635dda9..721c59734 100644 --- a/src/Model/ChangeStreamIterator.php +++ b/src/Model/ChangeStreamIterator.php @@ -51,7 +51,7 @@ * @template TValue of array|object * @template-extends IteratorIterator&Iterator> */ -class ChangeStreamIterator extends IteratorIterator implements CommandSubscriber +final class ChangeStreamIterator extends IteratorIterator implements CommandSubscriber { private int $batchPosition = 0; diff --git a/src/Model/CollectionInfoCommandIterator.php b/src/Model/CollectionInfoCommandIterator.php index 14ef39a02..3a87db65b 100644 --- a/src/Model/CollectionInfoCommandIterator.php +++ b/src/Model/CollectionInfoCommandIterator.php @@ -32,7 +32,7 @@ * @see https://mongodb.com/docs/manual/reference/command/listCollections/ * @template-extends IteratorIterator> */ -class CollectionInfoCommandIterator extends IteratorIterator implements CollectionInfoIterator +final class CollectionInfoCommandIterator extends IteratorIterator implements CollectionInfoIterator { /** @param Traversable $iterator */ public function __construct(Traversable $iterator, private ?string $databaseName = null) diff --git a/src/Model/DatabaseInfoLegacyIterator.php b/src/Model/DatabaseInfoLegacyIterator.php index da657acec..07aacd6a3 100644 --- a/src/Model/DatabaseInfoLegacyIterator.php +++ b/src/Model/DatabaseInfoLegacyIterator.php @@ -32,7 +32,7 @@ * @see \MongoDB\Client::listDatabases() * @see https://mongodb.com/docs/manual/reference/command/listDatabases/ */ -class DatabaseInfoLegacyIterator implements DatabaseInfoIterator +final class DatabaseInfoLegacyIterator implements DatabaseInfoIterator { public function __construct(private array $databases) { diff --git a/src/Model/IndexInfoIteratorIterator.php b/src/Model/IndexInfoIteratorIterator.php index a2fa85d6f..871a6ba4b 100644 --- a/src/Model/IndexInfoIteratorIterator.php +++ b/src/Model/IndexInfoIteratorIterator.php @@ -36,7 +36,7 @@ * @see https://mongodb.com/docs/manual/reference/system-collections/ * @template-extends IteratorIterator> */ -class IndexInfoIteratorIterator extends IteratorIterator implements IndexInfoIterator +final class IndexInfoIteratorIterator extends IteratorIterator implements IndexInfoIterator { /** @param Traversable $iterator */ public function __construct(Traversable $iterator, private ?string $ns = null) diff --git a/src/Model/IndexInput.php b/src/Model/IndexInput.php index 657c2b6da..133451eeb 100644 --- a/src/Model/IndexInput.php +++ b/src/Model/IndexInput.php @@ -38,7 +38,7 @@ * @see https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.rst * @see https://mongodb.com/docs/manual/reference/method/db.collection.createIndex/ */ -class IndexInput implements Serializable +final class IndexInput implements Serializable { /** * @param array $index Index specification diff --git a/src/Model/SearchIndexInput.php b/src/Model/SearchIndexInput.php index bad880a7f..b27f4f3be 100644 --- a/src/Model/SearchIndexInput.php +++ b/src/Model/SearchIndexInput.php @@ -34,7 +34,7 @@ * @see https://github.com/mongodb/specifications/blob/master/source/index-management/index-management.rst#search-indexes * @see https://mongodb.com/docs/manual/reference/method/db.collection.createSearchIndex/ */ -class SearchIndexInput implements Serializable +final class SearchIndexInput implements Serializable { /** * @param array{definition: array|object, name?: string, type?: string} $index Search index specification diff --git a/src/Operation/CreateEncryptedCollection.php b/src/Operation/CreateEncryptedCollection.php index a5cde6514..9c7d120d8 100644 --- a/src/Operation/CreateEncryptedCollection.php +++ b/src/Operation/CreateEncryptedCollection.php @@ -48,7 +48,7 @@ * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#create-encrypted-collection-helper * @see https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/manage-collections/ */ -class CreateEncryptedCollection implements Executable +final class CreateEncryptedCollection implements Executable { private const WIRE_VERSION_FOR_QUERYABLE_ENCRYPTION_V2 = 21; diff --git a/src/Operation/Delete.php b/src/Operation/Delete.php index 477cade91..09e39a922 100644 --- a/src/Operation/Delete.php +++ b/src/Operation/Delete.php @@ -42,7 +42,7 @@ * @internal * @see https://mongodb.com/docs/manual/reference/command/delete/ */ -class Delete implements Executable, Explainable +final class Delete implements Executable, Explainable { private const WIRE_VERSION_FOR_HINT = 9; diff --git a/src/Operation/DropEncryptedCollection.php b/src/Operation/DropEncryptedCollection.php index 491a8e9eb..1d90f89f4 100644 --- a/src/Operation/DropEncryptedCollection.php +++ b/src/Operation/DropEncryptedCollection.php @@ -37,7 +37,7 @@ * @see https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#drop-collection-helper * @see https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/manage-collections/ */ -class DropEncryptedCollection implements Executable +final class DropEncryptedCollection implements Executable { private DropCollection $dropCollection; diff --git a/src/Operation/FindAndModify.php b/src/Operation/FindAndModify.php index e67413b6c..07abfe80e 100644 --- a/src/Operation/FindAndModify.php +++ b/src/Operation/FindAndModify.php @@ -51,7 +51,7 @@ * @internal * @see https://mongodb.com/docs/manual/reference/command/findAndModify/ */ -class FindAndModify implements Executable, Explainable +final class FindAndModify implements Executable, Explainable { private const WIRE_VERSION_FOR_HINT = 9; diff --git a/src/Operation/Update.php b/src/Operation/Update.php index 0b47b1cc1..1eb0bc9da 100644 --- a/src/Operation/Update.php +++ b/src/Operation/Update.php @@ -45,7 +45,7 @@ * @internal * @see https://mongodb.com/docs/manual/reference/command/update/ */ -class Update implements Executable, Explainable +final class Update implements Executable, Explainable { private const WIRE_VERSION_FOR_HINT = 8; diff --git a/src/Operation/WithTransaction.php b/src/Operation/WithTransaction.php index f0b5b0ec7..760825946 100644 --- a/src/Operation/WithTransaction.php +++ b/src/Operation/WithTransaction.php @@ -11,7 +11,7 @@ use function time; /** @internal */ -class WithTransaction +final class WithTransaction { /** @var callable */ private $callback; From ed33e0bdc1dab006ab920eaea77bb079732c9a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Mon, 16 Sep 2024 09:52:33 +0200 Subject: [PATCH 2/3] Make all Operation classes final --- src/Operation/Aggregate.php | 2 +- src/Operation/BulkWrite.php | 2 +- src/Operation/Count.php | 2 +- src/Operation/CountDocuments.php | 2 +- src/Operation/CreateCollection.php | 2 +- src/Operation/CreateIndexes.php | 2 +- src/Operation/CreateSearchIndexes.php | 2 +- src/Operation/DatabaseCommand.php | 2 +- src/Operation/DeleteMany.php | 2 +- src/Operation/DeleteOne.php | 2 +- src/Operation/Distinct.php | 2 +- src/Operation/DropCollection.php | 2 +- src/Operation/DropDatabase.php | 2 +- src/Operation/DropIndexes.php | 2 +- src/Operation/DropSearchIndex.php | 2 +- src/Operation/EstimatedDocumentCount.php | 2 +- src/Operation/Explain.php | 2 +- src/Operation/Find.php | 2 +- src/Operation/FindOne.php | 2 +- src/Operation/FindOneAndDelete.php | 2 +- src/Operation/FindOneAndReplace.php | 2 +- src/Operation/FindOneAndUpdate.php | 2 +- src/Operation/InsertMany.php | 2 +- src/Operation/InsertOne.php | 2 +- src/Operation/ListCollectionNames.php | 2 +- src/Operation/ListCollections.php | 2 +- src/Operation/ListDatabaseNames.php | 2 +- src/Operation/ListDatabases.php | 2 +- src/Operation/ListIndexes.php | 2 +- src/Operation/ListSearchIndexes.php | 2 +- src/Operation/MapReduce.php | 2 +- src/Operation/ModifyCollection.php | 2 +- src/Operation/RenameCollection.php | 2 +- src/Operation/ReplaceOne.php | 2 +- src/Operation/UpdateMany.php | 2 +- src/Operation/UpdateOne.php | 2 +- src/Operation/UpdateSearchIndex.php | 2 +- src/Operation/Watch.php | 2 +- 38 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/Operation/Aggregate.php b/src/Operation/Aggregate.php index 00d408c18..495d741a9 100644 --- a/src/Operation/Aggregate.php +++ b/src/Operation/Aggregate.php @@ -49,7 +49,7 @@ * @see \MongoDB\Collection::aggregate() * @see https://mongodb.com/docs/manual/reference/command/aggregate/ */ -class Aggregate implements Executable, Explainable +final class Aggregate implements Executable, Explainable { private bool $isWrite; diff --git a/src/Operation/BulkWrite.php b/src/Operation/BulkWrite.php index 6da8a68b3..d9eb43376 100644 --- a/src/Operation/BulkWrite.php +++ b/src/Operation/BulkWrite.php @@ -46,7 +46,7 @@ * * @see \MongoDB\Collection::bulkWrite() */ -class BulkWrite implements Executable +final class BulkWrite implements Executable { public const DELETE_MANY = 'deleteMany'; public const DELETE_ONE = 'deleteOne'; diff --git a/src/Operation/Count.php b/src/Operation/Count.php index b29aa826a..6a42a5c15 100644 --- a/src/Operation/Count.php +++ b/src/Operation/Count.php @@ -41,7 +41,7 @@ * @see \MongoDB\Collection::count() * @see https://mongodb.com/docs/manual/reference/command/count/ */ -class Count implements Executable, Explainable +final class Count implements Executable, Explainable { /** * Constructs a count command. diff --git a/src/Operation/CountDocuments.php b/src/Operation/CountDocuments.php index 5d6502fca..449399a5a 100644 --- a/src/Operation/CountDocuments.php +++ b/src/Operation/CountDocuments.php @@ -37,7 +37,7 @@ * @see \MongoDB\Collection::countDocuments() * @see https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#countdocuments */ -class CountDocuments implements Executable +final class CountDocuments implements Executable { private array $aggregateOptions; diff --git a/src/Operation/CreateCollection.php b/src/Operation/CreateCollection.php index 3292e6fa7..e5406315e 100644 --- a/src/Operation/CreateCollection.php +++ b/src/Operation/CreateCollection.php @@ -41,7 +41,7 @@ * @see \MongoDB\Database::createCollection() * @see https://mongodb.com/docs/manual/reference/command/create/ */ -class CreateCollection implements Executable +final class CreateCollection implements Executable { public const USE_POWER_OF_2_SIZES = 1; public const NO_PADDING = 2; diff --git a/src/Operation/CreateIndexes.php b/src/Operation/CreateIndexes.php index 396cc8163..637e99cbd 100644 --- a/src/Operation/CreateIndexes.php +++ b/src/Operation/CreateIndexes.php @@ -41,7 +41,7 @@ * @see \MongoDB\Collection::createIndexes() * @see https://mongodb.com/docs/manual/reference/command/createIndexes/ */ -class CreateIndexes implements Executable +final class CreateIndexes implements Executable { private const WIRE_VERSION_FOR_COMMIT_QUORUM = 9; diff --git a/src/Operation/CreateSearchIndexes.php b/src/Operation/CreateSearchIndexes.php index fd27b043c..b96ca0f41 100644 --- a/src/Operation/CreateSearchIndexes.php +++ b/src/Operation/CreateSearchIndexes.php @@ -37,7 +37,7 @@ * @see \MongoDB\Collection::createSearchIndexes() * @see https://mongodb.com/docs/manual/reference/command/createSearchIndexes/ */ -class CreateSearchIndexes implements Executable +final class CreateSearchIndexes implements Executable { private array $indexes = []; diff --git a/src/Operation/DatabaseCommand.php b/src/Operation/DatabaseCommand.php index 4ae8214f1..bf02a6430 100644 --- a/src/Operation/DatabaseCommand.php +++ b/src/Operation/DatabaseCommand.php @@ -32,7 +32,7 @@ * * @see \MongoDB\Database::command() */ -class DatabaseCommand implements Executable +final class DatabaseCommand implements Executable { private Command $command; diff --git a/src/Operation/DeleteMany.php b/src/Operation/DeleteMany.php index 20ca38d1d..2d85727a8 100644 --- a/src/Operation/DeleteMany.php +++ b/src/Operation/DeleteMany.php @@ -29,7 +29,7 @@ * @see \MongoDB\Collection::deleteOne() * @see https://mongodb.com/docs/manual/reference/command/delete/ */ -class DeleteMany implements Executable, Explainable +final class DeleteMany implements Executable, Explainable { private Delete $delete; diff --git a/src/Operation/DeleteOne.php b/src/Operation/DeleteOne.php index 1aaad5d27..c9460a916 100644 --- a/src/Operation/DeleteOne.php +++ b/src/Operation/DeleteOne.php @@ -29,7 +29,7 @@ * @see \MongoDB\Collection::deleteOne() * @see https://mongodb.com/docs/manual/reference/command/delete/ */ -class DeleteOne implements Executable, Explainable +final class DeleteOne implements Executable, Explainable { private Delete $delete; diff --git a/src/Operation/Distinct.php b/src/Operation/Distinct.php index 1483012f3..e69adabac 100644 --- a/src/Operation/Distinct.php +++ b/src/Operation/Distinct.php @@ -40,7 +40,7 @@ * @see \MongoDB\Collection::distinct() * @see https://mongodb.com/docs/manual/reference/command/distinct/ */ -class Distinct implements Executable, Explainable +final class Distinct implements Executable, Explainable { /** * Constructs a distinct command. diff --git a/src/Operation/DropCollection.php b/src/Operation/DropCollection.php index a467a7391..3384bd998 100644 --- a/src/Operation/DropCollection.php +++ b/src/Operation/DropCollection.php @@ -36,7 +36,7 @@ * @see \MongoDB\Database::dropCollection() * @see https://mongodb.com/docs/manual/reference/command/drop/ */ -class DropCollection implements Executable +final class DropCollection implements Executable { private const ERROR_CODE_NAMESPACE_NOT_FOUND = 26; diff --git a/src/Operation/DropDatabase.php b/src/Operation/DropDatabase.php index 15cb0c34e..cb1563612 100644 --- a/src/Operation/DropDatabase.php +++ b/src/Operation/DropDatabase.php @@ -34,7 +34,7 @@ * @see \MongoDB\Database::drop() * @see https://mongodb.com/docs/manual/reference/command/dropDatabase/ */ -class DropDatabase implements Executable +final class DropDatabase implements Executable { /** * Constructs a dropDatabase command. diff --git a/src/Operation/DropIndexes.php b/src/Operation/DropIndexes.php index c5302e250..69cc8ce4c 100644 --- a/src/Operation/DropIndexes.php +++ b/src/Operation/DropIndexes.php @@ -35,7 +35,7 @@ * @see \MongoDB\Collection::dropIndexes() * @see https://mongodb.com/docs/manual/reference/command/dropIndexes/ */ -class DropIndexes implements Executable +final class DropIndexes implements Executable { /** * Constructs a dropIndexes command. diff --git a/src/Operation/DropSearchIndex.php b/src/Operation/DropSearchIndex.php index 42fc58baa..73b9c6e17 100644 --- a/src/Operation/DropSearchIndex.php +++ b/src/Operation/DropSearchIndex.php @@ -30,7 +30,7 @@ * @see \MongoDB\Collection::dropSearchIndexes() * @see https://mongodb.com/docs/manual/reference/command/dropSearchIndexes/ */ -class DropSearchIndex implements Executable +final class DropSearchIndex implements Executable { private const ERROR_CODE_NAMESPACE_NOT_FOUND = 26; diff --git a/src/Operation/EstimatedDocumentCount.php b/src/Operation/EstimatedDocumentCount.php index e3c240c78..3a6ce256b 100644 --- a/src/Operation/EstimatedDocumentCount.php +++ b/src/Operation/EstimatedDocumentCount.php @@ -35,7 +35,7 @@ * @see \MongoDB\Collection::estimatedDocumentCount() * @see https://mongodb.com/docs/manual/reference/command/count/ */ -class EstimatedDocumentCount implements Executable, Explainable +final class EstimatedDocumentCount implements Executable, Explainable { private array $options; diff --git a/src/Operation/Explain.php b/src/Operation/Explain.php index 1c132b2f5..a6e14303f 100644 --- a/src/Operation/Explain.php +++ b/src/Operation/Explain.php @@ -35,7 +35,7 @@ * @see \MongoDB\Collection::explain() * @see https://mongodb.com/docs/manual/reference/command/explain/ */ -class Explain implements Executable +final class Explain implements Executable { public const VERBOSITY_ALL_PLANS = 'allPlansExecution'; public const VERBOSITY_EXEC_STATS = 'executionStats'; diff --git a/src/Operation/Find.php b/src/Operation/Find.php index 13944a682..f391faea5 100644 --- a/src/Operation/Find.php +++ b/src/Operation/Find.php @@ -48,7 +48,7 @@ * @see https://mongodb.com/docs/manual/tutorial/query-documents/ * @see https://mongodb.com/docs/manual/reference/operator/query-modifier/ */ -class Find implements Executable, Explainable +final class Find implements Executable, Explainable { public const NON_TAILABLE = 1; public const TAILABLE = 2; diff --git a/src/Operation/FindOne.php b/src/Operation/FindOne.php index 6fdff0a29..0670d97c6 100644 --- a/src/Operation/FindOne.php +++ b/src/Operation/FindOne.php @@ -31,7 +31,7 @@ * @see https://mongodb.com/docs/manual/tutorial/query-documents/ * @see https://mongodb.com/docs/manual/reference/operator/query-modifier/ */ -class FindOne implements Executable, Explainable +final class FindOne implements Executable, Explainable { private Find $find; diff --git a/src/Operation/FindOneAndDelete.php b/src/Operation/FindOneAndDelete.php index ae5148872..68be63e23 100644 --- a/src/Operation/FindOneAndDelete.php +++ b/src/Operation/FindOneAndDelete.php @@ -30,7 +30,7 @@ * @see \MongoDB\Collection::findOneAndDelete() * @see https://mongodb.com/docs/manual/reference/command/findAndModify/ */ -class FindOneAndDelete implements Executable, Explainable +final class FindOneAndDelete implements Executable, Explainable { private FindAndModify $findAndModify; diff --git a/src/Operation/FindOneAndReplace.php b/src/Operation/FindOneAndReplace.php index 6f4409406..21a34fc77 100644 --- a/src/Operation/FindOneAndReplace.php +++ b/src/Operation/FindOneAndReplace.php @@ -35,7 +35,7 @@ * @see \MongoDB\Collection::findOneAndReplace() * @see https://mongodb.com/docs/manual/reference/command/findAndModify/ */ -class FindOneAndReplace implements Executable, Explainable +final class FindOneAndReplace implements Executable, Explainable { public const RETURN_DOCUMENT_BEFORE = 1; public const RETURN_DOCUMENT_AFTER = 2; diff --git a/src/Operation/FindOneAndUpdate.php b/src/Operation/FindOneAndUpdate.php index 0fbe127d0..f44cc4421 100644 --- a/src/Operation/FindOneAndUpdate.php +++ b/src/Operation/FindOneAndUpdate.php @@ -34,7 +34,7 @@ * @see \MongoDB\Collection::findOneAndUpdate() * @see https://mongodb.com/docs/manual/reference/command/findAndModify/ */ -class FindOneAndUpdate implements Executable, Explainable +final class FindOneAndUpdate implements Executable, Explainable { public const RETURN_DOCUMENT_BEFORE = 1; public const RETURN_DOCUMENT_AFTER = 2; diff --git a/src/Operation/InsertMany.php b/src/Operation/InsertMany.php index 01640da2f..8f99fc771 100644 --- a/src/Operation/InsertMany.php +++ b/src/Operation/InsertMany.php @@ -38,7 +38,7 @@ * @see \MongoDB\Collection::insertMany() * @see https://mongodb.com/docs/manual/reference/command/insert/ */ -class InsertMany implements Executable +final class InsertMany implements Executable { /** @var list */ private array $documents; diff --git a/src/Operation/InsertOne.php b/src/Operation/InsertOne.php index 8626364f8..95d49c129 100644 --- a/src/Operation/InsertOne.php +++ b/src/Operation/InsertOne.php @@ -36,7 +36,7 @@ * @see \MongoDB\Collection::insertOne() * @see https://mongodb.com/docs/manual/reference/command/insert/ */ -class InsertOne implements Executable +final class InsertOne implements Executable { private array|object $document; diff --git a/src/Operation/ListCollectionNames.php b/src/Operation/ListCollectionNames.php index f2124c4d4..fefa464af 100644 --- a/src/Operation/ListCollectionNames.php +++ b/src/Operation/ListCollectionNames.php @@ -30,7 +30,7 @@ * @see \MongoDB\Database::listCollectionNames() * @see https://mongodb.com/docs/manual/reference/command/listCollections/ */ -class ListCollectionNames implements Executable +final class ListCollectionNames implements Executable { private ListCollectionsCommand $listCollections; diff --git a/src/Operation/ListCollections.php b/src/Operation/ListCollections.php index 340c11017..bc76d8a58 100644 --- a/src/Operation/ListCollections.php +++ b/src/Operation/ListCollections.php @@ -30,7 +30,7 @@ * @see \MongoDB\Database::listCollections() * @see https://mongodb.com/docs/manual/reference/command/listCollections/ */ -class ListCollections implements Executable +final class ListCollections implements Executable { private ListCollectionsCommand $listCollections; diff --git a/src/Operation/ListDatabaseNames.php b/src/Operation/ListDatabaseNames.php index 7b6a529b4..0c6ee5437 100644 --- a/src/Operation/ListDatabaseNames.php +++ b/src/Operation/ListDatabaseNames.php @@ -33,7 +33,7 @@ * @see \MongoDB\Client::listDatabaseNames() * @see https://mongodb.com/docs/manual/reference/command/listDatabases/#mongodb-dbcommand-dbcmd.listDatabases */ -class ListDatabaseNames implements Executable +final class ListDatabaseNames implements Executable { private ListDatabasesCommand $listDatabases; diff --git a/src/Operation/ListDatabases.php b/src/Operation/ListDatabases.php index ee90cca65..b5e505d23 100644 --- a/src/Operation/ListDatabases.php +++ b/src/Operation/ListDatabases.php @@ -31,7 +31,7 @@ * @see \MongoDB\Client::listDatabases() * @see https://mongodb.com/docs/manual/reference/command/listDatabases/#mongodb-dbcommand-dbcmd.listDatabases` */ -class ListDatabases implements Executable +final class ListDatabases implements Executable { private ListDatabasesCommand $listDatabases; diff --git a/src/Operation/ListIndexes.php b/src/Operation/ListIndexes.php index 384a5f498..350731697 100644 --- a/src/Operation/ListIndexes.php +++ b/src/Operation/ListIndexes.php @@ -36,7 +36,7 @@ * @see \MongoDB\Collection::listIndexes() * @see https://mongodb.com/docs/manual/reference/command/listIndexes/ */ -class ListIndexes implements Executable +final class ListIndexes implements Executable { private const ERROR_CODE_DATABASE_NOT_FOUND = 60; private const ERROR_CODE_NAMESPACE_NOT_FOUND = 26; diff --git a/src/Operation/ListSearchIndexes.php b/src/Operation/ListSearchIndexes.php index 2dbb3688b..8a3850968 100644 --- a/src/Operation/ListSearchIndexes.php +++ b/src/Operation/ListSearchIndexes.php @@ -35,7 +35,7 @@ * @see \MongoDB\Collection::listSearchIndexes() * @see https://mongodb.com/docs/manual/reference/command/listSearchIndexes/ */ -class ListSearchIndexes implements Executable +final class ListSearchIndexes implements Executable { private array $listSearchIndexesOptions; private array $aggregateOptions; diff --git a/src/Operation/MapReduce.php b/src/Operation/MapReduce.php index faf91019c..dcb1be4c6 100644 --- a/src/Operation/MapReduce.php +++ b/src/Operation/MapReduce.php @@ -54,7 +54,7 @@ * @see https://mongodb.com/docs/manual/reference/command/mapReduce/ * @psalm-import-type MapReduceCallable from MapReduceResult */ -class MapReduce implements Executable +final class MapReduce implements Executable { private array|object|string $out; diff --git a/src/Operation/ModifyCollection.php b/src/Operation/ModifyCollection.php index 53eaa9e09..dd707cd2d 100644 --- a/src/Operation/ModifyCollection.php +++ b/src/Operation/ModifyCollection.php @@ -33,7 +33,7 @@ * @see \MongoDB\Database::modifyCollection() * @see https://mongodb.com/docs/manual/reference/command/collMod/ */ -class ModifyCollection implements Executable +final class ModifyCollection implements Executable { /** * Constructs a collMod command. diff --git a/src/Operation/RenameCollection.php b/src/Operation/RenameCollection.php index 5b69cce41..d90c9815b 100644 --- a/src/Operation/RenameCollection.php +++ b/src/Operation/RenameCollection.php @@ -36,7 +36,7 @@ * @see \MongoDB\Database::renameCollection() * @see https://mongodb.com/docs/manual/reference/command/renameCollection/ */ -class RenameCollection implements Executable +final class RenameCollection implements Executable { private string $fromNamespace; diff --git a/src/Operation/ReplaceOne.php b/src/Operation/ReplaceOne.php index 32bf5a06d..47277e058 100644 --- a/src/Operation/ReplaceOne.php +++ b/src/Operation/ReplaceOne.php @@ -34,7 +34,7 @@ * @see \MongoDB\Collection::replaceOne() * @see https://mongodb.com/docs/manual/reference/command/update/ */ -class ReplaceOne implements Executable +final class ReplaceOne implements Executable { private Update $update; diff --git a/src/Operation/UpdateMany.php b/src/Operation/UpdateMany.php index e61731622..a0f204837 100644 --- a/src/Operation/UpdateMany.php +++ b/src/Operation/UpdateMany.php @@ -32,7 +32,7 @@ * @see \MongoDB\Collection::updateMany() * @see https://mongodb.com/docs/manual/reference/command/update/ */ -class UpdateMany implements Executable, Explainable +final class UpdateMany implements Executable, Explainable { private Update $update; diff --git a/src/Operation/UpdateOne.php b/src/Operation/UpdateOne.php index 40d71addf..ac0f20720 100644 --- a/src/Operation/UpdateOne.php +++ b/src/Operation/UpdateOne.php @@ -32,7 +32,7 @@ * @see \MongoDB\Collection::updateOne() * @see https://mongodb.com/docs/manual/reference/command/update/ */ -class UpdateOne implements Executable, Explainable +final class UpdateOne implements Executable, Explainable { private Update $update; diff --git a/src/Operation/UpdateSearchIndex.php b/src/Operation/UpdateSearchIndex.php index 31d86ca8e..9aff80662 100644 --- a/src/Operation/UpdateSearchIndex.php +++ b/src/Operation/UpdateSearchIndex.php @@ -31,7 +31,7 @@ * @see \MongoDB\Collection::updateSearchIndexes() * @see https://mongodb.com/docs/manual/reference/command/updateSearchIndexes/ */ -class UpdateSearchIndex implements Executable +final class UpdateSearchIndex implements Executable { private object $definition; diff --git a/src/Operation/Watch.php b/src/Operation/Watch.php index 09f8b659b..5880b1b2a 100644 --- a/src/Operation/Watch.php +++ b/src/Operation/Watch.php @@ -57,7 +57,7 @@ * @see \MongoDB\Collection::watch() * @see https://mongodb.com/docs/manual/changeStreams/ */ -class Watch implements Executable, /* @internal */ CommandSubscriber +final class Watch implements Executable, /* @internal */ CommandSubscriber { public const FULL_DOCUMENT_DEFAULT = 'default'; public const FULL_DOCUMENT_UPDATE_LOOKUP = 'updateLookup'; From d4f5f59d92c5b23d8c3674e0497d83762076abc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Mon, 16 Sep 2024 10:05:27 +0200 Subject: [PATCH 3/3] Add UPGRADE-2.0 --- UPGRADE-2.0.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 UPGRADE-2.0.md diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md new file mode 100644 index 000000000..2fa5969ee --- /dev/null +++ b/UPGRADE-2.0.md @@ -0,0 +1,4 @@ +UPGRADE FROM 1.x to 2.0 +======================== + + * Classes in the namespace `MongoDB\Operation\` are `final`.