Completed
Pull Request — master (#216)
by
unknown
08:27
created
lib/Mongo/MongoCollection.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1018,6 +1018,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
1028 1031
     }
1029 1032
 
1030 1033
     /**
1031
-     * @return array
1034
+     * @return string[]
1032 1035
      */
1033 1036
     public function __sleep()
1034 1037
     {
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
           'criteria' => 0,
143 143
           'options' => 1,
144 144
           'operation' => 'aggregate'
145
-        ], function () use ($pipeline, $op) {
146
-            if (! TypeConverter::isNumericArray($pipeline)) {
145
+        ], function() use ($pipeline, $op) {
146
+            if ( ! TypeConverter::isNumericArray($pipeline)) {
147 147
                 $operators = func_get_args();
148 148
                 $pipeline = [];
149 149
                 $options = [];
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
                 $i = 0;
152 152
                 foreach ($operators as $operator) {
153 153
                     $i++;
154
-                    if (! is_array($operator)) {
154
+                    if ( ! is_array($operator)) {
155 155
                         trigger_error("Argument $i is not an array", E_USER_WARNING);
156 156
                         return;
157 157
                     }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         ];
206 206
 
207 207
         // Convert cursor option
208
-        if (! isset($options['cursor'])) {
208
+        if ( ! isset($options['cursor'])) {
209 209
             $options['cursor'] = new \stdClass();
210 210
         }
211 211
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      */
292 292
     public function insert(&$a, array $options = [])
293 293
     {
294
-        if (! $this->ensureDocumentHasMongoId($a)) {
294
+        if ( ! $this->ensureDocumentHasMongoId($a)) {
295 295
             trigger_error(sprintf('%s(): expects parameter %d to be an array or object, %s given', __METHOD__, 1, gettype($a)), E_USER_WARNING);
296 296
             return;
297 297
         }
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
             throw ExceptionConverter::toLegacy($e);
308 308
         }
309 309
 
310
-        if (! $result->isAcknowledged()) {
310
+        if ( ! $result->isAcknowledged()) {
311 311
             return true;
312 312
         }
313 313
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 
339 339
         foreach ($a as $key => $item) {
340 340
             try {
341
-                if (! $this->ensureDocumentHasMongoId($a[$key])) {
341
+                if ( ! $this->ensureDocumentHasMongoId($a[$key])) {
342 342
                     if ($continueOnError) {
343 343
                         unset($a[$key]);
344 344
                     } else {
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
                     }
348 348
                 }
349 349
             } catch (MongoException $e) {
350
-                if (! $continueOnError) {
350
+                if ( ! $continueOnError) {
351 351
                     throw $e;
352 352
                 }
353 353
             }
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
             throw ExceptionConverter::toLegacy($e, 'MongoResultException');
363 363
         }
364 364
 
365
-        if (! $result->isAcknowledged()) {
365
+        if ( ! $result->isAcknowledged()) {
366 366
             return true;
367 367
         }
368 368
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
           'criteria' => 0,
394 394
           'options' => 2,
395 395
           'operation' => 'update'
396
-      ], function () use ($criteria, $newobj, $options) {
396
+      ], function() use ($criteria, $newobj, $options) {
397 397
           $this->mustBeArrayOrObject($criteria);
398 398
           $this->mustBeArrayOrObject($newobj);
399 399
 
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
               throw ExceptionConverter::toLegacy($e);
422 422
           }
423 423
 
424
-          if (! $result->isAcknowledged()) {
424
+          if ( ! $result->isAcknowledged()) {
425 425
               return true;
426 426
           }
427 427
 
@@ -453,8 +453,8 @@  discard block
 block discarded – undo
453 453
              'criteria' => 0,
454 454
              'options' => 1,
455 455
              'operation' => 'remove'
456
-         ], function () use ($criteria, $options) {
457
-             $multiple = isset($options['justOne']) ? !$options['justOne'] : true;
456
+         ], function() use ($criteria, $options) {
457
+             $multiple = isset($options['justOne']) ? ! $options['justOne'] : true;
458 458
              $method = $multiple ? 'deleteMany' : 'deleteOne';
459 459
 
460 460
              try {
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
                  throw ExceptionConverter::toLegacy($e);
468 468
              }
469 469
 
470
-             if (! $result->isAcknowledged()) {
470
+             if ( ! $result->isAcknowledged()) {
471 471
                  return true;
472 472
              }
473 473
 
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
           'criteria' => 1,
511 511
           'options' => 0,
512 512
           'operation' => 'distinct'
513
-        ], function () use ($key, $query) {
513
+        ], function() use ($key, $query) {
514 514
             try {
515 515
                 return array_map([TypeConverter::class, 'toLegacy'], $this->collection->distinct($key, TypeConverter::fromLegacy($query)));
516 516
             } catch (\MongoDB\Driver\Exception\Exception $e) {
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
           'criteria' => 0,
536 536
           'options' => 3,
537 537
           'operation' => 'findAndModify'
538
-      ], function () use ($query, $update, $fields, $options) {
538
+      ], function() use ($query, $update, $fields, $options) {
539 539
           $query = TypeConverter::fromLegacy($query);
540 540
           try {
541 541
               if (isset($options['remove'])) {
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
                   $options['projection'] = TypeConverter::convertProjection($fields);
559 559
 
560
-                  if (! \MongoDB\is_first_key_operator($update)) {
560
+                  if ( ! \MongoDB\is_first_key_operator($update)) {
561 561
                       $document = $this->collection->findOneAndReplace($query, $update, $options);
562 562
                   } else {
563 563
                       $document = $this->collection->findOneAndUpdate($query, $update, $options);
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
           'criteria' => 0,
593 593
           'options' => 2,
594 594
           'operation' => 'findOne'
595
-      ], function () use ($query, $fields, $options) {
595
+      ], function() use ($query, $fields, $options) {
596 596
           // Can't typehint for array since MongoGridFS extends and accepts strings
597
-        if (! is_array($query)) {
597
+        if ( ! is_array($query)) {
598 598
             trigger_error(sprintf('MongoCollection::findOne(): expects parameter 1 to be an array or object, %s given', gettype($query)), E_USER_WARNING);
599 599
             return;
600 600
         }
@@ -635,11 +635,11 @@  discard block
 block discarded – undo
635 635
             $keys = (array) $keys;
636 636
         }
637 637
 
638
-        if (! is_array($keys) || ! count($keys)) {
638
+        if ( ! is_array($keys) || ! count($keys)) {
639 639
             throw new MongoException('index specification has no elements');
640 640
         }
641 641
 
642
-        if (! isset($options['name'])) {
642
+        if ( ! isset($options['name'])) {
643 643
             $options['name'] = \MongoDB\generate_index_name($keys);
644 644
         }
645 645
 
@@ -674,14 +674,14 @@  discard block
 block discarded – undo
674 674
         }
675 675
 
676 676
         $result = [
677
-            'createdCollectionAutomatically' => !$collectionExists,
677
+            'createdCollectionAutomatically' => ! $collectionExists,
678 678
             'numIndexesBefore' => $indexCount,
679 679
             'numIndexesAfter' => $indexCount,
680 680
             'note' => 'all indexes already exist',
681 681
             'ok' => 1.0,
682 682
         ];
683 683
 
684
-        if (! $indexExists) {
684
+        if ( ! $indexExists) {
685 685
             $result['numIndexesAfter']++;
686 686
             unset($result['note']);
687 687
         }
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
     {
715 715
         if (is_string($keys)) {
716 716
             $indexName = $keys;
717
-            if (! preg_match('#_-?1$#', $indexName)) {
717
+            if ( ! preg_match('#_-?1$#', $indexName)) {
718 718
                 $indexName .= '_1';
719 719
             }
720 720
         } elseif (is_array($keys)) {
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
      */
754 754
     public function getIndexInfo()
755 755
     {
756
-        $convertIndex = function (\MongoDB\Model\IndexInfo $indexInfo) {
756
+        $convertIndex = function(\MongoDB\Model\IndexInfo $indexInfo) {
757 757
             $infos = [
758 758
                 'v' => $indexInfo->getVersion(),
759 759
                 'key' => $indexInfo->getKey(),
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
             ];
778 778
 
779 779
             foreach ($additionalKeys as $key) {
780
-                if (! isset($indexInfo[$key])) {
780
+                if ( ! isset($indexInfo[$key])) {
781 781
                     continue;
782 782
                 }
783 783
 
@@ -804,10 +804,10 @@  discard block
 block discarded – undo
804 804
           'criteria' => 0,
805 805
           'options' => 1,
806 806
           'operation' => 'count'
807
-        ], function () use ($query, $options) {
807
+        ], function() use ($query, $options) {
808 808
             try {
809 809
                 // Handle legacy mode - limit and skip as second and third parameters, respectively
810
-            if (! is_array($options)) {
810
+            if ( ! is_array($options)) {
811 811
                 $limit = $options;
812 812
                 $options = [];
813 813
 
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
                 $this->convertWriteConcernOptions($options)
856 856
             );
857 857
 
858
-            if (! $result->isAcknowledged()) {
858
+            if ( ! $result->isAcknowledged()) {
859 859
                 return true;
860 860
             }
861 861
 
@@ -889,13 +889,13 @@  discard block
 block discarded – undo
889 889
         if ($document_or_id instanceof \MongoId) {
890 890
             $id = $document_or_id;
891 891
         } elseif (is_object($document_or_id)) {
892
-            if (! isset($document_or_id->_id)) {
892
+            if ( ! isset($document_or_id->_id)) {
893 893
                 return null;
894 894
             }
895 895
 
896 896
             $id = $document_or_id->_id;
897 897
         } elseif (is_array($document_or_id)) {
898
-            if (! isset($document_or_id['_id'])) {
898
+            if ( ! isset($document_or_id['_id'])) {
899 899
                 return null;
900 900
             }
901 901
 
@@ -1008,11 +1008,11 @@  discard block
 block discarded – undo
1008 1008
             $options['w'] = ($options['safe']) ? 1 : 0;
1009 1009
         }
1010 1010
 
1011
-        if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) {
1011
+        if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) {
1012 1012
             $options['wTimeoutMS'] = $options['wtimeout'];
1013 1013
         }
1014 1014
 
1015
-        if (isset($options['w']) || !isset($options['wTimeoutMS'])) {
1015
+        if (isset($options['w']) || ! isset($options['wTimeoutMS'])) {
1016 1016
             $collectionWriteConcern = $this->getWriteConcern();
1017 1017
             $writeConcern = $this->createWriteConcernFromParameters(
1018 1018
                 isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'],
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
     private function ensureDocumentHasMongoId(&$document)
1051 1051
     {
1052 1052
         if (is_array($document)) {
1053
-            if (! isset($document['_id'])) {
1053
+            if ( ! isset($document['_id'])) {
1054 1054
                 $document['_id'] = new \MongoId();
1055 1055
             }
1056 1056
 
@@ -1060,12 +1060,12 @@  discard block
 block discarded – undo
1060 1060
         } elseif (is_object($document)) {
1061 1061
             $reflectionObject = new \ReflectionObject($document);
1062 1062
             foreach ($reflectionObject->getProperties() as $property) {
1063
-                if (! $property->isPublic()) {
1063
+                if ( ! $property->isPublic()) {
1064 1064
                     throw new \MongoException('zero-length keys are not allowed, did you use $ with double quotes?');
1065 1065
                 }
1066 1066
             }
1067 1067
 
1068
-            if (! isset($document->_id)) {
1068
+            if ( ! isset($document->_id)) {
1069 1069
                 $document->_id = new \MongoId();
1070 1070
             }
1071 1071
 
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 
1097 1097
     private function mustBeArrayOrObject($a)
1098 1098
     {
1099
-        if (!is_array($a) && !is_object($a)) {
1099
+        if ( ! is_array($a) && ! is_object($a)) {
1100 1100
             throw new \MongoException('document must be an array or object');
1101 1101
         }
1102 1102
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@
 block discarded – undo
152 152
                 foreach ($operators as $operator) {
153 153
                     $i++;
154 154
                     if (! is_array($operator)) {
155
-                        trigger_error("Argument $i is not an array", E_USER_WARNING);
155
+                        trigger_error("argument $i is not an array", E_USER_WARNING);
156 156
                         return;
157 157
                     }
158 158
 
Please login to merge, or discard this patch.
lib/Mongo/MongoCursor.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,6 @@
 block discarded – undo
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
 /**
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     }
491 491
 
492 492
     /**
493
-     * @return Cursor
493
+     * @return Traversable
494 494
      */
495 495
     protected function ensureCursor()
496 496
     {
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
     }
535 535
 
536 536
     /**
537
-     * @return array
537
+     * @return string[]
538 538
      */
539 539
     public function __sleep()
540 540
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         'options' => array_merge(['foundOnly'=> $foundOnly], $this->options),
144 144
         'operation' => 'count',
145 145
         'name' => $this->collection->getCollectionName()
146
-      ], function () use ($foundOnly) {
146
+      ], function() use ($foundOnly) {
147 147
           $optionNames = ['hint', 'maxTimeMS'];
148 148
           if ($foundOnly) {
149 149
               $optionNames = array_merge($optionNames, ['limit', 'skip']);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
             'options' => $this->options,
174 174
             'operation' => 'count',
175 175
             'name' => $this->collection->getCollectionName()
176
-        ], function () {
176
+        ], function() {
177 177
             // MongoDB\Driver\Cursor needs to be wrapped into a \Generator so that a valid \Iterator with working implementations of
178 178
             // next, current, valid, key and rewind is returned. These methods don't work if we wrap the Cursor inside an \IteratorIterator
179 179
             if ($this->iterator === null) {
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
      */
272 272
     public function hasNext()
273 273
     {
274
-        if (! $this->startedIterating) {
274
+        if ( ! $this->startedIterating) {
275 275
             $this->ensureIterator();
276 276
             $this->startedIterating = true;
277 277
             $this->storeIteratorState();
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
      */
457 457
     protected function convertCursorType()
458 458
     {
459
-        if (! $this->tailable) {
459
+        if ( ! $this->tailable) {
460 460
             return null;
461 461
         }
462 462
 
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
     protected function wrapTraversable(\Traversable $traversable)
511 511
     {
512 512
         foreach ($traversable as $key => $value) {
513
-            if (isset($value->_id) && ($value->_id instanceof \MongoDB\BSON\ObjectID || !is_object($value->_id))) {
513
+            if (isset($value->_id) && ($value->_id instanceof \MongoDB\BSON\ObjectID || ! is_object($value->_id))) {
514 514
                 $key = (string) $value->_id;
515 515
             }
516 516
             yield $key => $value;
Please login to merge, or discard this patch.
lib/Mongo/MongoGridFSFile.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -121,6 +121,9 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
lib/Alcaeus/MongoDbAdapter/Helper/WriteConcernConverter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
lib/Mongo/Mongo.php 1 patch
Doc Comments   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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()
Please login to merge, or discard this patch.
lib/Alcaeus/MongoDbAdapter/Helper/ReadPreference.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
lib/Alcaeus/MongoDbAdapter/TypeConverter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -103,16 +103,16 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
lib/Mongo/MongoClient.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
lib/Mongo/MongoWriteBatch.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.