@@ -26,8 +26,6 @@ |
||
26 | 26 | * > iter\iterable('ABC', 'DEF')->chain() |
27 | 27 | * A B C D E F |
28 | 28 | * |
29 | - * @param array|string|\Iterator $iterable |
|
30 | - * @param array|string|\Iterator $iterable2 |
|
31 | 29 | * @return null|ChainIterator |
32 | 30 | */ |
33 | 31 | public function chain(/* $iterable, $iterable2, ... */) |
@@ -35,7 +35,6 @@ |
||
35 | 35 | * 2.5 3.5 4.5 |
36 | 36 | * |
37 | 37 | * @param null|string|\Closure $strategy |
38 | - * @param array|string|\Iterator $iterable2 |
|
39 | 38 | * @return MapIterator |
40 | 39 | */ |
41 | 40 | public function map($strategy /*, $iterable2, ... */) |
@@ -22,7 +22,6 @@ |
||
22 | 22 | * > zip([1, 2, 3], ['a', 'b', 'c']) |
23 | 23 | * [1, 'a'] [2, 'b'] [3, 'c'] |
24 | 24 | * |
25 | - * @param array|string|\Iterator $iterable2 |
|
26 | 25 | * @return ZipIterator |
27 | 26 | */ |
28 | 27 | public function zip(/* $iterable2, ... */) |
@@ -22,7 +22,7 @@ |
||
22 | 22 | { |
23 | 23 | if ($this instanceof \Iterator) { |
24 | 24 | $strategy = conversions\mixed_to_value_getter($strategy); |
25 | - $isValid = function ($value, $key) use ($strategy) { |
|
25 | + $isValid = function($value, $key) use ($strategy) { |
|
26 | 26 | $tempVarPhp54 = $strategy($value, $key); |
27 | 27 | return !empty($tempVarPhp54); |
28 | 28 | }; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | function type($class, $strategy = null) |
33 | 33 | { |
34 | 34 | $strategy = conversions\mixed_to_value_getter($strategy); |
35 | - return function ($value, $key = null) use ($class, $strategy) { |
|
35 | + return function($value, $key = null) use ($class, $strategy) { |
|
36 | 36 | return $strategy($value, $key) instanceof $class; |
37 | 37 | }; |
38 | 38 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $haystack = Itertools\iterable($haystack)->values(); |
67 | 67 | } |
68 | 68 | $strategy = conversions\mixed_to_value_getter($strategy); |
69 | - return function ($value, $key = null) use ($haystack, $strategy, $strict) { |
|
69 | + return function($value, $key = null) use ($haystack, $strategy, $strict) { |
|
70 | 70 | return in_array($strategy($value, $key), $haystack, $strict); |
71 | 71 | }; |
72 | 72 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $haystack = Itertools\iterable($haystack)->values(); |
91 | 91 | } |
92 | 92 | $strategy = conversions\mixed_to_value_getter($strategy); |
93 | - return function ($value, $key = null) use ($haystack, $strategy, $strict) { |
|
93 | + return function($value, $key = null) use ($haystack, $strategy, $strict) { |
|
94 | 94 | return !in_array($strategy($value, $key), $haystack, $strict); |
95 | 95 | }; |
96 | 96 | } |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | } |
123 | 123 | $strategy = conversions\mixed_to_value_getter($strategy); |
124 | 124 | if ($strict) { |
125 | - return function ($value, $key = null) use ($expected, $strategy) { |
|
125 | + return function($value, $key = null) use ($expected, $strategy) { |
|
126 | 126 | return $expected === $strategy($value, $key); |
127 | 127 | }; |
128 | 128 | } else { |
129 | - return function ($value, $key = null) use ($expected, $strategy) { |
|
129 | + return function($value, $key = null) use ($expected, $strategy) { |
|
130 | 130 | return $expected == $strategy($value, $key); |
131 | 131 | }; |
132 | 132 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | function not($strategy = null) |
148 | 148 | { |
149 | 149 | $strategy = conversions\mixed_to_value_getter($strategy); |
150 | - return function ($value, $key = null) use ($strategy) { |
|
150 | + return function($value, $key = null) use ($strategy) { |
|
151 | 151 | return !($strategy($value, $key)); |
152 | 152 | }; |
153 | 153 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | $strategy = conversions\mixed_to_value_getter($strategy); |
175 | - return function ($value, $key = null) use ($pattern, $strategy) { |
|
175 | + return function($value, $key = null) use ($pattern, $strategy) { |
|
176 | 176 | return (bool)preg_match($pattern, $strategy($value, $key)); |
177 | 177 | }; |
178 | 178 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function add() |
17 | 17 | { |
18 | - return function ($a, $b) { |
|
18 | + return function($a, $b) { |
|
19 | 19 | if (!is_numeric($a)) { |
20 | 20 | throw new \InvalidArgumentException(sprintf('Argument $A must be numeric to perform addition, not %s', is_object($a) ? get_class($a) : gettype($a))); |
21 | 21 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | function sub() |
35 | 35 | { |
36 | - return function ($a, $b) { |
|
36 | + return function($a, $b) { |
|
37 | 37 | if (!is_numeric($a)) { |
38 | 38 | throw new \InvalidArgumentException(sprintf('Argument $A must be numeric to perform subtraction, not %s', is_object($a) ? get_class($a) : gettype($a))); |
39 | 39 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function mul() |
53 | 53 | { |
54 | - return function ($a, $b) { |
|
54 | + return function($a, $b) { |
|
55 | 55 | if (!is_numeric($a)) { |
56 | 56 | throw new \InvalidArgumentException(sprintf('Argument $A must be numeric to perform multiplication, not %s', is_object($a) ? get_class($a) : gettype($a))); |
57 | 57 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | function min() |
71 | 71 | { |
72 | - return function ($a, $b) { |
|
72 | + return function($a, $b) { |
|
73 | 73 | if (!(is_numeric($a) || $a instanceof \DateTime)) { |
74 | 74 | throw new \InvalidArgumentException(sprintf('Argument $A must be numeric to determine minimum, not %s', is_object($a) ? get_class($a) : gettype($a))); |
75 | 75 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | function max() |
89 | 89 | { |
90 | - return function ($a, $b) { |
|
90 | + return function($a, $b) { |
|
91 | 91 | if (!(is_numeric($a) || $a instanceof \DateTime)) { |
92 | 92 | throw new \InvalidArgumentException(sprintf('Argument $A must be numeric to determine maximum, not %s', is_object($a) ? get_class($a) : gettype($a))); |
93 | 93 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | if (!is_string($glue)) { |
110 | 110 | throw new \InvalidArgumentException(sprintf('Argument $GLUE must be a string to join, not %s', is_object($glue) ? get_class($glue) : gettype($glue))); |
111 | 111 | } |
112 | - return function ($a, $b) use ($glue) { |
|
112 | + return function($a, $b) use ($glue) { |
|
113 | 113 | if (!is_string($a)) { |
114 | 114 | throw new \InvalidArgumentException(sprintf('Argument $A must be a string to join, not %s', is_object($a) ? get_class($a) : gettype($a))); |
115 | 115 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | function chain() |
133 | 133 | { |
134 | - return function ($chainIterator, $b) { |
|
134 | + return function($chainIterator, $b) { |
|
135 | 135 | if (!($chainIterator instanceof ChainIterator)) { |
136 | 136 | throw new \InvalidArgumentException('Argument $A must be a ChainIterator. Did your call "reduce" with "new ChainIterator()" as the initial parameter?'); |
137 | 137 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function lstrip($chars = " \t\n\r\0\x0B") |
18 | 18 | { |
19 | - return function ($value) use ($chars) { |
|
19 | + return function($value) use ($chars) { |
|
20 | 20 | return ltrim($value, $chars); |
21 | 21 | }; |
22 | 22 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | function rstrip($chars = " \t\n\r\0\x0B") |
31 | 31 | { |
32 | - return function ($value) use ($chars) { |
|
32 | + return function($value) use ($chars) { |
|
33 | 33 | return rtrim($value, $chars); |
34 | 34 | }; |
35 | 35 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | function strip($chars = " \t\n\r\0\x0B") |
44 | 44 | { |
45 | - return function ($value) use ($chars) { |
|
45 | + return function($value) use ($chars) { |
|
46 | 46 | return trim($value, $chars); |
47 | 47 | }; |
48 | 48 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | function length() |
56 | 56 | { |
57 | - return function ($value) { |
|
57 | + return function($value) { |
|
58 | 58 | if (is_null($value)) { |
59 | 59 | return 0; |
60 | 60 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | function key() |
76 | 76 | { |
77 | - return function ($value, $key) { |
|
77 | + return function($value, $key) { |
|
78 | 78 | return $key; |
79 | 79 | }; |
80 | 80 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | function lower() |
88 | 88 | { |
89 | - return function ($value) { |
|
89 | + return function($value) { |
|
90 | 90 | return strtolower($value); |
91 | 91 | }; |
92 | 92 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | function upper() |
100 | 100 | { |
101 | - return function ($value) { |
|
101 | + return function($value) { |
|
102 | 102 | return strtoupper($value); |
103 | 103 | }; |
104 | 104 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | function json_encode($options = 0, $depth = 512) |
114 | 114 | { |
115 | - return function ($value) use ($options, $depth) { |
|
115 | + return function($value) use ($options, $depth) { |
|
116 | 116 | return \json_encode($value, $options, $depth); |
117 | 117 | }; |
118 | 118 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | function json_decode($assoc = false, $depth = 512, $options = 0) |
129 | 129 | { |
130 | - return function ($value) use ($assoc, $depth, $options) { |
|
130 | + return function($value) use ($assoc, $depth, $options) { |
|
131 | 131 | return \json_decode($value, $assoc, $depth, $options); |
132 | 132 | }; |
133 | 133 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $strategies = array_map('\Zicht\Itertools\conversions\mixed_to_value_getter', $strategies); |
168 | 168 | $strategy = conversions\mixed_to_value_getter($strategy); |
169 | 169 | |
170 | - return function ($value, $key) use ($strategies, $strategy, $discardNull, $discardEmptyContainer) { |
|
170 | + return function($value, $key) use ($strategies, $strategy, $discardNull, $discardEmptyContainer) { |
|
171 | 171 | $value = $strategy($value); |
172 | 172 | $res = []; |
173 | 173 | foreach ($strategies as $strategyKey => $strategy) { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | if ($discardNull || $discardEmptyContainer) { |
177 | 177 | $res = array_filter( |
178 | 178 | $res, |
179 | - function ($value) use ($discardNull, $discardEmptyContainer) { |
|
179 | + function($value) use ($discardNull, $discardEmptyContainer) { |
|
180 | 180 | if (null === $value) { |
181 | 181 | return !$discardNull; |
182 | 182 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $max = getrandmax(); |
207 | 207 | } |
208 | 208 | |
209 | - return function () use ($min, $max) { |
|
209 | + return function() use ($min, $max) { |
|
210 | 210 | return rand($min, $max); |
211 | 211 | }; |
212 | 212 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | function type($strategy = null) |
221 | 221 | { |
222 | 222 | $strategy = conversions\mixed_to_value_getter($strategy); |
223 | - return function ($value) use ($strategy) { |
|
223 | + return function($value) use ($strategy) { |
|
224 | 224 | $value = $strategy($value); |
225 | 225 | return is_object($value) ? get_class($value) : gettype($value); |
226 | 226 | }; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | $array = iterator_to_array($this); |
30 | 30 | array_walk( |
31 | 31 | $array, |
32 | - function (&$value) { |
|
32 | + function(&$value) { |
|
33 | 33 | if ($value instanceof FiniteIterableInterface) { |
34 | 34 | $value = $value->toArray(); |
35 | 35 | } |