@@ -102,7 +102,7 @@ |
||
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | - * @return array |
|
| 105 | + * @return string[] |
|
| 106 | 106 | */ |
| 107 | 107 | public function __sleep() |
| 108 | 108 | { |
@@ -21,7 +21,6 @@ |
||
| 21 | 21 | use Alcaeus\MongoDbAdapter\TypeConverter; |
| 22 | 22 | use Alcaeus\MongoDbAdapter\ExceptionConverter; |
| 23 | 23 | use MongoDB\Driver\Cursor; |
| 24 | -use MongoDB\Driver\ReadPreference; |
|
| 25 | 24 | use MongoDB\Operation\Find; |
| 26 | 25 | |
| 27 | 26 | /** |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | public function hasNext() |
| 244 | 244 | { |
| 245 | - if (! $this->startedIterating) { |
|
| 245 | + if ( ! $this->startedIterating) { |
|
| 246 | 246 | $this->ensureIterator(); |
| 247 | 247 | $this->startedIterating = true; |
| 248 | 248 | $this->storeIteratorState(); |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | */ |
| 427 | 427 | protected function convertCursorType() |
| 428 | 428 | { |
| 429 | - if (! $this->tailable) { |
|
| 429 | + if ( ! $this->tailable) { |
|
| 430 | 430 | return null; |
| 431 | 431 | } |
| 432 | 432 | |
@@ -1018,6 +1018,9 @@ discard block |
||
| 1018 | 1018 | return null; |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | + /** |
|
| 1022 | + * @param string $name |
|
| 1023 | + */ |
|
| 1021 | 1024 | private function checkCollectionName($name) |
| 1022 | 1025 | { |
| 1023 | 1026 | if (empty($name)) { |
@@ -1028,7 +1031,7 @@ discard block |
||
| 1028 | 1031 | } |
| 1029 | 1032 | |
| 1030 | 1033 | /** |
| 1031 | - * @return array |
|
| 1034 | + * @return string[] |
|
| 1032 | 1035 | */ |
| 1033 | 1036 | public function __sleep() |
| 1034 | 1037 | { |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | foreach ($operators as $operator) { |
| 140 | 140 | $i++; |
| 141 | 141 | if (! is_array($operator)) { |
| 142 | - trigger_error("Argument $i is not an array", E_USER_WARNING); |
|
| 142 | + trigger_error("argument $i is not an array", E_USER_WARNING); |
|
| 143 | 143 | return; |
| 144 | 144 | } |
| 145 | 145 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | public function aggregate(array $pipeline, array $op = []) |
| 133 | 133 | { |
| 134 | - if (! TypeConverter::isNumericArray($pipeline)) { |
|
| 134 | + if ( ! TypeConverter::isNumericArray($pipeline)) { |
|
| 135 | 135 | $operators = func_get_args(); |
| 136 | 136 | $pipeline = []; |
| 137 | 137 | $options = []; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $i = 0; |
| 140 | 140 | foreach ($operators as $operator) { |
| 141 | 141 | $i++; |
| 142 | - if (! is_array($operator)) { |
|
| 142 | + if ( ! is_array($operator)) { |
|
| 143 | 143 | trigger_error("Argument $i is not an array", E_USER_WARNING); |
| 144 | 144 | return; |
| 145 | 145 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | ]; |
| 193 | 193 | |
| 194 | 194 | // Convert cursor option |
| 195 | - if (! isset($options['cursor'])) { |
|
| 195 | + if ( ! isset($options['cursor'])) { |
|
| 196 | 196 | $options['cursor'] = new \stdClass(); |
| 197 | 197 | } |
| 198 | 198 | |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | throw ExceptionConverter::toLegacy($e); |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - if (! $result->isAcknowledged()) { |
|
| 297 | + if ( ! $result->isAcknowledged()) { |
|
| 298 | 298 | return true; |
| 299 | 299 | } |
| 300 | 300 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | foreach ($a as $key => $item) { |
| 327 | 327 | try { |
| 328 | - if (! $this->ensureDocumentHasMongoId($a[$key])) { |
|
| 328 | + if ( ! $this->ensureDocumentHasMongoId($a[$key])) { |
|
| 329 | 329 | if ($continueOnError) { |
| 330 | 330 | unset($a[$key]); |
| 331 | 331 | } else { |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | } catch (MongoException $e) { |
| 337 | - if (! $continueOnError) { |
|
| 337 | + if ( ! $continueOnError) { |
|
| 338 | 338 | throw $e; |
| 339 | 339 | } |
| 340 | 340 | } |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | throw ExceptionConverter::toLegacy($e, 'MongoResultException'); |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - if (! $result->isAcknowledged()) { |
|
| 352 | + if ( ! $result->isAcknowledged()) { |
|
| 353 | 353 | return true; |
| 354 | 354 | } |
| 355 | 355 | |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | throw ExceptionConverter::toLegacy($e); |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | - if (! $result->isAcknowledged()) { |
|
| 406 | + if ( ! $result->isAcknowledged()) { |
|
| 407 | 407 | return true; |
| 408 | 408 | } |
| 409 | 409 | |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | */ |
| 431 | 431 | public function remove(array $criteria = [], array $options = []) |
| 432 | 432 | { |
| 433 | - $multiple = isset($options['justOne']) ? !$options['justOne'] : true; |
|
| 433 | + $multiple = isset($options['justOne']) ? ! $options['justOne'] : true; |
|
| 434 | 434 | $method = $multiple ? 'deleteMany' : 'deleteOne'; |
| 435 | 435 | |
| 436 | 436 | try { |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | throw ExceptionConverter::toLegacy($e); |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - if (! $result->isAcknowledged()) { |
|
| 446 | + if ( ! $result->isAcknowledged()) { |
|
| 447 | 447 | return true; |
| 448 | 448 | } |
| 449 | 449 | |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | |
| 522 | 522 | $options['projection'] = TypeConverter::convertProjection($fields); |
| 523 | 523 | |
| 524 | - if (! \MongoDB\is_first_key_operator($update)) { |
|
| 524 | + if ( ! \MongoDB\is_first_key_operator($update)) { |
|
| 525 | 525 | $document = $this->collection->findOneAndReplace($query, $update, $options); |
| 526 | 526 | } else { |
| 527 | 527 | $document = $this->collection->findOneAndUpdate($query, $update, $options); |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | public function findOne($query = [], array $fields = [], array $options = []) |
| 553 | 553 | { |
| 554 | 554 | // Can't typehint for array since MongoGridFS extends and accepts strings |
| 555 | - if (! is_array($query)) { |
|
| 555 | + if ( ! is_array($query)) { |
|
| 556 | 556 | trigger_error(sprintf('MongoCollection::findOne(): expects parameter 1 to be an array or object, %s given', gettype($query)), E_USER_WARNING); |
| 557 | 557 | return; |
| 558 | 558 | } |
@@ -592,11 +592,11 @@ discard block |
||
| 592 | 592 | $keys = (array) $keys; |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | - if (! is_array($keys) || ! count($keys)) { |
|
| 595 | + if ( ! is_array($keys) || ! count($keys)) { |
|
| 596 | 596 | throw new MongoException('index specification has no elements'); |
| 597 | 597 | } |
| 598 | 598 | |
| 599 | - if (! isset($options['name'])) { |
|
| 599 | + if ( ! isset($options['name'])) { |
|
| 600 | 600 | $options['name'] = \MongoDB\generate_index_name($keys); |
| 601 | 601 | } |
| 602 | 602 | |
@@ -627,20 +627,20 @@ discard block |
||
| 627 | 627 | |
| 628 | 628 | $this->collection->createIndex($keys, $options); |
| 629 | 629 | } catch (\MongoDB\Driver\Exception\Exception $e) { |
| 630 | - if (! $e instanceof CommandException || strpos($e->getMessage(), 'with a different name') === false) { |
|
| 630 | + if ( ! $e instanceof CommandException || strpos($e->getMessage(), 'with a different name') === false) { |
|
| 631 | 631 | throw ExceptionConverter::toLegacy($e, 'MongoResultException'); |
| 632 | 632 | } |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | $result = [ |
| 636 | - 'createdCollectionAutomatically' => !$collectionExists, |
|
| 636 | + 'createdCollectionAutomatically' => ! $collectionExists, |
|
| 637 | 637 | 'numIndexesBefore' => $indexCount, |
| 638 | 638 | 'numIndexesAfter' => $indexCount, |
| 639 | 639 | 'note' => 'all indexes already exist', |
| 640 | 640 | 'ok' => 1.0, |
| 641 | 641 | ]; |
| 642 | 642 | |
| 643 | - if (! $indexExists) { |
|
| 643 | + if ( ! $indexExists) { |
|
| 644 | 644 | $result['numIndexesAfter']++; |
| 645 | 645 | unset($result['note']); |
| 646 | 646 | } |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | { |
| 674 | 674 | if (is_string($keys)) { |
| 675 | 675 | $indexName = $keys; |
| 676 | - if (! preg_match('#_-?1$#', $indexName)) { |
|
| 676 | + if ( ! preg_match('#_-?1$#', $indexName)) { |
|
| 677 | 677 | $indexName .= '_1'; |
| 678 | 678 | } |
| 679 | 679 | } elseif (is_array($keys)) { |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | */ |
| 713 | 713 | public function getIndexInfo() |
| 714 | 714 | { |
| 715 | - $convertIndex = function (\MongoDB\Model\IndexInfo $indexInfo) { |
|
| 715 | + $convertIndex = function(\MongoDB\Model\IndexInfo $indexInfo) { |
|
| 716 | 716 | $infos = [ |
| 717 | 717 | 'v' => $indexInfo->getVersion(), |
| 718 | 718 | 'key' => $indexInfo->getKey(), |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | ]; |
| 737 | 737 | |
| 738 | 738 | foreach ($additionalKeys as $key) { |
| 739 | - if (! isset($indexInfo[$key])) { |
|
| 739 | + if ( ! isset($indexInfo[$key])) { |
|
| 740 | 740 | continue; |
| 741 | 741 | } |
| 742 | 742 | |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | { |
| 762 | 762 | try { |
| 763 | 763 | // Handle legacy mode - limit and skip as second and third parameters, respectively |
| 764 | - if (! is_array($options)) { |
|
| 764 | + if ( ! is_array($options)) { |
|
| 765 | 765 | $limit = $options; |
| 766 | 766 | $options = []; |
| 767 | 767 | |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | $this->convertWriteConcernOptions($options) |
| 809 | 809 | ); |
| 810 | 810 | |
| 811 | - if (! $result->isAcknowledged()) { |
|
| 811 | + if ( ! $result->isAcknowledged()) { |
|
| 812 | 812 | return true; |
| 813 | 813 | } |
| 814 | 814 | |
@@ -842,13 +842,13 @@ discard block |
||
| 842 | 842 | if ($document_or_id instanceof \MongoId) { |
| 843 | 843 | $id = $document_or_id; |
| 844 | 844 | } elseif (is_object($document_or_id)) { |
| 845 | - if (! isset($document_or_id->_id)) { |
|
| 845 | + if ( ! isset($document_or_id->_id)) { |
|
| 846 | 846 | return null; |
| 847 | 847 | } |
| 848 | 848 | |
| 849 | 849 | $id = $document_or_id->_id; |
| 850 | 850 | } elseif (is_array($document_or_id)) { |
| 851 | - if (! isset($document_or_id['_id'])) { |
|
| 851 | + if ( ! isset($document_or_id['_id'])) { |
|
| 852 | 852 | return null; |
| 853 | 853 | } |
| 854 | 854 | |
@@ -961,11 +961,11 @@ discard block |
||
| 961 | 961 | $options['w'] = ($options['safe']) ? 1 : 0; |
| 962 | 962 | } |
| 963 | 963 | |
| 964 | - if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) { |
|
| 964 | + if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) { |
|
| 965 | 965 | $options['wTimeoutMS'] = $options['wtimeout']; |
| 966 | 966 | } |
| 967 | 967 | |
| 968 | - if (isset($options['w']) || !isset($options['wTimeoutMS'])) { |
|
| 968 | + if (isset($options['w']) || ! isset($options['wTimeoutMS'])) { |
|
| 969 | 969 | $collectionWriteConcern = $this->getWriteConcern(); |
| 970 | 970 | $writeConcern = $this->createWriteConcernFromParameters( |
| 971 | 971 | isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'], |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | private function ensureDocumentHasMongoId(&$document) |
| 1004 | 1004 | { |
| 1005 | 1005 | if (is_array($document) || $document instanceof ArrayObject) { |
| 1006 | - if (! isset($document['_id'])) { |
|
| 1006 | + if ( ! isset($document['_id'])) { |
|
| 1007 | 1007 | $document['_id'] = new \MongoId(); |
| 1008 | 1008 | } |
| 1009 | 1009 | |
@@ -1013,12 +1013,12 @@ discard block |
||
| 1013 | 1013 | } elseif (is_object($document)) { |
| 1014 | 1014 | $reflectionObject = new \ReflectionObject($document); |
| 1015 | 1015 | foreach ($reflectionObject->getProperties() as $property) { |
| 1016 | - if (! $property->isPublic()) { |
|
| 1016 | + if ( ! $property->isPublic()) { |
|
| 1017 | 1017 | throw new \MongoException('zero-length keys are not allowed, did you use $ with double quotes?'); |
| 1018 | 1018 | } |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | - if (! isset($document->_id)) { |
|
| 1021 | + if ( ! isset($document->_id)) { |
|
| 1022 | 1022 | $document->_id = new \MongoId(); |
| 1023 | 1023 | } |
| 1024 | 1024 | |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | |
| 1050 | 1050 | private function mustBeArrayOrObject($a) |
| 1051 | 1051 | { |
| 1052 | - if (!is_array($a) && !is_object($a)) { |
|
| 1052 | + if ( ! is_array($a) && ! is_object($a)) { |
|
| 1053 | 1053 | throw new \MongoException('document must be an array or object'); |
| 1054 | 1054 | } |
| 1055 | 1055 | } |
@@ -121,6 +121,9 @@ |
||
| 121 | 121 | return $handle; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | + /** |
|
| 125 | + * @param resource $handle |
|
| 126 | + */ |
|
| 124 | 127 | private function copyToResource($handle) |
| 125 | 128 | { |
| 126 | 129 | $written = 0; |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | $filename = 'file'; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - if (! $handle = fopen($filename, 'w')) { |
|
| 81 | + if ( ! $handle = fopen($filename, 'w')) { |
|
| 82 | 82 | trigger_error('Can not open the destination file', E_USER_ERROR); |
| 83 | 83 | return 0; |
| 84 | 84 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $wstring = (int) $wstring; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - if (! is_string($wstring) && ! is_int($wstring)) { |
|
| 32 | + if ( ! is_string($wstring) && ! is_int($wstring)) { |
|
| 33 | 33 | trigger_error("w for WriteConcern must be a string or integer", E_USER_WARNING); |
| 34 | 34 | return false; |
| 35 | 35 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * Returns the address being used by this for slaveOkay reads |
| 53 | 53 | * |
| 54 | 54 | * @link http://php.net/manual/en/mongo.getslave.php |
| 55 | - * @return bool The address of the secondary this connection is using for |
|
| 55 | + * @return boolean|null The address of the secondary this connection is using for |
|
| 56 | 56 | * reads. This returns NULL if this is not connected to a replica set or not yet |
| 57 | 57 | * initialized. |
| 58 | 58 | */ |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * Get slaveOkay setting for this connection |
| 66 | 66 | * |
| 67 | 67 | * @link http://php.net/manual/en/mongo.getslaveokay.php |
| 68 | - * @return bool Returns the value of slaveOkay for this instance. |
|
| 68 | + * @return boolean|null Returns the value of slaveOkay for this instance. |
|
| 69 | 69 | */ |
| 70 | 70 | public function getSlaveOkay() |
| 71 | 71 | { |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @link http://www.php.net/manual/en/mongo.pairconnect.php |
| 79 | 79 | * @throws MongoConnectionException |
| 80 | - * @return boolean |
|
| 80 | + * @return boolean|null |
|
| 81 | 81 | * |
| 82 | 82 | * @deprecated Pass a string of the form "mongodb://server1,server2" to the constructor instead of using this method. |
| 83 | 83 | */ |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @link http://php.net/manual/en/mongo.setslaveokay.php |
| 105 | 105 | * @param bool $ok |
| 106 | - * @return bool returns the former value of slaveOkay for this instance. |
|
| 106 | + * @return boolean|null returns the former value of slaveOkay for this instance. |
|
| 107 | 107 | */ |
| 108 | 108 | public function setSlaveOkay($ok) |
| 109 | 109 | { |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * @link http://php.net/manual/en/mongo.setpoolsize.php |
| 117 | 117 | * @param $size <p>The max number of connections future pools will be able to create. Negative numbers mean that the pool will spawn an infinite number of connections.</p> |
| 118 | - * @return bool Returns the former value of pool size. |
|
| 118 | + * @return boolean|null Returns the former value of pool size. |
|
| 119 | 119 | * @deprecated Relying on this feature is highly discouraged. Please use MongoPool::setSize() instead. |
| 120 | 120 | */ |
| 121 | 121 | public function setPoolSize($size) |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * @param string $username A username used to identify the connection. |
| 131 | 131 | * @param string $password A password used to identify the connection. |
| 132 | 132 | * @throws MongoConnectionException |
| 133 | - * @return boolean If the connection was successful. |
|
| 133 | + * @return boolean|null If the connection was successful. |
|
| 134 | 134 | * @deprecated Pass array("persist" => $id) to the constructor instead of using this method. |
| 135 | 135 | */ |
| 136 | 136 | public function persistConnect($username = "", $password = "") |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @param string $username A username used to identify the connection. |
| 146 | 146 | * @param string $password A password used to identify the connection. |
| 147 | 147 | * @throws MongoConnectionException |
| 148 | - * @return boolean If the connection was successful. |
|
| 148 | + * @return boolean|null If the connection was successful. |
|
| 149 | 149 | * @deprecated Pass "mongodb://server1,server2" and array("persist" => $id) to the constructor instead of using this method. |
| 150 | 150 | */ |
| 151 | 151 | public function pairPersistConnect($username = "", $password = "") |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * |
| 159 | 159 | * @link http://www.php.net/manual/en/mongo.connectutil.php |
| 160 | 160 | * @throws MongoConnectionException |
| 161 | - * @return boolean If the connection was successful. |
|
| 161 | + * @return boolean|null If the connection was successful. |
|
| 162 | 162 | */ |
| 163 | 163 | protected function connectUtil() |
| 164 | 164 | { |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * Creates a database error on the database. |
| 218 | 218 | * |
| 219 | 219 | * @link http://www.php.net/manual/en/mongo.forceerror.php |
| 220 | - * @return boolean The database response. |
|
| 220 | + * @return boolean|null The database response. |
|
| 221 | 221 | * @deprecated Use MongoDB::forceError() instead. |
| 222 | 222 | */ |
| 223 | 223 | public function forceError() |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | return false; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if ($readPreference == \MongoClient::RP_PRIMARY && !empty($tags)) { |
|
| 113 | + if ($readPreference == \MongoClient::RP_PRIMARY && ! empty($tags)) { |
|
| 114 | 114 | trigger_error("You can't use read preference tags with a read preference of PRIMARY", E_USER_WARNING); |
| 115 | 115 | return false; |
| 116 | 116 | } |
@@ -103,16 +103,16 @@ |
||
| 103 | 103 | */ |
| 104 | 104 | public static function convertProjection($fields) |
| 105 | 105 | { |
| 106 | - if (! is_array($fields) || $fields === []) { |
|
| 106 | + if ( ! is_array($fields) || $fields === []) { |
|
| 107 | 107 | return null; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if (! TypeConverter::isNumericArray($fields)) { |
|
| 110 | + if ( ! TypeConverter::isNumericArray($fields)) { |
|
| 111 | 111 | $projection = TypeConverter::fromLegacy($fields); |
| 112 | 112 | } else { |
| 113 | 113 | $projection = array_fill_keys( |
| 114 | - array_map(function ($field) { |
|
| 115 | - if (!is_string($field)) { |
|
| 114 | + array_map(function($field) { |
|
| 115 | + if ( ! is_string($field)) { |
|
| 116 | 116 | throw new \MongoException('field names must be strings', 8); |
| 117 | 117 | } |
| 118 | 118 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | * @link http://www.php.net/manual/en/mongoclient.killcursor.php |
| 239 | 239 | * @param string $server_hash The server hash that has the cursor. |
| 240 | 240 | * @param int|MongoInt64 $id The ID of the cursor to kill. |
| 241 | - * @return bool |
|
| 241 | + * @return boolean|null |
|
| 242 | 242 | */ |
| 243 | 243 | public function killCursor($server_hash, $id) |
| 244 | 244 | { |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | /** |
| 353 | - * @return array |
|
| 353 | + * @return string[] |
|
| 354 | 354 | */ |
| 355 | 355 | public function __sleep() |
| 356 | 356 | { |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /** |
| 363 | - * @param $server |
|
| 363 | + * @param string $server |
|
| 364 | 364 | * @return array |
| 365 | 365 | */ |
| 366 | 366 | private function extractUrlOptions($server) |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | final public function execute(array $writeOptions = []) |
| 103 | 103 | { |
| 104 | 104 | $writeOptions += $this->writeOptions; |
| 105 | - if (! count($this->items)) { |
|
| 105 | + if ( ! count($this->items)) { |
|
| 106 | 106 | return ['ok' => true]; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | break; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if (! $ok) { |
|
| 170 | + if ( ! $ok) { |
|
| 171 | 171 | // Exception code is hardcoded to the value in ext-mongo, see |
| 172 | 172 | // https://github.com/mongodb/mongo-php-driver-legacy/blob/ab4bc0d90e93b3f247f6bcb386d0abc8d2fa7d74/batch/write.c#L428 |
| 173 | 173 | throw new \MongoWriteConcernException('Failed write', 911, null, $resultDocument); |
@@ -180,19 +180,19 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | switch ($this->batchType) { |
| 182 | 182 | case self::COMMAND_UPDATE: |
| 183 | - if (! isset($item['q'])) { |
|
| 183 | + if ( ! isset($item['q'])) { |
|
| 184 | 184 | throw new Exception("Expected \$item to contain 'q' key"); |
| 185 | 185 | } |
| 186 | - if (! isset($item['u'])) { |
|
| 186 | + if ( ! isset($item['u'])) { |
|
| 187 | 187 | throw new Exception("Expected \$item to contain 'u' key"); |
| 188 | 188 | } |
| 189 | 189 | break; |
| 190 | 190 | |
| 191 | 191 | case self::COMMAND_DELETE: |
| 192 | - if (! isset($item['q'])) { |
|
| 192 | + if ( ! isset($item['q'])) { |
|
| 193 | 193 | throw new Exception("Expected \$item to contain 'q' key"); |
| 194 | 194 | } |
| 195 | - if (! isset($item['limit'])) { |
|
| 195 | + if ( ! isset($item['limit'])) { |
|
| 196 | 196 | throw new Exception("Expected \$item to contain 'limit' key"); |
| 197 | 197 | } |
| 198 | 198 | break; |