Completed
Pull Request — master (#12)
by
unknown
02:29
created
lib/Alcaeus/MongoDbAdapter/AbstractCursor.php 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@
 block discarded – undo
220 220
             \MongoClient::RP_SECONDARY_PREFERRED,
221 221
             \MongoClient::RP_NEAREST
222 222
         ];
223
-        if (! in_array($readPreference, $availableReadPreferences)) {
223
+        if (!in_array($readPreference, $availableReadPreferences)) {
224 224
             trigger_error("The value '$readPreference' is not valid as read preference type", E_WARNING);
225 225
             return $this;
226 226
         }
Please login to merge, or discard this patch.
lib/Mongo/MongoCursor.php 2 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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -377,7 +377,7 @@
 block discarded – undo
377 377
      */
378 378
     protected function convertCursorType()
379 379
     {
380
-        if (! $this->tailable) {
380
+        if (!$this->tailable) {
381 381
             return null;
382 382
         }
383 383
 
Please login to merge, or discard this patch.
lib/Mongo/MongoCollection.php 2 patches
Doc Comments   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      * @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.
312 312
      * @throws MongoCursorException if the "w" option is set and the write fails.
313 313
      * @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.
314
-     * @return bool|array Returns an array containing the status of the insertion if the "w" option is set.
314
+     * @return MongoDB\InsertOneResult Returns an array containing the status of the insertion if the "w" option is set.
315 315
      */
316 316
     public function insert($a, array $options = array())
317 317
     {
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      * @param array $a An array of arrays.
325 325
      * @param array $options Options for the inserts.
326 326
      * @throws MongoCursorException
327
-     * @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.
327
+     * @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.
328 328
      */
329 329
     public function batchInsert(array $a, array $options = array())
330 330
     {
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
      * @link http://www.php.net/manual/en/mongocollection.createindex.php
503 503
      * @param array $keys Field or fields to use as index.
504 504
      * @param array $options [optional] This parameter is an associative array of the form array("optionname" => <boolean>, ...).
505
-     * @return array Returns the database response.
505
+     * @return string|false Returns the database response.
506 506
      */
507 507
     public function createIndex(array $keys, array $options = array())
508 508
     {
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
      * @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.
596 596
      * @throws MongoCursorException if the "w" option is set and the write fails.
597 597
      * @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.
598
-     * @return array|boolean If w was set, returns an array containing the status of the save.
598
+     * @return MongoDB\UpdateResult If w was set, returns an array containing the status of the save.
599 599
      * Otherwise, returns a boolean representing if the array was not empty (an empty array will not be inserted).
600 600
      */
601 601
     public function save($a, array $options = array())
@@ -719,7 +719,6 @@  discard block
 block discarded – undo
719 719
      * @link http://php.net/manual/en/mongodb.setwriteconcern.php
720 720
      * Set the write concern for this database
721 721
      * @param mixed $w <p>The write concern. This may be an integer denoting the number of servers required to acknowledge the write, or a string mode (e.g. "majority").</p>
722
-     * @param int $wtimeout[optional] <p>The maximum number of milliseconds to wait for the server to satisfy the write concern.</p>
723 722
      * @return boolean Returns <b>TRUE</b> on success, or <b>FALSE</b> otherwise.
724 723
      */
725 724
     public function setWriteConcern($w, $wtimeout = null)
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -131,14 +131,14 @@  discard block
 block discarded – undo
131 131
      */
132 132
     public function aggregate(array $pipeline, array $op = [])
133 133
     {
134
-        if (! TypeConverter::isNumericArray($pipeline)) {
134
+        if (!TypeConverter::isNumericArray($pipeline)) {
135 135
             $pipeline = [];
136 136
             $options = [];
137 137
 
138 138
             $i = 0;
139 139
             foreach (func_get_args() 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_WARNING);
143 143
                     return;
144 144
                 }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         ];
175 175
 
176 176
         // Convert cursor option
177
-        if (! isset($options['cursor']) || $options['cursor'] === true || $options['cursor'] === []) {
177
+        if (!isset($options['cursor']) || $options['cursor'] === true || $options['cursor'] === []) {
178 178
             // Cursor option needs to be an object convert bools and empty arrays since those won't be handled by TypeConverter
179 179
             $options['cursor'] = new \stdClass;
180 180
         }
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
      * @throws MongoCursorException
361 361
      * @return boolean
362 362
      */
363
-    public function update(array $criteria , array $newobj, array $options = array())
363
+    public function update(array $criteria, array $newobj, array $options = array())
364 364
     {
365 365
         $multiple = ($options['multiple']) ? $options['multiple'] : false;
366 366
 //        $multiple = $options['multiple'] ?? false;
@@ -601,9 +601,9 @@  discard block
 block discarded – undo
601 601
     public function save($a, array $options = array())
602 602
     {
603 603
         if (is_object($a)) {
604
-            $a = (array)$a;
604
+            $a = (array) $a;
605 605
         }
606
-        if ( ! array_key_exists('_id', $a)) {
606
+        if (!array_key_exists('_id', $a)) {
607 607
             $id = new \MongoId();
608 608
         } else {
609 609
             $id = $a['_id'];
@@ -665,20 +665,20 @@  discard block
 block discarded – undo
665 665
         if (is_string($reduce)) {
666 666
             $reduce = new MongoCode($reduce);
667 667
         }
668
-        if ( ! $reduce instanceof MongoCode) {
668
+        if (!$reduce instanceof MongoCode) {
669 669
             throw new \InvalidArgumentExcption('reduce parameter should be a string or MongoCode instance.');
670 670
         }
671 671
         $command = [
672 672
             'group' => [
673 673
                 'ns'      => $this->name,
674
-                '$reduce' => (string)$reduce,
674
+                '$reduce' => (string) $reduce,
675 675
                 'initial' => $initial,
676 676
                 'cond'    => $condition,
677 677
             ],
678 678
         ];
679 679
 
680 680
         if ($keys instanceof MongoCode) {
681
-            $command['group']['$keyf'] = (string)$keys;
681
+            $command['group']['$keyf'] = (string) $keys;
682 682
         } else {
683 683
             $command['group']['key'] = $keys;
684 684
         }
@@ -687,14 +687,14 @@  discard block
 block discarded – undo
687 687
         }
688 688
         if (array_key_exists('finalize', $condition)) {
689 689
             if ($condition['finalize'] instanceof MongoCode) {
690
-                $condition['finalize'] = (string)$condition['finalize'];
690
+                $condition['finalize'] = (string) $condition['finalize'];
691 691
             }
692 692
             $command['group']['finalize'] = $condition['finalize'];
693 693
         }
694 694
 
695 695
         $result = $this->db->command($command, [], $hash);
696 696
         unset($result['waitedMS']);
697
-        $result['ok'] = (int)$result['ok'];
697
+        $result['ok'] = (int) $result['ok'];
698 698
         if (count($result['retval'])) {
699 699
             $result['retval'] = current($result['retval']);
700 700
         }
Please login to merge, or discard this patch.
lib/Mongo/MongoClient.php 2 patches
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      * Lists all of the databases available
245 245
      *
246 246
      * @link http://php.net/manual/en/mongoclient.listdbs.php
247
-     * @return array Returns an associative array containing three fields. The first field is databases, which in turn contains an array. Each element of the array is an associative array corresponding to a database, giving the database's name, size, and if it's empty. The other two fields are totalSize (in bytes) and ok, which is 1 if this method ran successfully.
247
+     * @return MongoDB\Model\DatabaseInfoLegacyIterator Returns an associative array containing three fields. The first field is databases, which in turn contains an array. Each element of the array is an associative array corresponding to a database, giving the database's name, size, and if it's empty. The other two fields are totalSize (in bytes) and ok, which is 1 if this method ran successfully.
248 248
      */
249 249
     public function listDBs()
250 250
     {
@@ -303,7 +303,6 @@  discard block
 block discarded – undo
303 303
      * @link http://php.net/manual/en/mongoclient.setwriteconcern.php
304 304
      * Set the write concern for this database
305 305
      * @param mixed $w <p>The write concern. This may be an integer denoting the number of servers required to acknowledge the write, or a string mode (e.g. "majority").</p>
306
-     * @param int $wtimeout[optional] <p>The maximum number of milliseconds to wait for the server to satisfy the write concern.</p>
307 306
      * @return boolean Returns <b>TRUE</b> on success, or <b>FALSE</b> otherwise.
308 307
      */
309 308
     public function setWriteConcern($w, $wtimeout = null)
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 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
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             $results[$key] = [
196 196
                 'host'     => $server->getHost(),
197 197
                 'port'     => $server->getPort(),
198
-                'health'   => (int)$info['ok'], // Not totally sure about this
198
+                'health'   => (int) $info['ok'], // Not totally sure about this
199 199
                 'state'    => $server->getType(),
200 200
                 'ping'     => $server->getLatency(),
201 201
                 'lastPing' => null,
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * {@link http://www.php.net/manual/en/class.mongoint64.php MongoInt64} class. The latter is necessary on 32
236 236
      * bit platforms (and Windows).
237 237
      */
238
-    public function killCursor($server_hash , $id)
238
+    public function killCursor($server_hash, $id)
239 239
     {
240 240
         throw new \Exception('Not implemented');
241 241
     }
Please login to merge, or discard this patch.