@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | function type($class, $strategy = null) |
32 | 32 | { |
33 | 33 | $strategy = conversions\mixed_to_value_getter($strategy); |
34 | - return function ($value, $key = null) use ($class, $strategy) { |
|
34 | + return function($value, $key = null) use ($class, $strategy) { |
|
35 | 35 | return $strategy($value, $key) instanceof $class; |
36 | 36 | }; |
37 | 37 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $haystack = Itertools\iterable($haystack)->values(); |
66 | 66 | } |
67 | 67 | $strategy = conversions\mixed_to_value_getter($strategy); |
68 | - return function ($value, $key = null) use ($haystack, $strategy, $strict) { |
|
68 | + return function($value, $key = null) use ($haystack, $strategy, $strict) { |
|
69 | 69 | return in_array($strategy($value, $key), $haystack, $strict); |
70 | 70 | }; |
71 | 71 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $haystack = Itertools\iterable($haystack)->values(); |
90 | 90 | } |
91 | 91 | $strategy = conversions\mixed_to_value_getter($strategy); |
92 | - return function ($value, $key = null) use ($haystack, $strategy, $strict) { |
|
92 | + return function($value, $key = null) use ($haystack, $strategy, $strict) { |
|
93 | 93 | return !in_array($strategy($value, $key), $haystack, $strict); |
94 | 94 | }; |
95 | 95 | } |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | } |
122 | 122 | $strategy = conversions\mixed_to_value_getter($strategy); |
123 | 123 | if ($strict) { |
124 | - return function ($value, $key = null) use ($expected, $strategy) { |
|
124 | + return function($value, $key = null) use ($expected, $strategy) { |
|
125 | 125 | return $expected === $strategy($value, $key); |
126 | 126 | }; |
127 | 127 | } else { |
128 | - return function ($value, $key = null) use ($expected, $strategy) { |
|
128 | + return function($value, $key = null) use ($expected, $strategy) { |
|
129 | 129 | return $expected == $strategy($value, $key); |
130 | 130 | }; |
131 | 131 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | // Support DateTimeInterface |
153 | 153 | if ($expected instanceof \DateTimeInterface) { |
154 | - return function ($value, $key = null) use ($expected, $strategy, $orEqual) { |
|
154 | + return function($value, $key = null) use ($expected, $strategy, $orEqual) { |
|
155 | 155 | $value = $strategy($value, $key); |
156 | 156 | // Try to convert strings that look like ISO date format |
157 | 157 | if (is_string($value) && preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}/', $value)) { |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | |
167 | 167 | // Support numbers |
168 | 168 | if (is_int($expected) || is_float($expected)) { |
169 | - return function ($value, $key = null) use ($expected, $strategy, $orEqual) { |
|
169 | + return function($value, $key = null) use ($expected, $strategy, $orEqual) { |
|
170 | 170 | $value = $strategy($value, $key); |
171 | 171 | return (is_int($value) || is_float($value)) && ($orEqual ? $expected <= $value : $expected < $value); |
172 | 172 | }; |
173 | 173 | } |
174 | 174 | |
175 | 175 | // Everything else fails |
176 | - return function () { |
|
176 | + return function() { |
|
177 | 177 | return false; |
178 | 178 | }; |
179 | 179 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | // Support DateTimeInterface |
200 | 200 | if ($expected instanceof \DateTimeInterface) { |
201 | - return function ($value, $key = null) use ($expected, $strategy, $orEqual) { |
|
201 | + return function($value, $key = null) use ($expected, $strategy, $orEqual) { |
|
202 | 202 | $value = $strategy($value, $key); |
203 | 203 | // Try to convert strings that look like ISO date format |
204 | 204 | if (is_string($value) && preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}/', $value)) { |
@@ -213,14 +213,14 @@ discard block |
||
213 | 213 | |
214 | 214 | // Support numbers |
215 | 215 | if (is_int($expected) || is_float($expected)) { |
216 | - return function ($value, $key = null) use ($expected, $strategy, $orEqual) { |
|
216 | + return function($value, $key = null) use ($expected, $strategy, $orEqual) { |
|
217 | 217 | $value = $strategy($value, $key); |
218 | 218 | return (is_int($value) || is_float($value)) && ($orEqual ? $expected >= $value : $expected > $value); |
219 | 219 | }; |
220 | 220 | } |
221 | 221 | |
222 | 222 | // Everything else fails |
223 | - return function () { |
|
223 | + return function() { |
|
224 | 224 | return false; |
225 | 225 | }; |
226 | 226 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | function not($strategy = null) |
241 | 241 | { |
242 | 242 | $strategy = conversions\mixed_to_value_getter($strategy); |
243 | - return function ($value, $key = null) use ($strategy) { |
|
243 | + return function($value, $key = null) use ($strategy) { |
|
244 | 244 | return !($strategy($value, $key)); |
245 | 245 | }; |
246 | 246 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | $strategy = conversions\mixed_to_value_getter($strategy); |
268 | - return function ($value, $key = null) use ($pattern, $strategy) { |
|
268 | + return function($value, $key = null) use ($pattern, $strategy) { |
|
269 | 269 | return (bool)preg_match($pattern, $strategy($value, $key)); |
270 | 270 | }; |
271 | 271 | } |