Completed
Pull Request — master (#49)
by Luke
02:03
created
src/Traits/IsArrayable.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
     /**
21 21
      * Get object as array.
22 22
      *
23
-     * @return array This object as an array
23
+     * @return callable This object as an array
24 24
      */
25 25
     public function toArray()
26 26
     {
Please login to merge, or discard this patch.
src/functions.php 2 patches
Indentation   -2 removed lines patch added patch discarded remove patch
@@ -110,10 +110,8 @@
 block discarded – undo
110 110
  *
111 111
  * Accepts any kind of data and converts it to an array. If strict mode is on, only data that returns true from
112 112
  * is_arrayable() will be converted to an array. Anything else will cause an InvalidArgumentException to be thrown.
113
-
114 113
  * @param mixed $data   Data to convert to array
115 114
  * @param bool  $strict Whether to use strict mode
116
-
117 115
  * @return array
118 116
  *
119 117
  * @throws InvalidArgumentException
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 {
172 172
     $type = gettype($data);
173 173
     if ($meta) {
174
-        switch($type) {
174
+        switch ($type) {
175 175
             case 'object':
176 176
                 $class = get_class($data);
177 177
                 return "{$type} <{$class}>";
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
                 return "{$type} <{$restype}>";
181 181
         }
182 182
     } else {
183
-        switch($type) {
183
+        switch ($type) {
184 184
             case 'object':
185 185
                 return get_class($data);
186 186
             case 'resource':
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
     } else {
271 271
         echo $label . "\n" . implode(
272 272
                 array_map(
273
-                    function () {
273
+                    function() {
274 274
                         return '-';
275 275
                     },
276 276
                     str_split($label)
Please login to merge, or discard this patch.
src/Contracts/CollectionInterface.php 2 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -491,7 +491,6 @@
 block discarded – undo
491 491
      *
492 492
      * Reduces this collection to one value by passing value, key, and the return value from the previous iteration
493 493
      * until only one value remains. Iteration begins from the last item in the collection and moves up.
494
-
495 494
      * @param callable $callback The callback function
496 495
      * @param          $initial  The initial "carry" value
497 496
      *
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      * @param string|int $index Set value at this index
81 81
      * @param mixed      $value Set this value at index
82 82
      *
83
-     * @return mixed
83
+     * @return CollectionInterface
84 84
      */
85 85
     public function set($index, $value);
86 86
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @param string|int $index Add value at this index
93 93
      * @param mixed      $value Add this value at index
94 94
      *
95
-     * @return mixed
95
+     * @return CollectionInterface
96 96
      */
97 97
     public function add($index, $value);
98 98
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      *
102 102
      * @param string|int $index Delete item at this index
103 103
      *
104
-     * @return mixed
104
+     * @return CollectionInterface
105 105
      */
106 106
     public function delete($index);
107 107
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      * @param mixed|callable  $value The value to search for
137 137
      * @param int|string|null $index The index to search for
138 138
      *
139
-     * @return mixed
139
+     * @return boolean
140 140
      */
141 141
     public function contains($value, $index = null);
142 142
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
      * @param int  $nth    The number of items between cycles
215 215
      * @param null $offset An optional offset to begin from
216 216
      *
217
-     * @return mixed
217
+     * @return CollectionInterface
218 218
      */
219 219
     public function every($nth, $offset = null);
220 220
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      *
301 301
      * @param int $num Number of items to return
302 302
      *
303
-     * @return mixed|CollectionInterface
303
+     * @return CollectionInterface
304 304
      */
305 305
     public function random($num);
306 306
 
Please login to merge, or discard this patch.
src/Collection/Collection.php 3 patches
Unused Use Statements   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,18 +9,16 @@
 block discarded – undo
9 9
  */
10 10
 namespace Noz\Collection;
11 11
 
12
-use ArrayAccess;
13 12
 use ArrayIterator;
14 13
 use Countable;
15 14
 use InvalidArgumentException;
16 15
 use Iterator;
17 16
 use Noz\Contracts\ArrayableInterface;
18 17
 use Noz\Contracts\CollectionInterface;
19
-use OutOfBoundsException;
20
-use Traversable;
21
-
22 18
 use Noz\Traits\IsArrayable;
23 19
 use Noz\Traits\IsImmutable;
20
+use OutOfBoundsException;
21
+use Traversable;
24 22
 
25 23
 use function
26 24
     Noz\is_traversable,
Please login to merge, or discard this patch.
Indentation   -2 removed lines patch added patch discarded remove patch
@@ -110,10 +110,8 @@
 block discarded – undo
110 110
  *
111 111
  * Accepts any kind of data and converts it to an array. If strict mode is on, only data that returns true from
112 112
  * is_arrayable() will be converted to an array. Anything else will cause an InvalidArgumentException to be thrown.
113
-
114 113
  * @param mixed $data   Data to convert to array
115 114
  * @param bool  $strict Whether to use strict mode
116
-
117 115
  * @return array
118 116
  *
119 117
  * @throws InvalidArgumentException
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      */
325 325
     public function contains($value, $index = null)
326 326
     {
327
-        return (bool) $this->first(function ($val, $key) use ($value, $index) {
327
+        return (bool) $this->first(function($val, $key) use ($value, $index) {
328 328
             if (is_callable($value)) {
329 329
                 $found = $value($val, $key);
330 330
             } else {
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
     public function pairs()
604 604
     {
605 605
         return collect(array_map(
606
-            function ($key, $val) {
606
+            function($key, $val) {
607 607
                 return [$key, $val];
608 608
             },
609 609
             array_keys($this->getData()),
@@ -622,11 +622,11 @@  discard block
 block discarded – undo
622 622
     public function duplicates()
623 623
     {
624 624
         $dups = [];
625
-        $this->walk(function ($val, $key) use (&$dups) {
625
+        $this->walk(function($val, $key) use (&$dups) {
626 626
             $dups[$val][] = $key;
627 627
         });
628 628
 
629
-        return collect($dups)->filter(function ($val) {
629
+        return collect($dups)->filter(function($val) {
630 630
             return count($val) > 1;
631 631
         });
632 632
     }
Please login to merge, or discard this patch.