Completed
Pull Request — master (#255)
by Andreas
21:00
created
lib/Mongo/MongoId.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@
 block discarded – undo
200 200
     }
201 201
 
202 202
     /**
203
-     * @param $id
203
+     * @param string|null $id
204 204
      * @throws MongoException
205 205
      */
206 206
     private function createObjectID($id)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
     {
49 49
         if ($value instanceof ObjectID || $value instanceof MongoId) {
50 50
             return true;
51
-        } elseif (! is_string($value)) {
51
+        } elseif ( ! is_string($value)) {
52 52
             return false;
53 53
         }
54 54
 
Please login to merge, or discard this patch.
lib/Mongo/MongoDBRef.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
      */
78 78
     public static function get($db, $ref)
79 79
     {
80
-        if (! static::isRef($ref)) {
80
+        if ( ! static::isRef($ref)) {
81 81
             return null;
82 82
         }
83 83
 
Please login to merge, or discard this patch.
lib/Mongo/MongoRegex.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
             return;
44 44
         }
45 45
 
46
-        if (! preg_match('#^/(.*)/([imxslu]*)$#', $regex, $matches)) {
46
+        if ( ! preg_match('#^/(.*)/([imxslu]*)$#', $regex, $matches)) {
47 47
             throw new MongoException('invalid regex', 9);
48 48
         }
49 49
 
Please login to merge, or discard this patch.
lib/Mongo/MongoPool.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      *
36 36
      * @link http://php.net/manual/en/mongopool.setsize.php
37 37
      * @param int $size
38
-     * @return boolean Returns the former value of pool size
38
+     * @return integer Returns the former value of pool size
39 39
      */
40 40
     public static function setSize($size)
41 41
     {
Please login to merge, or discard this patch.
lib/Mongo/functions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 use Alcaeus\MongoDbAdapter\TypeConverter;
17 17
 
18
-if (! function_exists('bson_decode')) {
18
+if ( ! function_exists('bson_decode')) {
19 19
     /**
20 20
      * Deserializes a BSON object into a PHP array
21 21
      *
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
     }
29 29
 }
30 30
 
31
-if (! function_exists('bson_encode')) {
31
+if ( ! function_exists('bson_encode')) {
32 32
     /**
33 33
      * Serializes a PHP variable into a BSON string
34 34
      *
Please login to merge, or discard this patch.
lib/Alcaeus/MongoDbAdapter/AbstractCursor.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     ];
81 81
 
82 82
     /**
83
-     * @return Cursor
83
+     * @return \Traversable
84 84
      */
85 85
     abstract protected function ensureCursor();
86 86
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
     }
378 378
 
379 379
     /**
380
-     * @return array
380
+     * @return string[]
381 381
      */
382 382
     public function __sleep()
383 383
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function next()
162 162
     {
163
-        if (! $this->startedIterating) {
163
+        if ( ! $this->startedIterating) {
164 164
             $this->ensureIterator();
165 165
             $this->startedIterating = true;
166 166
         } else {
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
      */
403 403
     protected function storeIteratorState()
404 404
     {
405
-        if (! $this->startedIterating) {
405
+        if ( ! $this->startedIterating) {
406 406
             $this->current = null;
407 407
             $this->key = null;
408 408
             $this->valid = false;
Please login to merge, or discard this patch.
lib/Mongo/MongoCommandCursor.php 2 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   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
             }
66 66
 
67 67
             $originalReadPreference = null;
68
-            if (!$this->supportsReadPreference()) {
68
+            if ( ! $this->supportsReadPreference()) {
69 69
                 $originalReadPreference = $this->readPreference;
70 70
                 $this->setReadPreference(\MongoClient::RP_PRIMARY);
71 71
             }
Please login to merge, or discard this patch.
lib/Mongo/MongoDB.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -511,6 +511,9 @@  discard block
 block discarded – undo
511 511
         }
512 512
     }
513 513
 
514
+    /**
515
+     * @param string $name
516
+     */
514 517
     private function checkDatabaseName($name)
515 518
     {
516 519
         if (empty($name)) {
@@ -543,7 +546,7 @@  discard block
 block discarded – undo
543 546
     }
544 547
 
545 548
     /**
546
-     * @return array
549
+     * @return string[]
547 550
      */
548 551
     public function __sleep()
549 552
     {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             throw ExceptionConverter::toLegacy($e);
143 143
         }
144 144
 
145
-        $getCollectionInfo = function (CollectionInfo $collectionInfo) {
145
+        $getCollectionInfo = function(CollectionInfo $collectionInfo) {
146 146
             // @todo do away with __debugInfo once https://jira.mongodb.org/browse/PHPLIB-226 is fixed
147 147
             $info = $collectionInfo->__debugInfo();
148 148
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                     'info' => isset($info['info']) ? (array) $info['info'] : null,
155 155
                     'idIndex' => isset($info['idIndex']) ? (array) $info['idIndex'] : null,
156 156
                 ],
157
-                function ($item) {
157
+                function($item) {
158 158
                     return $item !== null;
159 159
                 }
160 160
             );
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             throw ExceptionConverter::toLegacy($e);
191 191
         }
192 192
 
193
-        $getCollectionName = function (CollectionInfo $collectionInfo) {
193
+        $getCollectionName = function(CollectionInfo $collectionInfo) {
194 194
             return $collectionInfo->getName();
195 195
         };
196 196
 
@@ -359,13 +359,13 @@  discard block
 block discarded – undo
359 359
         if ($document_or_id instanceof \MongoId) {
360 360
             $id = $document_or_id;
361 361
         } elseif (is_object($document_or_id)) {
362
-            if (! isset($document_or_id->_id)) {
362
+            if ( ! isset($document_or_id->_id)) {
363 363
                 $id = $document_or_id;
364 364
             } else {
365 365
                 $id = $document_or_id->_id;
366 366
             }
367 367
         } elseif (is_array($document_or_id)) {
368
-            if (! isset($document_or_id['_id'])) {
368
+            if ( ! isset($document_or_id['_id'])) {
369 369
                 return null;
370 370
             }
371 371
 
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
      */
554 554
     private function getSystemCollectionFilterClosure($includeSystemCollections = false)
555 555
     {
556
-        return function (CollectionInfo $collectionInfo) use ($includeSystemCollections) {
556
+        return function(CollectionInfo $collectionInfo) use ($includeSystemCollections) {
557 557
             return $includeSystemCollections || ! preg_match('#^system\.#', $collectionInfo->getName());
558 558
         };
559 559
     }
Please login to merge, or discard this patch.
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   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function findOne($query = [], array $fields = [], array $options = [])
133 133
     {
134
-        if (! is_array($query)) {
134
+        if ( ! is_array($query)) {
135 135
             $query = ['filename' => (string) $query];
136 136
         }
137 137
 
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
             ];
245 245
 
246 246
             $handle = fopen($filename, 'r');
247
-            if (! $handle) {
247
+            if ( ! $handle) {
248 248
                 throw new MongoGridFSException('could not open file: ' . $filename);
249 249
             }
250
-        } elseif (! is_resource($filename)) {
250
+        } elseif ( ! is_resource($filename)) {
251 251
             throw new \Exception('first argument must be a string or stream resource');
252 252
         } else {
253 253
             $handle = $filename;
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
 
271 271
         // Add length and MD5 if they were not present before
272 272
         $update = [];
273
-        if (! isset($record['length'])) {
273
+        if ( ! isset($record['length'])) {
274 274
             $update['length'] = $length;
275 275
         }
276
-        if (! isset($record['md5'])) {
276
+        if ( ! isset($record['md5'])) {
277 277
             try {
278 278
                 $update['md5'] = $md5;
279 279
             } catch (MongoException $e) {
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         if (count($update)) {
285 285
             try {
286 286
                 $result = $this->update(['_id' => $file['_id']], ['$set' => $update]);
287
-                if (! $this->isOKResult($result)) {
287
+                if ( ! $this->isOKResult($result)) {
288 288
                     throw new MongoGridFSException('Could not store file');
289 289
                 }
290 290
             } catch (MongoException $e) {
@@ -307,10 +307,10 @@  discard block
 block discarded – undo
307 307
      */
308 308
     public function storeUpload($name, array $metadata = [])
309 309
     {
310
-        if (! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) {
310
+        if ( ! isset($_FILES[$name]) || $_FILES[$name]['error'] !== UPLOAD_ERR_OK) {
311 311
             throw new MongoGridFSException("Could not find uploaded file $name");
312 312
         }
313
-        if (! isset($_FILES[$name]['tmp_name'])) {
313
+        if ( ! isset($_FILES[$name]['tmp_name'])) {
314 314
             throw new MongoGridFSException("Couldn't find tmp_name in the \$_FILES array. Are you sure the upload worked?");
315 315
         }
316 316
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 
361 361
         $result = $this->chunks->insert($chunk);
362 362
 
363
-        if (! $this->isOKResult($result)) {
363
+        if ( ! $this->isOKResult($result)) {
364 364
             throw new \MongoException('error inserting chunk');
365 365
         }
366 366
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         $hash = hash_init('md5');
406 406
 
407 407
         rewind($handle);
408
-        while (! feof($handle)) {
408
+        while ( ! feof($handle)) {
409 409
             $data = stream_get_contents($handle, $chunkSize);
410 410
             hash_update($hash, $data);
411 411
             $this->insertChunk($fileId, $data, $i++);
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 
436 436
         $result = $this->insert($record, $options);
437 437
 
438
-        if (! $this->isOKResult($result)) {
438
+        if ( ! $this->isOKResult($result)) {
439 439
             throw new \MongoException('error inserting file');
440 440
         }
441 441
 
Please login to merge, or discard this patch.