Add type hints to all class properties

parent 27892777
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
<!-- Exclude sniffs that require newer PHP versions --> <!-- Exclude sniffs that require newer PHP versions -->
<!-- Available with PHP 7.0 --> <!-- Available with PHP 7.0 -->
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes" /> <exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes" />
<!-- In addition to requiring PHP 7.0, this sniff will cause a significant amount of BC breaks. Proceed with caution! -->
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration" />
<exclude name="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly" /> <exclude name="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly" />
<exclude name="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" /> <exclude name="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator" />
...@@ -61,7 +59,6 @@ ...@@ -61,7 +59,6 @@
<!-- These sniffs cause a large diff, so enable them in separate steps --> <!-- These sniffs cause a large diff, so enable them in separate steps -->
<exclude name="SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectAnnotationsGroup" /> <exclude name="SlevomatCodingStandard.Commenting.DocCommentSpacing.IncorrectAnnotationsGroup" />
<exclude name="SlevomatCodingStandard.Commenting.RequireOneLinePropertyDocComment" />
<exclude name="Squiz.Strings.DoubleQuoteUsage" /> <exclude name="Squiz.Strings.DoubleQuoteUsage" />
<!-- Sniff currently breaks, see https://github.com/slevomat/coding-standard/issues/727 --> <!-- Sniff currently breaks, see https://github.com/slevomat/coding-standard/issues/727 -->
...@@ -90,6 +87,24 @@ ...@@ -90,6 +87,24 @@
</properties> </properties>
</rule> </rule>
<!-- Only enable some checks regarding type hints -->
<!-- In addition to requiring PHP 7.0, this sniff will cause a significant amount of BC breaks. Proceed with caution! -->
<rule ref="SlevomatCodingStandard.TypeHints.TypeHintDeclaration">
<!-- Traversable type hints often end up as mixed[], so we skip them for now -->
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingTraversablePropertyTypeHintSpecification" />
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingTraversableParameterTypeHintSpecification" />
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingTraversableReturnTypeHintSpecification" />
<!-- Will cause BC breaks to method signatures - disabled for now -->
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint" />
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint" />
<properties>
<property name="enableObjectTypeHint" value="true" />
<property name="enableEachParameterAndReturnInspection" value="false" />
</properties>
</rule>
<rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"> <rule ref="PSR1.Methods.CamelCapsMethodName.NotCamelCaps">
<exclude-pattern>/src/GridFS/StreamWrapper</exclude-pattern> <exclude-pattern>/src/GridFS/StreamWrapper</exclude-pattern>
<exclude-pattern>/tests/DocumentationExamplesTest.php</exclude-pattern> <exclude-pattern>/tests/DocumentationExamplesTest.php</exclude-pattern>
......
...@@ -25,8 +25,13 @@ use MongoDB\Exception\BadMethodCallException; ...@@ -25,8 +25,13 @@ use MongoDB\Exception\BadMethodCallException;
*/ */
class BulkWriteResult class BulkWriteResult
{ {
/** @var WriteResult */
private $writeResult; private $writeResult;
/** @var mixed[] */
private $insertedIds; private $insertedIds;
/** @var boolean */
private $isAcknowledged; private $isAcknowledged;
/** /**
......
...@@ -42,19 +42,27 @@ class ChangeStream implements Iterator ...@@ -42,19 +42,27 @@ class ChangeStream implements Iterator
*/ */
const CURSOR_NOT_FOUND = 43; const CURSOR_NOT_FOUND = 43;
/** @var array */
private static $nonResumableErrorCodes = [ private static $nonResumableErrorCodes = [
136, // CappedPositionLost 136, // CappedPositionLost
237, // CursorKilled 237, // CursorKilled
11601, // Interrupted 11601, // Interrupted
]; ];
/** @var callable */
private $resumeCallable; private $resumeCallable;
/** @var ChangeStreamIterator */
private $iterator; private $iterator;
/** @var integer */
private $key = 0; private $key = 0;
/** /**
* Whether the change stream has advanced to its first result. This is used * Whether the change stream has advanced to its first result. This is used
* to determine whether $key should be incremented after an iteration event. * to determine whether $key should be incremented after an iteration event.
*
* @var boolean
*/ */
private $hasAdvanced = false; private $hasAdvanced = false;
......
...@@ -37,19 +37,35 @@ use function is_array; ...@@ -37,19 +37,35 @@ use function is_array;
class Client class Client
{ {
/** @var array */
private static $defaultTypeMap = [ private static $defaultTypeMap = [
'array' => BSONArray::class, 'array' => BSONArray::class,
'document' => BSONDocument::class, 'document' => BSONDocument::class,
'root' => BSONDocument::class, 'root' => BSONDocument::class,
]; ];
/** @var integer */
private static $wireVersionForReadConcern = 4; private static $wireVersionForReadConcern = 4;
/** @var integer */
private static $wireVersionForWritableCommandWriteConcern = 5; private static $wireVersionForWritableCommandWriteConcern = 5;
/** @var Manager */
private $manager; private $manager;
/** @var ReadConcern */
private $readConcern; private $readConcern;
/** @var ReadPreference */
private $readPreference; private $readPreference;
/** @var string */
private $uri; private $uri;
/** @var array */
private $typeMap; private $typeMap;
/** @var WriteConcern */
private $writeConcern; private $writeConcern;
/** /**
......
...@@ -66,22 +66,44 @@ use function strlen; ...@@ -66,22 +66,44 @@ use function strlen;
class Collection class Collection
{ {
/** @var array */
private static $defaultTypeMap = [ private static $defaultTypeMap = [
'array' => BSONArray::class, 'array' => BSONArray::class,
'document' => BSONDocument::class, 'document' => BSONDocument::class,
'root' => BSONDocument::class, 'root' => BSONDocument::class,
]; ];
/** @var integer */
private static $wireVersionForFindAndModifyWriteConcern = 4; private static $wireVersionForFindAndModifyWriteConcern = 4;
/** @var integer */
private static $wireVersionForReadConcern = 4; private static $wireVersionForReadConcern = 4;
/** @var integer */
private static $wireVersionForWritableCommandWriteConcern = 5; private static $wireVersionForWritableCommandWriteConcern = 5;
/** @var integer */
private static $wireVersionForReadConcernWithWriteStage = 8; private static $wireVersionForReadConcernWithWriteStage = 8;
/** @var string */
private $collectionName; private $collectionName;
/** @var string */
private $databaseName; private $databaseName;
/** @var Manager */
private $manager; private $manager;
/** @var ReadConcern */
private $readConcern; private $readConcern;
/** @var ReadPreference */
private $readPreference; private $readPreference;
/** @var array */
private $typeMap; private $typeMap;
/** @var WriteConcern */
private $writeConcern; private $writeConcern;
/** /**
......
...@@ -44,20 +44,38 @@ use function strlen; ...@@ -44,20 +44,38 @@ use function strlen;
class Database class Database
{ {
/** @var array */
private static $defaultTypeMap = [ private static $defaultTypeMap = [
'array' => BSONArray::class, 'array' => BSONArray::class,
'document' => BSONDocument::class, 'document' => BSONDocument::class,
'root' => BSONDocument::class, 'root' => BSONDocument::class,
]; ];
/** @var integer */
private static $wireVersionForReadConcern = 4; private static $wireVersionForReadConcern = 4;
/** @var integer */
private static $wireVersionForWritableCommandWriteConcern = 5; private static $wireVersionForWritableCommandWriteConcern = 5;
/** @var integer */
private static $wireVersionForReadConcernWithWriteStage = 8; private static $wireVersionForReadConcernWithWriteStage = 8;
/** @var string */
private $databaseName; private $databaseName;
/** @var Manager */
private $manager; private $manager;
/** @var ReadConcern */
private $readConcern; private $readConcern;
/** @var ReadPreference */
private $readPreference; private $readPreference;
/** @var array */
private $typeMap; private $typeMap;
/** @var WriteConcern */
private $writeConcern; private $writeConcern;
/** /**
......
...@@ -25,12 +25,12 @@ use MongoDB\Exception\BadMethodCallException; ...@@ -25,12 +25,12 @@ use MongoDB\Exception\BadMethodCallException;
*/ */
class DeleteResult class DeleteResult
{ {
/** @var WriteResult */
private $writeResult; private $writeResult;
/** @var boolean */
private $isAcknowledged; private $isAcknowledged;
/**
* @param WriteResult $writeResult
*/
public function __construct(WriteResult $writeResult) public function __construct(WriteResult $writeResult)
{ {
$this->writeResult = $writeResult; $this->writeResult = $writeResult;
......
...@@ -62,24 +62,50 @@ use function urlencode; ...@@ -62,24 +62,50 @@ use function urlencode;
*/ */
class Bucket class Bucket
{ {
/** @var string */
private static $defaultBucketName = 'fs'; private static $defaultBucketName = 'fs';
/** @var integer */
private static $defaultChunkSizeBytes = 261120; private static $defaultChunkSizeBytes = 261120;
/** @var array */
private static $defaultTypeMap = [ private static $defaultTypeMap = [
'array' => BSONArray::class, 'array' => BSONArray::class,
'document' => BSONDocument::class, 'document' => BSONDocument::class,
'root' => BSONDocument::class, 'root' => BSONDocument::class,
]; ];
/** @var string */
private static $streamWrapperProtocol = 'gridfs'; private static $streamWrapperProtocol = 'gridfs';
/** @var CollectionWrapper */
private $collectionWrapper; private $collectionWrapper;
/** @var string */
private $databaseName; private $databaseName;
/** @var Manager */
private $manager; private $manager;
/** @var string */
private $bucketName; private $bucketName;
/** @var boolean */
private $disableMD5; private $disableMD5;
/** @var integer */
private $chunkSizeBytes; private $chunkSizeBytes;
/** @var ReadConcern */
private $readConcern; private $readConcern;
/** @var ReadPreference */
private $readPreference; private $readPreference;
/** @var array */
private $typeMap; private $typeMap;
/** @var WriteConcern */
private $writeConcern; private $writeConcern;
/** /**
......
...@@ -34,10 +34,19 @@ use function sprintf; ...@@ -34,10 +34,19 @@ use function sprintf;
*/ */
class CollectionWrapper class CollectionWrapper
{ {
/** @var string */
private $bucketName; private $bucketName;
/** @var Collection */
private $chunksCollection; private $chunksCollection;
/** @var string */
private $databaseName; private $databaseName;
/** @var boolean */
private $checkedIndexes = false; private $checkedIndexes = false;
/** @var Collection */
private $filesCollection; private $filesCollection;
/** /**
......
...@@ -36,15 +36,34 @@ use function substr; ...@@ -36,15 +36,34 @@ use function substr;
*/ */
class ReadableStream class ReadableStream
{ {
/** @var string|null */
private $buffer; private $buffer;
/** @var integer */
private $bufferOffset = 0; private $bufferOffset = 0;
/** @var integer */
private $chunkSize; private $chunkSize;
/** @var integer */
private $chunkOffset = 0; private $chunkOffset = 0;
/** @var IteratorIterator|null */
private $chunksIterator; private $chunksIterator;
/** @var CollectionWrapper */
private $collectionWrapper; private $collectionWrapper;
/** @var float|integer */
private $expectedLastChunkSize = 0; private $expectedLastChunkSize = 0;
/** @var stdClass */
private $file; private $file;
/** @var integer */
private $length; private $length;
/** @var integer */
private $numChunks = 0; private $numChunks = 0;
/** /**
......
...@@ -45,13 +45,16 @@ use const STREAM_IS_URL; ...@@ -45,13 +45,16 @@ use const STREAM_IS_URL;
*/ */
class StreamWrapper class StreamWrapper
{ {
/** /** @var resource|null Stream context (set by PHP) */
* @var resource|null Stream context (set by PHP)
*/
public $context; public $context;
/** @var string|null */
private $mode; private $mode;
/** @var string|null */
private $protocol; private $protocol;
/** @var ReadableStream|WritableStream|null */
private $stream; private $stream;
/** /**
......
...@@ -44,16 +44,34 @@ use function substr; ...@@ -44,16 +44,34 @@ use function substr;
*/ */
class WritableStream class WritableStream
{ {
/** @var integer */
private static $defaultChunkSizeBytes = 261120; private static $defaultChunkSizeBytes = 261120;
/** @var string */
private $buffer = ''; private $buffer = '';
/** @var integer */
private $chunkOffset = 0; private $chunkOffset = 0;
/** @var integer */
private $chunkSize; private $chunkSize;
/** @var boolean */
private $disableMD5; private $disableMD5;
/** @var CollectionWrapper */
private $collectionWrapper; private $collectionWrapper;
/** @var array */
private $file; private $file;
/** @var resource */
private $hashCtx; private $hashCtx;
/** @var boolean */
private $isClosed = false; private $isClosed = false;
/** @var integer */
private $length = 0; private $length = 0;
/** /**
......
...@@ -25,8 +25,13 @@ use MongoDB\Exception\BadMethodCallException; ...@@ -25,8 +25,13 @@ use MongoDB\Exception\BadMethodCallException;
*/ */
class InsertManyResult class InsertManyResult
{ {
/** @var WriteResult */
private $writeResult; private $writeResult;
/** @var mixed[] */
private $insertedIds; private $insertedIds;
/** @var boolean */
private $isAcknowledged; private $isAcknowledged;
/** /**
......
...@@ -25,8 +25,13 @@ use MongoDB\Exception\BadMethodCallException; ...@@ -25,8 +25,13 @@ use MongoDB\Exception\BadMethodCallException;
*/ */
class InsertOneResult class InsertOneResult
{ {
/** @var WriteResult */
private $writeResult; private $writeResult;
/** @var mixed */
private $insertedId; private $insertedId;
/** @var boolean */
private $isAcknowledged; private $isAcknowledged;
/** /**
......
...@@ -35,9 +35,16 @@ use function call_user_func; ...@@ -35,9 +35,16 @@ use function call_user_func;
*/ */
class MapReduceResult implements IteratorAggregate class MapReduceResult implements IteratorAggregate
{ {
/** @var callable */
private $getIterator; private $getIterator;
/** @var integer */
private $executionTimeMS; private $executionTimeMS;
/** @var array */
private $counts; private $counts;
/** @var array */
private $timing; private $timing;
/** /**
......
...@@ -32,13 +32,25 @@ use function unpack; ...@@ -32,13 +32,25 @@ use function unpack;
*/ */
class BSONIterator implements Iterator class BSONIterator implements Iterator
{ {
/** @var integer */
private static $bsonSize = 4; private static $bsonSize = 4;
/** @var string */
private $buffer; private $buffer;
/** @var integer */
private $bufferLength; private $bufferLength;
/** @var mixed */
private $current; private $current;
/** @var integer */
private $key = 0; private $key = 0;
/** @var integer */
private $position = 0; private $position = 0;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -38,9 +38,16 @@ use function reset; ...@@ -38,9 +38,16 @@ use function reset;
*/ */
class CachingIterator implements Countable, Iterator class CachingIterator implements Countable, Iterator
{ {
/** @var array */
private $items = []; private $items = [];
/** @var Generator */
private $iterator; private $iterator;
/** @var boolean */
private $iteratorAdvanced = false; private $iteratorAdvanced = false;
/** @var boolean */
private $iteratorExhausted = false; private $iteratorExhausted = false;
/** /**
......
...@@ -45,10 +45,19 @@ use function MongoDB\Driver\Monitoring\removeSubscriber; ...@@ -45,10 +45,19 @@ use function MongoDB\Driver\Monitoring\removeSubscriber;
*/ */
class ChangeStreamIterator extends IteratorIterator implements CommandSubscriber class ChangeStreamIterator extends IteratorIterator implements CommandSubscriber
{ {
/** @var integer */
private $batchPosition = 0; private $batchPosition = 0;
/** @var integer */
private $batchSize; private $batchSize;
/** @var boolean */
private $isRewindNop; private $isRewindNop;
/** @var object|null */
private $postBatchResumeToken; private $postBatchResumeToken;
/** @var array|object|null */
private $resumeToken; private $resumeToken;
/** /**
......
...@@ -34,6 +34,7 @@ use function array_key_exists; ...@@ -34,6 +34,7 @@ use function array_key_exists;
*/ */
class CollectionInfo implements ArrayAccess class CollectionInfo implements ArrayAccess
{ {
/** @var array */
private $info; private $info;
/** /**
......
...@@ -33,6 +33,7 @@ use function array_key_exists; ...@@ -33,6 +33,7 @@ use function array_key_exists;
*/ */
class DatabaseInfo implements ArrayAccess class DatabaseInfo implements ArrayAccess
{ {
/** @var array */
private $info; private $info;
/** /**
......
...@@ -34,6 +34,7 @@ use function reset; ...@@ -34,6 +34,7 @@ use function reset;
*/ */
class DatabaseInfoLegacyIterator implements DatabaseInfoIterator class DatabaseInfoLegacyIterator implements DatabaseInfoIterator
{ {
/** @var array */
private $databases; private $databases;
/** /**
......
...@@ -39,6 +39,7 @@ use function array_search; ...@@ -39,6 +39,7 @@ use function array_search;
*/ */
class IndexInfo implements ArrayAccess class IndexInfo implements ArrayAccess
{ {
/** @var array */
private $info; private $info;
/** /**
......
...@@ -39,6 +39,7 @@ use function sprintf; ...@@ -39,6 +39,7 @@ use function sprintf;
*/ */
class IndexInput implements Serializable class IndexInput implements Serializable
{ {
/** @var array */
private $index; private $index;
/** /**
......
...@@ -50,14 +50,28 @@ use function sprintf; ...@@ -50,14 +50,28 @@ use function sprintf;
*/ */
class Aggregate implements Executable class Aggregate implements Executable
{ {
/** @var integer */
private static $wireVersionForCollation = 5; private static $wireVersionForCollation = 5;
/** @var integer */
private static $wireVersionForDocumentLevelValidation = 4; private static $wireVersionForDocumentLevelValidation = 4;
/** @var integer */
private static $wireVersionForReadConcern = 4; private static $wireVersionForReadConcern = 4;
/** @var integer */
private static $wireVersionForWriteConcern = 5; private static $wireVersionForWriteConcern = 5;
/** @var string */
private $databaseName; private $databaseName;
/** @var string|null */
private $collectionName; private $collectionName;
/** @var array */
private $pipeline; private $pipeline;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -51,15 +51,31 @@ class BulkWrite implements Executable ...@@ -51,15 +51,31 @@ class BulkWrite implements Executable
const UPDATE_MANY = 'updateMany'; const UPDATE_MANY = 'updateMany';
const UPDATE_ONE = 'updateOne'; const UPDATE_ONE = 'updateOne';
/** @var integer */
private static $wireVersionForArrayFilters = 6; private static $wireVersionForArrayFilters = 6;
/** @var integer */
private static $wireVersionForCollation = 5; private static $wireVersionForCollation = 5;
/** @var integer */
private static $wireVersionForDocumentLevelValidation = 4; private static $wireVersionForDocumentLevelValidation = 4;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array[] */
private $operations; private $operations;
/** @var array */
private $options; private $options;
/** @var boolean */
private $isArrayFiltersUsed = false; private $isArrayFiltersUsed = false;
/** @var boolean */
private $isCollationUsed = false; private $isCollationUsed = false;
/** /**
......
...@@ -43,12 +43,22 @@ use function MongoDB\server_supports_feature; ...@@ -43,12 +43,22 @@ use function MongoDB\server_supports_feature;
*/ */
class Count implements Executable, Explainable class Count implements Executable, Explainable
{ {
/** @var integer */
private static $wireVersionForCollation = 5; private static $wireVersionForCollation = 5;
/** @var integer */
private static $wireVersionForReadConcern = 4; private static $wireVersionForReadConcern = 4;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array|object */
private $filter; private $filter;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -39,11 +39,22 @@ use function is_object; ...@@ -39,11 +39,22 @@ use function is_object;
*/ */
class CountDocuments implements Executable class CountDocuments implements Executable
{ {
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array|object */
private $filter; private $filter;
/** @var array */
private $aggregateOptions; private $aggregateOptions;
/** @var array */
private $countOptions; private $countOptions;
/** @var Aggregate */
private $aggregate; private $aggregate;
/** /**
......
...@@ -46,11 +46,19 @@ class CreateCollection implements Executable ...@@ -46,11 +46,19 @@ class CreateCollection implements Executable
const USE_POWER_OF_2_SIZES = 1; const USE_POWER_OF_2_SIZES = 1;
const NO_PADDING = 2; const NO_PADDING = 2;
/** @var integer */
private static $wireVersionForCollation = 5; private static $wireVersionForCollation = 5;
/** @var integer */
private static $wireVersionForWriteConcern = 5; private static $wireVersionForWriteConcern = 5;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array */
private $options = []; private $options = [];
/** /**
......
...@@ -41,13 +41,25 @@ use function sprintf; ...@@ -41,13 +41,25 @@ use function sprintf;
*/ */
class CreateIndexes implements Executable class CreateIndexes implements Executable
{ {
/** @var integer */
private static $wireVersionForCollation = 5; private static $wireVersionForCollation = 5;
/** @var integer */
private static $wireVersionForWriteConcern = 5; private static $wireVersionForWriteConcern = 5;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array */
private $indexes = []; private $indexes = [];
/** @var boolean */
private $isCollationUsed = false; private $isCollationUsed = false;
/** @var array */
private $options = []; private $options = [];
/** /**
......
...@@ -34,8 +34,13 @@ use function is_object; ...@@ -34,8 +34,13 @@ use function is_object;
*/ */
class DatabaseCommand implements Executable class DatabaseCommand implements Executable
{ {
/** @var string */
private $databaseName; private $databaseName;
/** @var array|Command|object */
private $command; private $command;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -40,12 +40,22 @@ use function MongoDB\server_supports_feature; ...@@ -40,12 +40,22 @@ use function MongoDB\server_supports_feature;
*/ */
class Delete implements Executable, Explainable class Delete implements Executable, Explainable
{ {
/** @var integer */
private static $wireVersionForCollation = 5; private static $wireVersionForCollation = 5;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array|object */
private $filter; private $filter;
/** @var integer */
private $limit; private $limit;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -32,6 +32,7 @@ use MongoDB\Exception\UnsupportedException; ...@@ -32,6 +32,7 @@ use MongoDB\Exception\UnsupportedException;
*/ */
class DeleteMany implements Executable, Explainable class DeleteMany implements Executable, Explainable
{ {
/** @var Delete */
private $delete; private $delete;
/** /**
......
...@@ -32,6 +32,7 @@ use MongoDB\Exception\UnsupportedException; ...@@ -32,6 +32,7 @@ use MongoDB\Exception\UnsupportedException;
*/ */
class DeleteOne implements Executable, Explainable class DeleteOne implements Executable, Explainable
{ {
/** @var Delete */
private $delete; private $delete;
/** /**
......
...@@ -42,13 +42,25 @@ use function MongoDB\server_supports_feature; ...@@ -42,13 +42,25 @@ use function MongoDB\server_supports_feature;
*/ */
class Distinct implements Executable, Explainable class Distinct implements Executable, Explainable
{ {
/** @var integer */
private static $wireVersionForCollation = 5; private static $wireVersionForCollation = 5;
/** @var integer */
private static $wireVersionForReadConcern = 4; private static $wireVersionForReadConcern = 4;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var string */
private $fieldName; private $fieldName;
/** @var array|object */
private $filter; private $filter;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -38,11 +38,19 @@ use function MongoDB\server_supports_feature; ...@@ -38,11 +38,19 @@ use function MongoDB\server_supports_feature;
*/ */
class DropCollection implements Executable class DropCollection implements Executable
{ {
/** @var string */
private static $errorMessageNamespaceNotFound = 'ns not found'; private static $errorMessageNamespaceNotFound = 'ns not found';
/** @var integer */
private static $wireVersionForWriteConcern = 5; private static $wireVersionForWriteConcern = 5;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -38,9 +38,13 @@ use function MongoDB\server_supports_feature; ...@@ -38,9 +38,13 @@ use function MongoDB\server_supports_feature;
*/ */
class DropDatabase implements Executable class DropDatabase implements Executable
{ {
/** @var integer */
private static $wireVersionForWriteConcern = 5; private static $wireVersionForWriteConcern = 5;
/** @var string */
private $databaseName; private $databaseName;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -38,11 +38,19 @@ use function MongoDB\server_supports_feature; ...@@ -38,11 +38,19 @@ use function MongoDB\server_supports_feature;
*/ */
class DropIndexes implements Executable class DropIndexes implements Executable
{ {
/** @var integer */
private static $wireVersionForWriteConcern = 5; private static $wireVersionForWriteConcern = 5;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var string */
private $indexName; private $indexName;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -33,9 +33,16 @@ use function array_intersect_key; ...@@ -33,9 +33,16 @@ use function array_intersect_key;
*/ */
class EstimatedDocumentCount implements Executable, Explainable class EstimatedDocumentCount implements Executable, Explainable
{ {
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array */
private $options; private $options;
/** @var Count */
private $count; private $count;
/** /**
......
...@@ -41,11 +41,19 @@ class Explain implements Executable ...@@ -41,11 +41,19 @@ class Explain implements Executable
const VERBOSITY_EXEC_STATS = 'executionStats'; const VERBOSITY_EXEC_STATS = 'executionStats';
const VERBOSITY_QUERY = 'queryPlanner'; const VERBOSITY_QUERY = 'queryPlanner';
/** @var integer */
private static $wireVersionForDistinct = 4; private static $wireVersionForDistinct = 4;
/** @var integer */
private static $wireVersionForFindAndModify = 4; private static $wireVersionForFindAndModify = 4;
/** @var string */
private $databaseName; private $databaseName;
/** @var Explainable */
private $explainable; private $explainable;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -49,12 +49,22 @@ class Find implements Executable, Explainable ...@@ -49,12 +49,22 @@ class Find implements Executable, Explainable
const TAILABLE = 2; const TAILABLE = 2;
const TAILABLE_AWAIT = 3; const TAILABLE_AWAIT = 3;
/** @var integer */
private static $wireVersionForCollation = 5; private static $wireVersionForCollation = 5;
/** @var integer */
private static $wireVersionForReadConcern = 4; private static $wireVersionForReadConcern = 4;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array|object */
private $filter; private $filter;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -45,13 +45,25 @@ use function MongoDB\server_supports_feature; ...@@ -45,13 +45,25 @@ use function MongoDB\server_supports_feature;
*/ */
class FindAndModify implements Executable, Explainable class FindAndModify implements Executable, Explainable
{ {
/** @var integer */
private static $wireVersionForArrayFilters = 6; private static $wireVersionForArrayFilters = 6;
/** @var integer */
private static $wireVersionForCollation = 5; private static $wireVersionForCollation = 5;
/** @var integer */
private static $wireVersionForDocumentLevelValidation = 4; private static $wireVersionForDocumentLevelValidation = 4;
/** @var integer */
private static $wireVersionForWriteConcern = 4; private static $wireVersionForWriteConcern = 4;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -33,6 +33,7 @@ use function current; ...@@ -33,6 +33,7 @@ use function current;
*/ */
class FindOne implements Executable, Explainable class FindOne implements Executable, Explainable
{ {
/** @var Find */
private $find; private $find;
/** /**
......
...@@ -33,6 +33,7 @@ use function is_object; ...@@ -33,6 +33,7 @@ use function is_object;
*/ */
class FindOneAndDelete implements Executable, Explainable class FindOneAndDelete implements Executable, Explainable
{ {
/** @var FindAndModify */
private $findAndModify; private $findAndModify;
/** /**
......
...@@ -38,6 +38,7 @@ class FindOneAndReplace implements Executable, Explainable ...@@ -38,6 +38,7 @@ class FindOneAndReplace implements Executable, Explainable
const RETURN_DOCUMENT_BEFORE = 1; const RETURN_DOCUMENT_BEFORE = 1;
const RETURN_DOCUMENT_AFTER = 2; const RETURN_DOCUMENT_AFTER = 2;
/** @var FindAndModify */
private $findAndModify; private $findAndModify;
/** /**
......
...@@ -39,6 +39,7 @@ class FindOneAndUpdate implements Executable, Explainable ...@@ -39,6 +39,7 @@ class FindOneAndUpdate implements Executable, Explainable
const RETURN_DOCUMENT_BEFORE = 1; const RETURN_DOCUMENT_BEFORE = 1;
const RETURN_DOCUMENT_AFTER = 2; const RETURN_DOCUMENT_AFTER = 2;
/** @var FindAndModify */
private $findAndModify; private $findAndModify;
/** /**
......
...@@ -40,11 +40,19 @@ use function sprintf; ...@@ -40,11 +40,19 @@ use function sprintf;
*/ */
class InsertMany implements Executable class InsertMany implements Executable
{ {
/** @var integer */
private static $wireVersionForDocumentLevelValidation = 4; private static $wireVersionForDocumentLevelValidation = 4;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var object[]|array[] */
private $documents; private $documents;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -39,11 +39,19 @@ use function MongoDB\server_supports_feature; ...@@ -39,11 +39,19 @@ use function MongoDB\server_supports_feature;
*/ */
class InsertOne implements Executable class InsertOne implements Executable
{ {
/** @var integer */
private static $wireVersionForDocumentLevelValidation = 4; private static $wireVersionForDocumentLevelValidation = 4;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array|object */
private $document; private $document;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -38,7 +38,10 @@ use function is_object; ...@@ -38,7 +38,10 @@ use function is_object;
*/ */
class ListCollections implements Executable class ListCollections implements Executable
{ {
/** @var string */
private $databaseName; private $databaseName;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -39,6 +39,7 @@ use function is_object; ...@@ -39,6 +39,7 @@ use function is_object;
*/ */
class ListDatabases implements Executable class ListDatabases implements Executable
{ {
/** @var array */
private $options; private $options;
/** /**
......
...@@ -37,11 +37,19 @@ use function is_integer; ...@@ -37,11 +37,19 @@ use function is_integer;
*/ */
class ListIndexes implements Executable class ListIndexes implements Executable
{ {
/** @var integer */
private static $errorCodeDatabaseNotFound = 60; private static $errorCodeDatabaseNotFound = 60;
/** @var integer */
private static $errorCodeNamespaceNotFound = 26; private static $errorCodeNamespaceNotFound = 26;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -50,16 +50,34 @@ use function MongoDB\server_supports_feature; ...@@ -50,16 +50,34 @@ use function MongoDB\server_supports_feature;
*/ */
class MapReduce implements Executable class MapReduce implements Executable
{ {
/** @var integer */
private static $wireVersionForCollation = 5; private static $wireVersionForCollation = 5;
/** @var integer */
private static $wireVersionForDocumentLevelValidation = 4; private static $wireVersionForDocumentLevelValidation = 4;
/** @var integer */
private static $wireVersionForReadConcern = 4; private static $wireVersionForReadConcern = 4;
/** @var integer */
private static $wireVersionForWriteConcern = 4; private static $wireVersionForWriteConcern = 4;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var JavascriptInterface */
private $map; private $map;
/** @var JavascriptInterface */
private $reduce; private $reduce;
/** @var array|object|string */
private $out; private $out;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -37,9 +37,16 @@ use function MongoDB\server_supports_feature; ...@@ -37,9 +37,16 @@ use function MongoDB\server_supports_feature;
*/ */
class ModifyCollection implements Executable class ModifyCollection implements Executable
{ {
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array */
private $collectionOptions; private $collectionOptions;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -36,6 +36,7 @@ use function MongoDB\is_pipeline; ...@@ -36,6 +36,7 @@ use function MongoDB\is_pipeline;
*/ */
class ReplaceOne implements Executable class ReplaceOne implements Executable
{ {
/** @var Update */
private $update; private $update;
/** /**
......
...@@ -43,14 +43,28 @@ use function MongoDB\server_supports_feature; ...@@ -43,14 +43,28 @@ use function MongoDB\server_supports_feature;
*/ */
class Update implements Executable, Explainable class Update implements Executable, Explainable
{ {
/** @var integer */
private static $wireVersionForArrayFilters = 6; private static $wireVersionForArrayFilters = 6;
/** @var integer */
private static $wireVersionForCollation = 5; private static $wireVersionForCollation = 5;
/** @var integer */
private static $wireVersionForDocumentLevelValidation = 4; private static $wireVersionForDocumentLevelValidation = 4;
/** @var string */
private $databaseName; private $databaseName;
/** @var string */
private $collectionName; private $collectionName;
/** @var array|object */
private $filter; private $filter;
/** @var array|object */
private $update; private $update;
/** @var array */
private $options; private $options;
/** /**
......
...@@ -36,6 +36,7 @@ use function MongoDB\is_pipeline; ...@@ -36,6 +36,7 @@ use function MongoDB\is_pipeline;
*/ */
class UpdateMany implements Executable, Explainable class UpdateMany implements Executable, Explainable
{ {
/** @var Update */
private $update; private $update;
/** /**
......
...@@ -36,6 +36,7 @@ use function MongoDB\is_pipeline; ...@@ -36,6 +36,7 @@ use function MongoDB\is_pipeline;
*/ */
class UpdateOne implements Executable, Explainable class UpdateOne implements Executable, Explainable
{ {
/** @var Update */
private $update; private $update;
/** /**
......
...@@ -54,21 +54,43 @@ use function MongoDB\server_supports_feature; ...@@ -54,21 +54,43 @@ use function MongoDB\server_supports_feature;
*/ */
class Watch implements Executable, /* @internal */ CommandSubscriber class Watch implements Executable, /* @internal */ CommandSubscriber
{ {
private static $wireVersionForStartAtOperationTime = 7;
const FULL_DOCUMENT_DEFAULT = 'default'; const FULL_DOCUMENT_DEFAULT = 'default';
const FULL_DOCUMENT_UPDATE_LOOKUP = 'updateLookup'; const FULL_DOCUMENT_UPDATE_LOOKUP = 'updateLookup';
/** @var integer */
private static $wireVersionForStartAtOperationTime = 7;
/** @var Aggregate */
private $aggregate; private $aggregate;
/** @var array */
private $aggregateOptions; private $aggregateOptions;
/** @var array */
private $changeStreamOptions; private $changeStreamOptions;
/** @var string|null */
private $collectionName; private $collectionName;
/** @var string */
private $databaseName; private $databaseName;
/** @var integer|null */
private $firstBatchSize; private $firstBatchSize;
/** @var boolean */
private $hasResumed = false; private $hasResumed = false;
/** @var Manager */
private $manager; private $manager;
/** @var TimestampInterface */
private $operationTime; private $operationTime;
/** @var array */
private $pipeline; private $pipeline;
/** @var object|null */
private $postBatchResumeToken; private $postBatchResumeToken;
/** /**
......
...@@ -25,12 +25,12 @@ use MongoDB\Exception\BadMethodCallException; ...@@ -25,12 +25,12 @@ use MongoDB\Exception\BadMethodCallException;
*/ */
class UpdateResult class UpdateResult
{ {
/** @var WriteResult */
private $writeResult; private $writeResult;
/** @var boolean */
private $isAcknowledged; private $isAcknowledged;
/**
* @param WriteResult $writeResult
*/
public function __construct(WriteResult $writeResult) public function __construct(WriteResult $writeResult)
{ {
$this->writeResult = $writeResult; $this->writeResult = $writeResult;
......
...@@ -21,6 +21,7 @@ class ClientFunctionalTest extends FunctionalTestCase ...@@ -21,6 +21,7 @@ class ClientFunctionalTest extends FunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Client */
private $client; private $client;
private function doSetUp() private function doSetUp()
......
...@@ -37,6 +37,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase ...@@ -37,6 +37,7 @@ class CrudSpecFunctionalTest extends FunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Collection */
private $expectedCollection; private $expectedCollection;
private function doSetUp() private function doSetUp()
......
...@@ -13,6 +13,7 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase ...@@ -13,6 +13,7 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Collection */
protected $collection; protected $collection;
private function doSetUp() private function doSetUp()
......
...@@ -16,6 +16,7 @@ use function MongoDB\Driver\Monitoring\removeSubscriber; ...@@ -16,6 +16,7 @@ use function MongoDB\Driver\Monitoring\removeSubscriber;
*/ */
class CommandObserver implements CommandSubscriber class CommandObserver implements CommandSubscriber
{ {
/** @var array */
private $commands = []; private $commands = [];
public function observe(callable $execution, callable $commandCallback) public function observe(callable $execution, callable $commandCallback)
......
...@@ -13,6 +13,7 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase ...@@ -13,6 +13,7 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Database */
protected $database; protected $database;
private function doSetUp() private function doSetUp()
......
...@@ -34,8 +34,10 @@ abstract class FunctionalTestCase extends TestCase ...@@ -34,8 +34,10 @@ abstract class FunctionalTestCase extends TestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Manager */
protected $manager; protected $manager;
/** @var array */
private $configuredFailPoints = []; private $configuredFailPoints = [];
private function doSetUp() private function doSetUp()
......
...@@ -19,8 +19,13 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase ...@@ -19,8 +19,13 @@ abstract class FunctionalTestCase extends BaseFunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Bucket */
protected $bucket; protected $bucket;
/** @var Collection */
protected $chunksCollection; protected $chunksCollection;
/** @var Collection */
protected $filesCollection; protected $filesCollection;
private function doSetUp() private function doSetUp()
......
...@@ -18,6 +18,7 @@ class ReadableStreamFunctionalTest extends FunctionalTestCase ...@@ -18,6 +18,7 @@ class ReadableStreamFunctionalTest extends FunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var CollectionWrapper */
private $collectionWrapper; private $collectionWrapper;
private function doSetUp() private function doSetUp()
......
...@@ -38,7 +38,10 @@ class SpecFunctionalTest extends FunctionalTestCase ...@@ -38,7 +38,10 @@ class SpecFunctionalTest extends FunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Collection */
private $expectedChunksCollection; private $expectedChunksCollection;
/** @var Collection */
private $expectedFilesCollection; private $expectedFilesCollection;
private function doSetUp() private function doSetUp()
......
...@@ -15,6 +15,7 @@ class WritableStreamFunctionalTest extends FunctionalTestCase ...@@ -15,6 +15,7 @@ class WritableStreamFunctionalTest extends FunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var CollectionWrapper */
private $collectionWrapper; private $collectionWrapper;
private function doSetUp() private function doSetUp()
......
...@@ -19,6 +19,7 @@ class ChangeStreamIteratorTest extends FunctionalTestCase ...@@ -19,6 +19,7 @@ class ChangeStreamIteratorTest extends FunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Collection */
private $collection; private $collection;
private function doSetUp() private function doSetUp()
......
...@@ -11,6 +11,7 @@ class IndexInfoFunctionalTest extends FunctionalTestCase ...@@ -11,6 +11,7 @@ class IndexInfoFunctionalTest extends FunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Collection */
private $collection; private $collection;
private function doSetUp() private function doSetUp()
......
...@@ -19,6 +19,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase ...@@ -19,6 +19,7 @@ class BulkWriteFunctionalTest extends FunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Collection */
private $collection; private $collection;
private function doSetUp() private function doSetUp()
......
...@@ -16,6 +16,7 @@ class DeleteFunctionalTest extends FunctionalTestCase ...@@ -16,6 +16,7 @@ class DeleteFunctionalTest extends FunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Collection */
private $collection; private $collection;
private function doSetUp() private function doSetUp()
......
...@@ -17,6 +17,7 @@ class InsertManyFunctionalTest extends FunctionalTestCase ...@@ -17,6 +17,7 @@ class InsertManyFunctionalTest extends FunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Collection */
private $collection; private $collection;
private function doSetUp() private function doSetUp()
......
...@@ -17,6 +17,7 @@ class InsertOneFunctionalTest extends FunctionalTestCase ...@@ -17,6 +17,7 @@ class InsertOneFunctionalTest extends FunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Collection */
private $collection; private $collection;
private function doSetUp() private function doSetUp()
......
...@@ -17,6 +17,7 @@ class UpdateFunctionalTest extends FunctionalTestCase ...@@ -17,6 +17,7 @@ class UpdateFunctionalTest extends FunctionalTestCase
{ {
use SetUpTearDownTrait; use SetUpTearDownTrait;
/** @var Collection */
private $collection; private $collection;
private function doSetUp() private function doSetUp()
......
...@@ -36,8 +36,10 @@ class WatchFunctionalTest extends FunctionalTestCase ...@@ -36,8 +36,10 @@ class WatchFunctionalTest extends FunctionalTestCase
const INTERRUPTED = 11601; const INTERRUPTED = 11601;
const NOT_MASTER = 10107; const NOT_MASTER = 10107;
/** @var integer */
private static $wireVersionForStartAtOperationTime = 7; private static $wireVersionForStartAtOperationTime = 7;
/** @var array */
private $defaultOptions = ['maxAwaitTimeMS' => 500]; private $defaultOptions = ['maxAwaitTimeMS' => 500];
private function doSetUp() private function doSetUp()
......
...@@ -21,6 +21,7 @@ use function glob; ...@@ -21,6 +21,7 @@ use function glob;
*/ */
class ChangeStreamsSpecTest extends FunctionalTestCase class ChangeStreamsSpecTest extends FunctionalTestCase
{ {
/** @var array */
private static $incompleteTests = ['change-streams-errors: Change Stream should error when _id is projected out' => 'PHPC-1419']; private static $incompleteTests = ['change-streams-errors: Change Stream should error when _id is projected out' => 'PHPC-1419'];
/** /**
......
...@@ -19,11 +19,22 @@ use function MongoDB\Driver\Monitoring\removeSubscriber; ...@@ -19,11 +19,22 @@ use function MongoDB\Driver\Monitoring\removeSubscriber;
*/ */
class CommandExpectations implements CommandSubscriber class CommandExpectations implements CommandSubscriber
{ {
/** @var array */
private $actualEvents = []; private $actualEvents = [];
/** @var array */
private $expectedEvents = []; private $expectedEvents = [];
/** @var boolean */
private $ignoreCommandFailed = false; private $ignoreCommandFailed = false;
/** @var boolean */
private $ignoreCommandStarted = false; private $ignoreCommandStarted = false;
/** @var boolean */
private $ignoreCommandSucceeded = false; private $ignoreCommandSucceeded = false;
/** @var boolean */
private $ignoreExtraEvents = false; private $ignoreExtraEvents = false;
private function __construct(array $events) private function __construct(array $events)
......
...@@ -6,6 +6,7 @@ use LogicException; ...@@ -6,6 +6,7 @@ use LogicException;
use MongoDB\Client; use MongoDB\Client;
use MongoDB\Driver\ReadConcern; use MongoDB\Driver\ReadConcern;
use MongoDB\Driver\ReadPreference; use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\Session;
use MongoDB\Driver\WriteConcern; use MongoDB\Driver\WriteConcern;
use stdClass; use stdClass;
use function array_diff_key; use function array_diff_key;
...@@ -21,18 +22,43 @@ use function mt_rand; ...@@ -21,18 +22,43 @@ use function mt_rand;
*/ */
final class Context final class Context
{ {
/** @var string|null */
public $bucketName; public $bucketName;
/** @var Client|null */
public $client; public $client;
/** @var string */
public $collectionName; public $collectionName;
/** @var string */
public $databaseName; public $databaseName;
/** @var array */
public $defaultWriteOptions = []; public $defaultWriteOptions = [];
/** @var array */
public $outcomeFindOptions = []; public $outcomeFindOptions = [];
/** @var string */
public $outcomeCollectionName; public $outcomeCollectionName;
/** @var Session|null */
public $session0; public $session0;
/** @var object */
public $session0Lsid; public $session0Lsid;
/** @var Session|null */
public $session1; public $session1;
/** @var object */
public $session1Lsid; public $session1Lsid;
/**
* @param string $databaseName
* @param string $collectionName
*/
private function __construct($databaseName, $collectionName) private function __construct($databaseName, $collectionName)
{ {
$this->databaseName = $databaseName; $this->databaseName = $databaseName;
......
...@@ -29,15 +29,27 @@ class DocumentsMatchConstraint extends Constraint ...@@ -29,15 +29,27 @@ class DocumentsMatchConstraint extends Constraint
{ {
use ConstraintTrait; use ConstraintTrait;
/** @var boolean */
private $ignoreExtraKeysInRoot = false; private $ignoreExtraKeysInRoot = false;
/** @var boolean */
private $ignoreExtraKeysInEmbedded = false; private $ignoreExtraKeysInEmbedded = false;
/** @var array */
private $placeholders = []; private $placeholders = [];
/* TODO: This is not currently used, but was preserved from the design of
/**
* TODO: This is not currently used, but was preserved from the design of
* TestCase::assertMatchesDocument(), which would sort keys and then compare * TestCase::assertMatchesDocument(), which would sort keys and then compare
* documents as JSON strings. If the TODO item in matches() is implemented * documents as JSON strings. If the TODO item in matches() is implemented
* to make document comparisons more efficient, we may consider supporting * to make document comparisons more efficient, we may consider supporting
* this option. */ * this option.
*
* @var boolean
*/
private $sortKeys = false; private $sortKeys = false;
/** @var BSONArray|BSONDocument */
private $value; private $value;
/** @var ComparisonFailure|null */ /** @var ComparisonFailure|null */
......
...@@ -21,6 +21,8 @@ final class ErrorExpectation ...@@ -21,6 +21,8 @@ final class ErrorExpectation
{ {
/** /**
* @see https://github.com/mongodb/mongo/blob/master/src/mongo/base/error_codes.err * @see https://github.com/mongodb/mongo/blob/master/src/mongo/base/error_codes.err
*
* @var array
*/ */
private static $codeNameMap = [ private static $codeNameMap = [
'Interrupted' => 11601, 'Interrupted' => 11601,
...@@ -29,11 +31,22 @@ final class ErrorExpectation ...@@ -29,11 +31,22 @@ final class ErrorExpectation
'OperationNotSupportedInTransaction' => 263, 'OperationNotSupportedInTransaction' => 263,
]; ];
/** @var integer */
private $code; private $code;
/** @var string */
private $codeName; private $codeName;
/** @var boolean */
private $isExpected = false; private $isExpected = false;
/** @var string[] */
private $excludedLabels = []; private $excludedLabels = [];
/** @var string[] */
private $includedLabels = []; private $includedLabels = [];
/** @var string */
private $messageContains; private $messageContains;
private function __construct() private function __construct()
......
...@@ -33,6 +33,7 @@ class FunctionalTestCase extends BaseFunctionalTestCase ...@@ -33,6 +33,7 @@ class FunctionalTestCase extends BaseFunctionalTestCase
const TOPOLOGY_REPLICASET = 'replicaset'; const TOPOLOGY_REPLICASET = 'replicaset';
const TOPOLOGY_SHARDED = 'sharded'; const TOPOLOGY_SHARDED = 'sharded';
/** @var Context|null */
private $context; private $context;
private function doSetUp() private function doSetUp()
......
...@@ -37,14 +37,28 @@ final class Operation ...@@ -37,14 +37,28 @@ final class Operation
const OBJECT_SESSION0 = 'session0'; const OBJECT_SESSION0 = 'session0';
const OBJECT_SESSION1 = 'session1'; const OBJECT_SESSION1 = 'session1';
/** @var ErrorExpectation|null */
public $errorExpectation; public $errorExpectation;
/** @var ResultExpectation|null */
public $resultExpectation; public $resultExpectation;
/** @var array */
private $arguments = []; private $arguments = [];
/** @var string|null */
private $collectionName; private $collectionName;
/** @var array */
private $collectionOptions = []; private $collectionOptions = [];
/** @var string|null */
private $databaseName; private $databaseName;
/** @var string */
private $name; private $name;
/** @var string */
private $object = self::OBJECT_COLLECTION; private $object = self::OBJECT_COLLECTION;
private function __construct(stdClass $operation) private function __construct(stdClass $operation)
......
...@@ -35,10 +35,19 @@ final class ResultExpectation ...@@ -35,10 +35,19 @@ final class ResultExpectation
const ASSERT_NULL = 10; const ASSERT_NULL = 10;
const ASSERT_CALLABLE = 11; const ASSERT_CALLABLE = 11;
/** @var integer */
private $assertionType = self::ASSERT_NOTHING; private $assertionType = self::ASSERT_NOTHING;
/** @var mixed */
private $expectedValue; private $expectedValue;
/** @var callable */
private $assertionCallable; private $assertionCallable;
/**
* @param integer $assertionType
* @param mixed $expectedValue
*/
private function __construct($assertionType, $expectedValue) private function __construct($assertionType, $expectedValue)
{ {
switch ($assertionType) { switch ($assertionType) {
......
...@@ -16,6 +16,7 @@ use function strpos; ...@@ -16,6 +16,7 @@ use function strpos;
*/ */
class RetryableReadsSpecTest extends FunctionalTestCase class RetryableReadsSpecTest extends FunctionalTestCase
{ {
/** @var array */
private static $skippedOperations = [ private static $skippedOperations = [
'listCollectionNames' => 'Not implemented', 'listCollectionNames' => 'Not implemented',
'listCollectionObjects' => 'Not implemented', 'listCollectionObjects' => 'Not implemented',
......
...@@ -27,8 +27,12 @@ class TransactionsSpecTest extends FunctionalTestCase ...@@ -27,8 +27,12 @@ class TransactionsSpecTest extends FunctionalTestCase
const INTERRUPTED = 11601; const INTERRUPTED = 11601;
/* In addition to the useMultipleMongoses tests, these should all pass /**
* before the driver can be considered compatible with MongoDB 4.2. */ * In addition to the useMultipleMongoses tests, these should all pass
* before the driver can be considered compatible with MongoDB 4.2.
*
* @var array
*/
private static $incompleteTests = [ private static $incompleteTests = [
'error-labels: add unknown commit label to MaxTimeMSExpired' => 'PHPC-1382', 'error-labels: add unknown commit label to MaxTimeMSExpired' => 'PHPC-1382',
'error-labels: add unknown commit label to writeConcernError MaxTimeMSExpired' => 'PHPC-1382', 'error-labels: add unknown commit label to writeConcernError MaxTimeMSExpired' => 'PHPC-1382',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment