Completed
Pull Request — master (#167)
by Emir
03:22
created
lib/Mongo/MongoGridFS.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,7 +105,6 @@  discard block
 block discarded – undo
105 105
      * @link http://php.net/manual/en/mongogridfs.find.php
106 106
      * @param array $query The query
107 107
      * @param array $fields Fields to return
108
-     * @param array $options Options for the find command
109 108
      * @return MongoGridFSCursor A MongoGridFSCursor
110 109
      */
111 110
     public function find(array $query = [], array $fields = [])
@@ -446,7 +445,7 @@  discard block
 block discarded – undo
446 445
     }
447 446
 
448 447
     /**
449
-     * @return array
448
+     * @return string[]
450 449
      */
451 450
     public function __sleep()
452 451
     {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function findOne($query = [], array $fields = [], array $options = [])
129 129
     {
130
-        if (! is_array($query)) {
130
+        if ( ! is_array($query)) {
131 131
             $query = ['filename' => (string) $query];
132 132
         }
133 133
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         try {
204 204
             $file = $this->insertFile($record, $options);
205 205
         } catch (MongoException $e) {
206
-            throw new MongoGridFSException('Could not store file: '. $e->getMessage(), 0, $e);
206
+            throw new MongoGridFSException('Could not store file: ' . $e->getMessage(), 0, $e);
207 207
         }
208 208
 
209 209
         try {
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
             ];
241 241
 
242 242
             $handle = fopen($filename, 'r');
243
-            if (! $handle) {
243
+            if ( ! $handle) {
244 244
                 throw new MongoGridFSException('could not open file: ' . $filename);
245 245
             }
246
-        } elseif (! is_resource($filename)) {
246
+        } elseif ( ! is_resource($filename)) {
247 247
             throw new \Exception('first argument must be a string or stream resource');
248 248
         } else {
249 249
             $handle = $filename;
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 
267 267
         // Add length and MD5 if they were not present before
268 268
         $update = [];
269
-        if (! isset($record['length'])) {
269
+        if ( ! isset($record['length'])) {
270 270
             $update['length'] = $length;
271 271
         }
272
-        if (! isset($record['md5'])) {
272
+        if ( ! isset($record['md5'])) {
273 273
             try {
274 274
                 $update['md5'] = $md5;
275 275
             } catch (MongoException $e) {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         if (count($update)) {
281 281
             try {
282 282
                 $result = $this->update(['_id' => $file['_id']], ['$set' => $update]);
283
-                if (! $this->isOKResult($result)) {
283
+                if ( ! $this->isOKResult($result)) {
284 284
                     throw new MongoGridFSException('Could not store file');
285 285
                 }
286 286
             } catch (MongoException $e) {
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
      */
305 305
     public function storeUpload($name, array $metadata = [])
306 306
     {
307
-        if (! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) {
307
+        if ( ! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) {
308 308
             throw new MongoGridFSException("Could not find uploaded file $name");
309 309
         }
310
-        if (! isset($_FILES[$name]['tmp_name'])) {
310
+        if ( ! isset($_FILES[$name]['tmp_name'])) {
311 311
             throw new MongoGridFSException("Couldn't find tmp_name in the \$_FILES array. Are you sure the upload worked?");
312 312
         }
313 313
 
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 
358 358
         $result = $this->chunks->insert($chunk);
359 359
 
360
-        if (! $this->isOKResult($result)) {
360
+        if ( ! $this->isOKResult($result)) {
361 361
             throw new \MongoException('error inserting chunk');
362 362
         }
363 363
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
         $hash = hash_init('md5');
403 403
 
404 404
         rewind($handle);
405
-        while (! feof($handle)) {
405
+        while ( ! feof($handle)) {
406 406
             $data = stream_get_contents($handle, $chunkSize);
407 407
             hash_update($hash, $data);
408 408
             $this->insertChunk($fileId, $data, $i++);
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
         $result = $this->insert($record, $options);
434 434
 
435
-        if (! $this->isOKResult($result)) {
435
+        if ( ! $this->isOKResult($result)) {
436 436
             throw new \MongoException('error inserting file');
437 437
         }
438 438
 
Please login to merge, or discard this patch.
lib/Mongo/MongoCursor.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
     }
103 103
 
104 104
     /**
105
-     * @return array
105
+     * @return string[]
106 106
      */
107 107
     public function __sleep()
108 108
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
      */
222 222
     public function hasNext()
223 223
     {
224
-        if (! $this->startedIterating) {
224
+        if ( ! $this->startedIterating) {
225 225
             $this->ensureIterator();
226 226
             $this->startedIterating = true;
227 227
             $this->storeIteratorState();
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
      */
406 406
     protected function convertCursorType()
407 407
     {
408
-        if (! $this->tailable) {
408
+        if ( ! $this->tailable) {
409 409
             return null;
410 410
         }
411 411
 
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
     protected function wrapTraversable(\Traversable $traversable)
447 447
     {
448 448
         foreach ($traversable as $key => $value) {
449
-            if (isset($value->_id) && ($value->_id instanceof \MongoDB\BSON\ObjectID || !is_object($value->_id))) {
449
+            if (isset($value->_id) && ($value->_id instanceof \MongoDB\BSON\ObjectID || ! is_object($value->_id))) {
450 450
                 $key = (string) $value->_id;
451 451
             }
452 452
             yield $key => $value;
Please login to merge, or discard this patch.
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.
lib/Mongo/MongoWriteBatch.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
     public function add($item)
84 84
     {
85 85
         if (is_object($item)) {
86
-            $item = (array)$item;
86
+            $item = (array) $item;
87 87
         }
88 88
 
89 89
         $this->validate($item);
@@ -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.
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 [];
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/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   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function aggregate(array $pipeline, array $op = [])
132 132
     {
133
-        if (! TypeConverter::isNumericArray($pipeline)) {
133
+        if ( ! TypeConverter::isNumericArray($pipeline)) {
134 134
             $operators = func_get_args();
135 135
             $pipeline = [];
136 136
             $options = [];
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
             $i = 0;
139 139
             foreach ($operators as $operator) {
140 140
                 $i++;
141
-                if (! is_array($operator)) {
141
+                if ( ! is_array($operator)) {
142 142
                     trigger_error("Argument $i is not an array", E_USER_WARNING);
143 143
                     return;
144 144
                 }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         ];
192 192
 
193 193
         // Convert cursor option
194
-        if (! isset($options['cursor'])) {
194
+        if ( ! isset($options['cursor'])) {
195 195
             $options['cursor'] = new \stdClass();
196 196
         }
197 197
 
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
      */
278 278
     public function insert(&$a, array $options = [])
279 279
     {
280
-        if (! $this->ensureDocumentHasMongoId($a)) {
280
+        if ( ! $this->ensureDocumentHasMongoId($a)) {
281 281
             trigger_error(sprintf('%s(): expects parameter %d to be an array or object, %s given', __METHOD__, 1, gettype($a)), E_USER_WARNING);
282 282
             return;
283 283
         }
284 284
 
285
-        if (! count((array)$a)) {
285
+        if ( ! count((array) $a)) {
286 286
             throw new \MongoException('document must be an array or object');
287 287
         }
288 288
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
             throw ExceptionConverter::toLegacy($e);
296 296
         }
297 297
 
298
-        if (! $result->isAcknowledged()) {
298
+        if ( ! $result->isAcknowledged()) {
299 299
             return true;
300 300
         }
301 301
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 
327 327
         foreach ($a as $key => $item) {
328 328
             try {
329
-                if (! $this->ensureDocumentHasMongoId($a[$key])) {
329
+                if ( ! $this->ensureDocumentHasMongoId($a[$key])) {
330 330
                     if ($continueOnError) {
331 331
                         unset($a[$key]);
332 332
                     } else {
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
                     }
336 336
                 }
337 337
             } catch (MongoException $e) {
338
-                if (! $continueOnError) {
338
+                if ( ! $continueOnError) {
339 339
                     throw $e;
340 340
                 }
341 341
             }
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
             throw ExceptionConverter::toLegacy($e, 'MongoResultException');
351 351
         }
352 352
 
353
-        if (! $result->isAcknowledged()) {
353
+        if ( ! $result->isAcknowledged()) {
354 354
             return true;
355 355
         }
356 356
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
             throw ExceptionConverter::toLegacy($e);
399 399
         }
400 400
 
401
-        if (! $result->isAcknowledged()) {
401
+        if ( ! $result->isAcknowledged()) {
402 402
             return true;
403 403
         }
404 404
 
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
      */
426 426
     public function remove(array $criteria = [], array $options = [])
427 427
     {
428
-        $multiple = isset($options['justOne']) ? !$options['justOne'] : true;
428
+        $multiple = isset($options['justOne']) ? ! $options['justOne'] : true;
429 429
         $method = $multiple ? 'deleteMany' : 'deleteOne';
430 430
 
431 431
         try {
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
             throw ExceptionConverter::toLegacy($e);
439 439
         }
440 440
 
441
-        if (! $result->isAcknowledged()) {
441
+        if ( ! $result->isAcknowledged()) {
442 442
             return true;
443 443
         }
444 444
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 
517 517
                 $options['projection'] = TypeConverter::convertProjection($fields);
518 518
 
519
-                if (! \MongoDB\is_first_key_operator($update)) {
519
+                if ( ! \MongoDB\is_first_key_operator($update)) {
520 520
                     $document = $this->collection->findOneAndReplace($query, $update, $options);
521 521
                 } else {
522 522
                     $document = $this->collection->findOneAndUpdate($query, $update, $options);
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
     public function findOne($query = [], array $fields = [], array $options = [])
548 548
     {
549 549
         // Can't typehint for array since MongoGridFS extends and accepts strings
550
-        if (! is_array($query)) {
550
+        if ( ! is_array($query)) {
551 551
             trigger_error(sprintf('MongoCollection::findOne(): expects parameter 1 to be an array or object, %s given', gettype($query)), E_USER_WARNING);
552 552
             return;
553 553
         }
@@ -587,11 +587,11 @@  discard block
 block discarded – undo
587 587
             $keys = (array) $keys;
588 588
         }
589 589
 
590
-        if (! is_array($keys) || ! count($keys)) {
590
+        if ( ! is_array($keys) || ! count($keys)) {
591 591
             throw new MongoException('index specification has no elements');
592 592
         }
593 593
 
594
-        if (! isset($options['name'])) {
594
+        if ( ! isset($options['name'])) {
595 595
             $options['name'] = \MongoDB\generate_index_name($keys);
596 596
         }
597 597
 
@@ -626,14 +626,14 @@  discard block
 block discarded – undo
626 626
         }
627 627
 
628 628
         $result = [
629
-            'createdCollectionAutomatically' => !$collectionExists,
629
+            'createdCollectionAutomatically' => ! $collectionExists,
630 630
             'numIndexesBefore' => $indexCount,
631 631
             'numIndexesAfter' => $indexCount,
632 632
             'note' => 'all indexes already exist',
633 633
             'ok' => 1.0,
634 634
         ];
635 635
 
636
-        if (! $indexExists) {
636
+        if ( ! $indexExists) {
637 637
             $result['numIndexesAfter']++;
638 638
             unset($result['note']);
639 639
         }
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
     {
667 667
         if (is_string($keys)) {
668 668
             $indexName = $keys;
669
-            if (! preg_match('#_-?1$#', $indexName)) {
669
+            if ( ! preg_match('#_-?1$#', $indexName)) {
670 670
                 $indexName .= '_1';
671 671
             }
672 672
         } elseif (is_array($keys)) {
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
      */
706 706
     public function getIndexInfo()
707 707
     {
708
-        $convertIndex = function (\MongoDB\Model\IndexInfo $indexInfo) {
708
+        $convertIndex = function(\MongoDB\Model\IndexInfo $indexInfo) {
709 709
             $infos = [
710 710
                 'v' => $indexInfo->getVersion(),
711 711
                 'key' => $indexInfo->getKey(),
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
             ];
730 730
 
731 731
             foreach ($additionalKeys as $key) {
732
-                if (! isset($indexInfo[$key])) {
732
+                if ( ! isset($indexInfo[$key])) {
733 733
                     continue;
734 734
                 }
735 735
 
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
     {
755 755
         try {
756 756
             // Handle legacy mode - limit and skip as second and third parameters, respectively
757
-            if (! is_array($options)) {
757
+            if ( ! is_array($options)) {
758 758
                 $limit = $options;
759 759
                 $options = [];
760 760
 
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
                 $this->convertWriteConcernOptions($options)
802 802
             );
803 803
 
804
-            if (! $result->isAcknowledged()) {
804
+            if ( ! $result->isAcknowledged()) {
805 805
                 return true;
806 806
             }
807 807
 
@@ -835,13 +835,13 @@  discard block
 block discarded – undo
835 835
         if ($document_or_id instanceof \MongoId) {
836 836
             $id = $document_or_id;
837 837
         } elseif (is_object($document_or_id)) {
838
-            if (! isset($document_or_id->_id)) {
838
+            if ( ! isset($document_or_id->_id)) {
839 839
                 return null;
840 840
             }
841 841
 
842 842
             $id = $document_or_id->_id;
843 843
         } elseif (is_array($document_or_id)) {
844
-            if (! isset($document_or_id['_id'])) {
844
+            if ( ! isset($document_or_id['_id'])) {
845 845
                 return null;
846 846
             }
847 847
 
@@ -884,14 +884,14 @@  discard block
 block discarded – undo
884 884
         $command = [
885 885
             'group' => [
886 886
                 'ns' => $this->name,
887
-                '$reduce' => (string)$reduce,
887
+                '$reduce' => (string) $reduce,
888 888
                 'initial' => $initial,
889 889
                 'cond' => $condition,
890 890
             ],
891 891
         ];
892 892
 
893 893
         if ($keys instanceof MongoCode) {
894
-            $command['group']['$keyf'] = (string)$keys;
894
+            $command['group']['$keyf'] = (string) $keys;
895 895
         } else {
896 896
             $command['group']['key'] = $keys;
897 897
         }
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
         }
901 901
         if (array_key_exists('finalize', $condition)) {
902 902
             if ($condition['finalize'] instanceof MongoCode) {
903
-                $condition['finalize'] = (string)$condition['finalize'];
903
+                $condition['finalize'] = (string) $condition['finalize'];
904 904
             }
905 905
             $command['group']['finalize'] = $condition['finalize'];
906 906
         }
@@ -954,11 +954,11 @@  discard block
 block discarded – undo
954 954
             $options['w'] = ($options['safe']) ? 1 : 0;
955 955
         }
956 956
 
957
-        if (isset($options['wtimeout']) && !isset($options['wTimeoutMS'])) {
957
+        if (isset($options['wtimeout']) && ! isset($options['wTimeoutMS'])) {
958 958
             $options['wTimeoutMS'] = $options['wtimeout'];
959 959
         }
960 960
 
961
-        if (isset($options['w']) || !isset($options['wTimeoutMS'])) {
961
+        if (isset($options['w']) || ! isset($options['wTimeoutMS'])) {
962 962
             $collectionWriteConcern = $this->getWriteConcern();
963 963
             $writeConcern = $this->createWriteConcernFromParameters(
964 964
                 isset($options['w']) ? $options['w'] : $collectionWriteConcern['w'],
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
      */
983 983
     private function ensureDocumentHasMongoId(&$document)
984 984
     {
985
-        $checkKeys = function ($array) {
985
+        $checkKeys = function($array) {
986 986
             foreach (array_keys($array) as $key) {
987 987
                 if (empty($key) && $key !== 0) {
988 988
                     throw new \MongoException('zero-length keys are not allowed, did you use $ with double quotes?');
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
         };
992 992
 
993 993
         if (is_array($document)) {
994
-            if (! isset($document['_id'])) {
994
+            if ( ! isset($document['_id'])) {
995 995
                 $document['_id'] = new \MongoId();
996 996
             }
997 997
 
@@ -1001,12 +1001,12 @@  discard block
 block discarded – undo
1001 1001
         } elseif (is_object($document)) {
1002 1002
             $reflectionObject = new \ReflectionObject($document);
1003 1003
             foreach ($reflectionObject->getProperties() as $property) {
1004
-                if (! $property->isPublic()) {
1004
+                if ( ! $property->isPublic()) {
1005 1005
                     throw new \MongoException('zero-length keys are not allowed, did you use $ with double quotes?');
1006 1006
                 }
1007 1007
             }
1008 1008
 
1009
-            if (! isset($document->_id)) {
1009
+            if ( ! isset($document->_id)) {
1010 1010
                 $document->_id = new \MongoId();
1011 1011
             }
1012 1012
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@
 block discarded – undo
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
 
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/Mongo/MongoClient.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
      * @link http://www.php.net/manual/en/mongoclient.killcursor.php
235 235
      * @param string $server_hash The server hash that has the cursor.
236 236
      * @param int|MongoInt64 $id The ID of the cursor to kill.
237
-     * @return bool
237
+     * @return boolean|null
238 238
      */
239 239
     public function killCursor($server_hash, $id)
240 240
     {
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
     }
343 343
 
344 344
     /**
345
-     * @return array
345
+     * @return string[]
346 346
      */
347 347
     function __sleep()
348 348
     {
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     }
353 353
 
354 354
     /**
355
-     * @param $server
355
+     * @param string $server
356 356
      * @return array
357 357
      */
358 358
     private function extractUrlOptions($server)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
     use Helper\WriteConcern;
33 33
 
34 34
     const VERSION = '1.6.12';
35
-    const DEFAULT_HOST = "localhost" ;
36
-    const DEFAULT_PORT = 27017 ;
37
-    const RP_PRIMARY = "primary" ;
38
-    const RP_PRIMARY_PREFERRED = "primaryPreferred" ;
39
-    const RP_SECONDARY = "secondary" ;
40
-    const RP_SECONDARY_PREFERRED = "secondaryPreferred" ;
41
-    const RP_NEAREST = "nearest" ;
35
+    const DEFAULT_HOST = "localhost";
36
+    const DEFAULT_PORT = 27017;
37
+    const RP_PRIMARY = "primary";
38
+    const RP_PRIMARY_PREFERRED = "primaryPreferred";
39
+    const RP_SECONDARY = "secondary";
40
+    const RP_SECONDARY_PREFERRED = "secondaryPreferred";
41
+    const RP_NEAREST = "nearest";
42 42
 
43 43
     /**
44 44
      * @var bool
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
         $this->server = $server;
92 92
         if (false === strpos($this->server, 'mongodb://')) {
93
-            $this->server = 'mongodb://'.$this->server;
93
+            $this->server = 'mongodb://' . $this->server;
94 94
         }
95 95
         $this->client = new Client($this->server, $options, $driverOptions);
96 96
         $info = $this->client->__debugInfo();
Please login to merge, or discard this patch.