Completed
Pull Request — master (#15)
by
unknown
33:10 queued 19:53
created
lib/Mongo/MongoId.php 1 patch
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.
lib/Mongo/MongoLog.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
      *
98 98
      * <p>The log message itself.</p></li>
99 99
      * <ul>
100
-     * @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.
100
+     * @return boolean|null Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.
101 101
      */
102 102
     public static function setCallback ( callable $log_function ) {}
103 103
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
99 99
      * <ul>
100 100
      * @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.
101 101
      */
102
-    public static function setCallback ( callable $log_function ) {}
102
+    public static function setCallback(callable $log_function) {}
103 103
 
104 104
     /**
105 105
      * This function can be used to set how verbose logging should be and the types of
Please login to merge, or discard this patch.
Braces   +17 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,7 +13,8 @@  discard block
 block discarded – undo
13 13
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 14
  */
15 15
 
16
-class MongoLog {
16
+class MongoLog
17
+{
17 18
     /**
18 19
      * @link http://php.net/manual/en/class.mongolog.php#mongolog.constants.none
19 20
      */
@@ -99,7 +100,9 @@  discard block
 block discarded – undo
99 100
      * <ul>
100 101
      * @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.
101 102
      */
102
-    public static function setCallback ( callable $log_function ) {}
103
+    public static function setCallback ( callable $log_function )
104
+    {
105
+}
103 106
 
104 107
     /**
105 108
      * This function can be used to set how verbose logging should be and the types of
@@ -111,7 +114,9 @@  discard block
 block discarded – undo
111 114
      * @param int $level The levels you would like to log
112 115
      * @return void
113 116
      */
114
-    public static function setLevel($level) {}
117
+    public static function setLevel($level)
118
+    {
119
+}
115 120
 
116 121
     /**
117 122
      * This can be used to see the log level. Use the constants described in the
@@ -121,7 +126,9 @@  discard block
 block discarded – undo
121 126
      * @static
122 127
      * @return int Returns the current level
123 128
      */
124
-    public static function getLevel() {}
129
+    public static function getLevel()
130
+    {
131
+}
125 132
 
126 133
     /**
127 134
      * This function can be used to set which parts of the driver's functionality
@@ -133,7 +140,9 @@  discard block
 block discarded – undo
133 140
      * @param int $module The module(s) you would like to log
134 141
      * @return void
135 142
      */
136
-    public static function setModule($module) {}
143
+    public static function setModule($module)
144
+    {
145
+}
137 146
 
138 147
     /**
139 148
      * This function can be used to see which parts of the driver's functionality are
@@ -144,5 +153,7 @@  discard block
 block discarded – undo
144 153
      * @static
145 154
      * @return int Returns the modules currently being logged
146 155
      */
147
-    public static function getModule() {}
156
+    public static function getModule()
157
+    {
158
+}
148 159
 }
Please login to merge, or discard this patch.
lib/Mongo/MongoPool.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
      * @param int $size The max number of connections future pools will be able to
51 51
      *        create. Negative numbers mean that the pool will spawn an infinite number of
52 52
      *        connections
53
-     * @return boolean Returns the former value of pool size
53
+     * @return boolean|null Returns the former value of pool size
54 54
      */
55 55
     public static function setSize($size) {}
56 56
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,8 @@  discard block
 block discarded – undo
13 13
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 14
  */
15 15
 
16
-class MongoPool {
16
+class MongoPool
17
+{
17 18
     /**
18 19
      * Returns an array of information about all connection pools.
19 20
      *
@@ -40,7 +41,9 @@  discard block
 block discarded – undo
40 41
      *         keeps increasing, you may want to use MongoPool::setSize to add more connections
41 42
      *         to your pool
42 43
      */
43
-    public static function info() {}
44
+    public static function info()
45
+    {
46
+}
44 47
 
45 48
     /**
46 49
      * Sets the max number of connections new pools will be able to create.
@@ -52,7 +55,9 @@  discard block
 block discarded – undo
52 55
      *        connections
53 56
      * @return boolean Returns the former value of pool size
54 57
      */
55
-    public static function setSize($size) {}
58
+    public static function setSize($size)
59
+    {
60
+}
56 61
 
57 62
     /**
58 63
      * .
@@ -61,5 +66,7 @@  discard block
 block discarded – undo
61 66
      * @static
62 67
      * @return int Returns the current pool size
63 68
      */
64
-    public static function getSize() {}
69
+    public static function getSize()
70
+    {
71
+}
65 72
 }
Please login to merge, or discard this patch.
lib/Mongo/MongoClient.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 class MongoClient
24 24
 {
25 25
     const VERSION = '1.6.12';
26
-    const DEFAULT_HOST = "localhost" ;
27
-    const DEFAULT_PORT = 27017 ;
28
-    const RP_PRIMARY = "primary" ;
29
-    const RP_PRIMARY_PREFERRED = "primaryPreferred" ;
30
-    const RP_SECONDARY = "secondary" ;
31
-    const RP_SECONDARY_PREFERRED = "secondaryPreferred" ;
32
-    const RP_NEAREST = "nearest" ;
26
+    const DEFAULT_HOST = "localhost";
27
+    const DEFAULT_PORT = 27017;
28
+    const RP_PRIMARY = "primary";
29
+    const RP_PRIMARY_PREFERRED = "primaryPreferred";
30
+    const RP_SECONDARY = "secondary";
31
+    const RP_SECONDARY_PREFERRED = "secondaryPreferred";
32
+    const RP_NEAREST = "nearest";
33 33
 
34 34
     /**
35 35
      * @var bool
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      * {@link http://www.php.net/manual/en/class.mongoint64.php MongoInt64} class. The latter is necessary on 32
199 199
      * bit platforms (and Windows).
200 200
      */
201
-    public function killCursor($server_hash , $id)
201
+    public function killCursor($server_hash, $id)
202 202
     {
203 203
 
204 204
     }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@
 block discarded – undo
216 216
      * @link http://www.php.net/manual/en/mongoclient.killcursor.php
217 217
      * @param string $server_hash The server hash that has the cursor.
218 218
      * @param int|MongoInt64 $id The ID of the cursor to kill.
219
-     * @return bool
219
+     * @return boolean|null
220 220
      */
221 221
     public function killCursor($server_hash , $id)
222 222
     {
Please login to merge, or discard this patch.
lib/Mongo/MongoResultException.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
      * http://php.net/manual/en/mongoresultexception.getdocument.php
26 26
      * @return array <p>The full result document as an array, including partial data if available and additional keys.</p>
27 27
      */
28
-    public function getDocument () {}
28
+    public function getDocument() {}
29 29
 
30 30
     public $document;
31 31
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,13 +18,16 @@
 block discarded – undo
18 18
  * @link http://php.net/manual/en/class.mongoresultexception.php#mongoresultexception.props.document
19 19
  *
20 20
  */
21
-class MongoResultException extends MongoException {
21
+class MongoResultException extends MongoException
22
+{
22 23
     /**
23 24
      * Retrieve the full result document
24 25
      * http://php.net/manual/en/mongoresultexception.getdocument.php
25 26
      * @return array <p>The full result document as an array, including partial data if available and additional keys.</p>
26 27
      */
27
-    public function getDocument () {}
28
+    public function getDocument ()
29
+    {
30
+}
28 31
 
29 32
     public $document;
30 33
 
Please login to merge, or discard this patch.
lib/Mongo/MongoBinData.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 
16 16
 use Alcaeus\MongoDbAdapter\TypeInterface;
17 17
 use MongoDB\BSON\Binary;
18
-use MongoDB\BSON\Type;
19 18
 
20 19
 class MongoBinData implements TypeInterface
21 20
 {
Please login to merge, or discard this patch.
lib/Alcaeus/MongoDbAdapter/AbstractCursor.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
     protected $readPreference = [];
73 73
 
74 74
     /**
75
-     * @return Cursor
75
+     * @return \Traversable
76 76
      */
77 77
     abstract protected function ensureCursor();
78 78
 
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
@@ -201,7 +201,7 @@
 block discarded – undo
201 201
      * @link http://www.php.net/manual/en/mongocursor.hasnext.php
202 202
      * @throws MongoConnectionException
203 203
      * @throws MongoCursorTimeoutException
204
-     * @return bool Returns true if there is another element
204
+     * @return boolean|null Returns true if there is another element
205 205
      */
206 206
     public function hasNext()
207 207
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 
16 16
 use Alcaeus\MongoDbAdapter\AbstractCursor;
17 17
 use MongoDB\Driver\Cursor;
18
-use MongoDB\Driver\ReadPreference;
19 18
 use MongoDB\Operation\Find;
20 19
 
21 20
 /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -380,7 +380,7 @@
 block discarded – undo
380 380
      */
381 381
     protected function convertCursorType()
382 382
     {
383
-        if (! $this->tailable) {
383
+        if ( ! $this->tailable) {
384 384
             return null;
385 385
         }
386 386
 
Please login to merge, or discard this patch.
lib/Mongo/MongoCollection.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
      * @throws MongoException if the inserted document is empty or if it contains zero-length keys. Attempting to insert an object with protected and private properties will cause a zero-length key error.
273 273
      * @throws MongoCursorException if the "w" option is set and the write fails.
274 274
      * @throws MongoCursorTimeoutException if the "w" option is set to a value greater than one and the operation takes longer than MongoCursor::$timeout milliseconds to complete. This does not kill the operation on the server, it is a client-side timeout. The operation in MongoCollection::$wtimeout is milliseconds.
275
-     * @return bool|array Returns an array containing the status of the insertion if the "w" option is set.
275
+     * @return MongoDB\InsertOneResult Returns an array containing the status of the insertion if the "w" option is set.
276 276
      */
277 277
     public function insert($a, array $options = array())
278 278
     {
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      * @param array $a An array of arrays.
286 286
      * @param array $options Options for the inserts.
287 287
      * @throws MongoCursorException
288
-     * @return mixed f "safe" is set, returns an associative array with the status of the inserts ("ok") and any error that may have occured ("err"). Otherwise, returns TRUE if the batch insert was successfully sent, FALSE otherwise.
288
+     * @return MongoDB\InsertManyResult f "safe" is set, returns an associative array with the status of the inserts ("ok") and any error that may have occured ("err"). Otherwise, returns TRUE if the batch insert was successfully sent, FALSE otherwise.
289 289
      */
290 290
     public function batchInsert(array $a, array $options = array())
291 291
     {
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
      * @link http://www.php.net/manual/en/mongocollection.createindex.php
467 467
      * @param array $keys Field or fields to use as index.
468 468
      * @param array $options [optional] This parameter is an associative array of the form array("optionname" => <boolean>, ...).
469
-     * @return array Returns the database response.
469
+     * @return string|false Returns the database response.
470 470
      */
471 471
     public function createIndex(array $keys, array $options = array())
472 472
     {
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
      * @throws MongoException if the inserted document is empty or if it contains zero-length keys. Attempting to insert an object with protected and private properties will cause a zero-length key error.
560 560
      * @throws MongoCursorException if the "w" option is set and the write fails.
561 561
      * @throws MongoCursorTimeoutException if the "w" option is set to a value greater than one and the operation takes longer than MongoCursor::$timeout milliseconds to complete. This does not kill the operation on the server, it is a client-side timeout. The operation in MongoCollection::$wtimeout is milliseconds.
562
-     * @return array|boolean If w was set, returns an array containing the status of the save.
562
+     * @return MongoDB\UpdateResult If w was set, returns an array containing the status of the save.
563 563
      * Otherwise, returns a boolean representing if the array was not empty (an empty array will not be inserted).
564 564
      */
565 565
     public function save($a, array $options = array())
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function aggregate(array $pipeline, array $op = [])
127 127
     {
128
-        if (! TypeConverter::isNumericArray($pipeline)) {
128
+        if ( ! TypeConverter::isNumericArray($pipeline)) {
129 129
             $pipeline = [];
130 130
             $options = [];
131 131
 
132 132
             $i = 0;
133 133
             foreach (func_get_args() as $operator) {
134 134
                 $i++;
135
-                if (! is_array($operator)) {
135
+                if ( ! is_array($operator)) {
136 136
                     trigger_error("Argument $i is not an array", E_WARNING);
137 137
                     return;
138 138
                 }
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
         ];
171 171
 
172 172
         // Convert cursor option
173
-        if (! isset($options['cursor']) || $options['cursor'] === true || $options['cursor'] === []) {
173
+        if ( ! isset($options['cursor']) || $options['cursor'] === true || $options['cursor'] === []) {
174 174
             // Cursor option needs to be an object convert bools and empty arrays since those won't be handled by TypeConverter
175 175
             $options['cursor'] = new \stdClass;
176 176
         }
177 177
 
178 178
         $command += $options;
179 179
 
180
-        $cursor = new MongoCommandCursor($this->db->getConnection(), (string)$this, $command);
180
+        $cursor = new MongoCommandCursor($this->db->getConnection(), (string) $this, $command);
181 181
         $cursor->setReadPreference($this->getReadPreference());
182 182
 
183 183
         return $cursor;
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
      * @throws MongoCursorException
285 285
      * @return boolean
286 286
      */
287
-    public function update(array $criteria , array $newobj, array $options = [])
287
+    public function update(array $criteria, array $newobj, array $options = [])
288 288
     {
289 289
         $multiple = ($options['multiple']) ? $options['multiple'] : false;
290 290
         $method = $multiple ? 'updateMany' : 'updateOne';
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      */
306 306
     public function remove(array $criteria = [], array $options = [])
307 307
     {
308
-        $multiple = isset($options['justOne']) ? !$options['justOne'] : false;
308
+        $multiple = isset($options['justOne']) ? ! $options['justOne'] : false;
309 309
         $method = $multiple ? 'deleteMany' : 'deleteOne';
310 310
 
311 311
         return $this->collection->$method($criteria, $options);
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
      */
322 322
     public function find(array $query = [], array $fields = [])
323 323
     {
324
-        $cursor = new MongoCursor($this->db->getConnection(), (string)$this, $query, $fields);
324
+        $cursor = new MongoCursor($this->db->getConnection(), (string) $this, $query, $fields);
325 325
         $cursor->setReadPreference($this->getReadPreference());
326 326
 
327 327
         return $cursor;
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
     public function save($a, array $options = [])
505 505
     {
506 506
         if (is_object($a)) {
507
-            $a = (array)$a;
507
+            $a = (array) $a;
508 508
         }
509 509
         if ( ! array_key_exists('_id', $a)) {
510 510
             $id = new \MongoId();
@@ -577,14 +577,14 @@  discard block
 block discarded – undo
577 577
         $command = [
578 578
             'group' => [
579 579
                 'ns' => $this->name,
580
-                '$reduce' => (string)$reduce,
580
+                '$reduce' => (string) $reduce,
581 581
                 'initial' => $initial,
582 582
                 'cond' => $condition,
583 583
             ],
584 584
         ];
585 585
 
586 586
         if ($keys instanceof MongoCode) {
587
-            $command['group']['$keyf'] = (string)$keys;
587
+            $command['group']['$keyf'] = (string) $keys;
588 588
         } else {
589 589
             $command['group']['key'] = $keys;
590 590
         }
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
         }
594 594
         if (array_key_exists('finalize', $condition)) {
595 595
             if ($condition['finalize'] instanceof MongoCode) {
596
-                $condition['finalize'] = (string)$condition['finalize'];
596
+                $condition['finalize'] = (string) $condition['finalize'];
597 597
             }
598 598
             $command['group']['finalize'] = $condition['finalize'];
599 599
         }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     /**
33 33
      * @var MongoDB
34 34
      */
35
-    public $db = NULL;
35
+    public $db = null;
36 36
 
37 37
     /**
38 38
      * @var string
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             foreach (func_get_args() as $operator) {
134 134
                 $i++;
135 135
                 if (! is_array($operator)) {
136
-                    trigger_error("Argument $i is not an array", E_WARNING);
136
+                    trigger_error("argument $i is not an array", E_WARNING);
137 137
                     return;
138 138
                 }
139 139
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
      * @param bool $scan_data Only validate indices, not the base collection.
235 235
      * @return array Returns the database's evaluation of this object.
236 236
      */
237
-    public function validate($scan_data = FALSE)
237
+    public function validate($scan_data = false)
238 238
     {
239 239
         $command = [
240 240
             'validate' => $this->name,
Please login to merge, or discard this patch.