Passed
Push — develop ( 715668...400ecc )
by Glynn
03:57 queued 01:03
created
src/procedural.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
 declare(strict_types=1);
25 25
 
26
-if (! function_exists('stringContains')) {
26
+if (!function_exists('stringContains')) {
27 27
     /**
28 28
      * Checks if a string contains a sub string
29 29
      *
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     }
38 38
 }
39 39
 
40
-if (! function_exists('array_flatten')) {
40
+if (!function_exists('array_flatten')) {
41 41
     /**
42 42
      * Flattens an array to desired depth.
43 43
      * doesn't preserve keys
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         return array_reduce(
52 52
             $array,
53
-            function (array $carry, $element) use ($n): array {
53
+            function(array $carry, $element) use ($n) : array {
54 54
                 // Remove empty arrays.
55 55
                 if (is_array($element) && empty($element)) {
56 56
                     return $carry;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     }
70 70
 }
71 71
 
72
-if (! function_exists('toObject')) {
72
+if (!function_exists('toObject')) {
73 73
     /**
74 74
      * Simple mapper for turning arrays into stdClass objects.
75 75
      *
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     }
88 88
 }
89 89
 
90
-if (! function_exists('invokeCallable')) {
90
+if (!function_exists('invokeCallable')) {
91 91
     /**
92 92
      * Used to invoke a callable.
93 93
      *
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     }
102 102
 }
103 103
 
104
-if (! function_exists('isArrayAccess')) {
104
+if (!function_exists('isArrayAccess')) {
105 105
     /**
106 106
      * Checks if an array or an object which has array like access.
107 107
      *
Please login to merge, or discard this patch.
src/comparisons.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
      * @param mixed $b The values to compare with
46 46
      * @return bool
47 47
      */
48
-    return function ($b) use ($a): bool {
49
-        if (! sameScalar($b, $a)) {
48
+    return function($b) use ($a): bool {
49
+        if (!sameScalar($b, $a)) {
50 50
             return false;
51 51
         }
52 52
 
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
      * @param mixed $b The values to compare with
84 84
      * @return bool
85 85
      */
86
-    return function ($b) use ($a): bool {
87
-        return ! isEqualTo($a)($b);
86
+    return function($b) use ($a): bool {
87
+        return !isEqualTo($a)($b);
88 88
     };
89 89
 }
90 90
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
      * @param Number $b
102 102
      * @return bool
103 103
      */
104
-    return function ($b) use ($a): bool {
105
-        return isEqualIn(array( 'integer', 'double' ))(gettype($b))
104
+    return function($b) use ($a): bool {
105
+        return isEqualIn(array('integer', 'double'))(gettype($b))
106 106
             ? $a < $b : false;
107 107
     };
108 108
 }
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
      * @param mixed $b
121 121
      * @return bool
122 122
      */
123
-    return function ($b) use ($a): bool {
124
-        return isEqualIn(array( 'integer', 'double' ))(gettype($b))
123
+    return function($b) use ($a): bool {
124
+        return isEqualIn(array('integer', 'double'))(gettype($b))
125 125
             ? $a > $b : false;
126 126
     };
127 127
 }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      * @param Number $b The base value to compare with must be int or float.
140 140
      * @return bool
141 141
      */
142
-    return function ($b) use ($a): bool {
142
+    return function($b) use ($a): bool {
143 143
         return any(isEqualTo($a), isLessThan($a))($b);
144 144
     };
145 145
 }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      * @param Number $b
158 158
      * @return bool
159 159
      */
160
-    return function ($b) use ($a): bool {
160
+    return function($b) use ($a): bool {
161 161
         return any(isEqualTo($a), isGreaterThan($a))($b);
162 162
     };
163 163
 }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      * @param mixed[] $b The array of values which it could be
175 175
      * @return bool
176 176
      */
177
-    return function ($b) use ($a): ?bool {
177
+    return function($b) use ($a): ?bool {
178 178
         if (
179 179
             is_numeric($b) || is_bool($b) ||
180 180
             is_string($b) || is_array($b)
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             return in_array(
185 185
                 (array) $b,
186 186
                 array_map(
187
-                    function ($e): array {
187
+                    function($e): array {
188 188
                         return (array) $e;
189 189
                     },
190 190
                     $a
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
  */
207 207
 function notEmpty($value): bool
208 208
 {
209
-    return ! empty($value);
209
+    return !empty($value);
210 210
 }
211 211
 
212 212
 /**
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
      * @param mixed $value
222 222
      * @return bool
223 223
      */
224
-    return function ($value) use ($callables): bool {
224
+    return function($value) use ($callables): bool {
225 225
         return (bool) array_reduce(
226 226
             $callables,
227
-            function ($result, $callable) use ($value) {
227
+            function($result, $callable) use ($value) {
228 228
                 return (is_bool($result) && $result === false) ? false : $callable($value);
229 229
             },
230 230
             null
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
      * @param mixed $value
245 245
      * @return bool
246 246
      */
247
-    return function ($value) use ($callables): bool {
247
+    return function($value) use ($callables): bool {
248 248
         return (bool) array_reduce(
249 249
             $callables,
250
-            function ($result, $callable) use ($value) {
250
+            function($result, $callable) use ($value) {
251 251
                 return (is_bool($result) && $result === true) ? true : $callable($value);
252 252
             },
253 253
             null
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      * @param mixed $value
268 268
      * @return bool
269 269
      */
270
-    return function ($value) use ($source) {
270
+    return function($value) use ($source) {
271 271
         return gettype($value) === $source;
272 272
     };
273 273
 }
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 function allTrue(bool ...$variables): bool
299 299
 {
300 300
     foreach ($variables as $value) {
301
-        if (! is_bool($value) || $value !== true) {
301
+        if (!is_bool($value) || $value !== true) {
302 302
             return false;
303 303
         }
304 304
     }
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
      * @param mixed $value
389 389
      * @return bool
390 390
      */
391
-    return function ($value) use ($callable): bool {
392
-        return ! (bool) $callable($value);
391
+    return function($value) use ($callable): bool {
392
+        return !(bool) $callable($value);
393 393
     };
394 394
 }
Please login to merge, or discard this patch.
src/general.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -264,7 +264,7 @@
 block discarded – undo
264 264
  * Only works for public or dynamic properties.
265 265
  *
266 266
  * @param array<string,mixed>|ArrayObject<string,mixed>|object $store
267
-     * @param string $property The property key.
267
+ * @param string $property The property key.
268 268
  * @return Closure(mixed):(array<string,mixed>|ArrayObject<string,mixed>|object)
269 269
  */
270 270
 function setProperty($store, string $property): Closure
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @param mixed The value passed into the functions
50 50
      * @return mixed The final result.
51 51
      */
52
-    return function ($e) use ($callables) {
52
+    return function($e) use ($callables) {
53 53
         foreach ($callables as $callable) {
54 54
             $e = $callable($e);
55 55
         }
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      * @param mixed The value passed into the functions
71 71
      * @return mixed The final result.
72 72
      */
73
-    return function ($e) use ($callables) {
73
+    return function($e) use ($callables) {
74 74
         foreach (\array_reverse($callables) as $callable) {
75 75
             $e = $callable($e);
76 76
         }
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
      * @param mixed The value passed into the functions
92 92
      * @return mixed|null The final result or null.
93 93
      */
94
-    return function ($e) use ($callables) {
94
+    return function($e) use ($callables) {
95 95
         foreach ($callables as $callable) {
96
-            if (! is_null($e)) {
96
+            if (!is_null($e)) {
97 97
                 $e = $callable($e);
98 98
             }
99 99
         }
@@ -116,17 +116,17 @@  discard block
 block discarded – undo
116 116
      * @param mixed $e The value being passed through the functions.
117 117
      * @return mixed The final result.
118 118
      */
119
-    return function ($e) use ($validator, $callables) {
119
+    return function($e) use ($validator, $callables) {
120 120
         foreach ($callables as $callable) {
121 121
             // If invalid, abort and return null
122
-            if (! $validator($e)) {
122
+            if (!$validator($e)) {
123 123
                 return null;
124 124
             }
125 125
             // Run through callable.
126 126
             $e = $callable($e);
127 127
 
128 128
             // Check results and bail if invalid type.
129
-            if (! $validator($e)) {
129
+            if (!$validator($e)) {
130 130
                 return null;
131 131
             }
132 132
         }
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
      * @param mixed $data The array or object to attempt to get param.
173 173
      * @return mixed|null
174 174
      */
175
-    return function ($data) use ($property) {
175
+    return function($data) use ($property) {
176 176
         if (is_array($data)) {
177
-            return array_key_exists($property, $data) ? $data[ $property ] : null;
177
+            return array_key_exists($property, $data) ? $data[$property] : null;
178 178
         } elseif (is_object($data)) {
179 179
             return property_exists($data, $property) ? $data->{$property} : null;
180 180
         } else {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      * @param mixed[]|object $data The array or object to attempt to get param.
198 198
      * @return mixed|null
199 199
      */
200
-    return function ($data) use ($nodes) {
200
+    return function($data) use ($nodes) {
201 201
         foreach ($nodes as $node) {
202 202
             $data = getProperty($node)($data);
203 203
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      * @param mixed $data The array or object to attempt to get param.
223 223
      * @return mixed|null
224 224
      */
225
-    return function ($data) use ($property): bool {
225
+    return function($data) use ($property): bool {
226 226
         if (is_array($data)) {
227 227
             return array_key_exists($property, $data);
228 228
         } elseif (is_object($data)) {
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
      * @param mixed $data The array or object to attempt to get param.
248 248
      * @return bool
249 249
      */
250
-    return function ($data) use ($property, $value): bool {
250
+    return function($data) use ($property, $value): bool {
251 251
         return pipe(
252 252
             $data,
253 253
             getProperty($property),
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 {
273 273
 
274 274
     // If passed store is not an array or object, throw exception.
275
-    if (! isArrayAccess($store) && ! is_object($store)) {
275
+    if (!isArrayAccess($store) && !is_object($store)) {
276 276
         throw new TypeError('Only objects or arrays can be constructed using setProperty.');
277 277
     }
278 278
 
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
      * @param mixed $value The value to set to keu.
281 281
      * @return array<string,mixed>|ArrayObject<string,mixed>|object The datastore.
282 282
      */
283
-    return function ($value) use ($store, $property) {
283
+    return function($value) use ($store, $property) {
284 284
         if (isArrayAccess($store)) {
285 285
             /** @phpstan-ignore-next-line */
286
-            $store[ $property ] = $value;
286
+            $store[$property] = $value;
287 287
         } else {
288 288
             $store->{$property} = $value;
289 289
         }
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
      * @param mixed $data The data to pass through the callable
307 307
      * @return array
308 308
      */
309
-    return function ($data) use ($key, $value): array {
310
-        return array( $key => $value($data) );
309
+    return function($data) use ($key, $value): array {
310
+        return array($key => $value($data));
311 311
     };
312 312
 }
313 313
 
@@ -324,12 +324,12 @@  discard block
 block discarded – undo
324 324
      * @param callable(mixed):mixed ...$encoders encodeProperty() functions.
325 325
      * @return Closure
326 326
      */
327
-    return function (...$encoders) use ($dataType): Closure {
327
+    return function(...$encoders) use ($dataType): Closure {
328 328
         /**
329 329
          * @param mixed $data The data to pass through the encoders.
330 330
          * @return array<string,mixed>|object The encoded object/array.
331 331
          */
332
-        return function ($data) use ($dataType, $encoders) {
332
+        return function($data) use ($dataType, $encoders) {
333 333
             foreach ($encoders as $encoder) {
334 334
                 $key = array_keys($encoder($data))[0];
335 335
                 // throw exception if key is int
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
      * @param mixed ...$args
357 357
      * @return mixed
358 358
      */
359
-    return function (...$args) use ($fn) {
359
+    return function(...$args) use ($fn) {
360 360
         return $fn(...$args);
361 361
     };
362 362
 }
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
      * @param mixed $ignored Any values can be passed and ignored.
374 374
      * @return mixed
375 375
      */
376
-    return function (...$ignored) use ($value) {
376
+    return function(...$ignored) use ($value) {
377 377
         return $value;
378 378
     };
379 379
 }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
      * @param  mixed $value
409 409
      * @return mixed
410 410
      */
411
-    return function ($value) use ($condition, $then) {
411
+    return function($value) use ($condition, $then) {
412 412
         return true === (bool) $condition($value)
413 413
             ? $then($value)
414 414
             : $value;
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
      * @param  mixed $value
432 432
      * @return mixed
433 433
      */
434
-    return function ($value) use ($condition, $then, $else) {
434
+    return function($value) use ($condition, $then, $else) {
435 435
         return true === (bool) $condition($value)
436 436
             ? $then($value)
437 437
             : $else($value);
Please login to merge, or discard this patch.
src/arrays.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param mixed $value Adds value start of array.
47 47
      * @return array New array with value on head.
48 48
      */
49
-    return function ($value) use ($array): array {
49
+    return function($value) use ($array): array {
50 50
         array_unshift($array, $value);
51 51
         return $array;
52 52
     };
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * @param mixed $value Adds value end of array.
65 65
      * @return array<int|string, mixed> New array with value on tail.
66 66
      */
67
-    return function ($value) use ($array): array {
67
+    return function($value) use ($array): array {
68 68
         $array[] = $value;
69 69
         return $array;
70 70
     };
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
  */
79 79
 function head(array $array)
80 80
 {
81
-    return ! empty($array) ? array_values($array)[0] : null;
81
+    return !empty($array) ? array_values($array)[0] : null;
82 82
 }
83 83
 
84 84
 /**
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
  */
90 90
 function tail(array $array)
91 91
 {
92
-    return ! empty($array) ? array_reverse($array, false)[0] : null;
92
+    return !empty($array) ? array_reverse($array, false)[0] : null;
93 93
 }
94 94
 
95 95
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      * @param array<int|string, mixed> $array Array join
107 107
      * @return string.
108 108
      */
109
-    return function (array $array) use ($glue): string {
109
+    return function(array $array) use ($glue) : string {
110 110
         return $glue ? \join($glue, $array) : \join($array);
111 111
     };
112 112
 }
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
 function zip(array $additional, $default = null): Closure
123 123
 {
124 124
     $additional = array_values($additional);
125
-    return function (array $array) use ($additional, $default) {
125
+    return function(array $array) use ($additional, $default) {
126 126
         $array = array_values($array);
127 127
         return array_reduce(
128 128
             array_keys($array),
129
-            function ($carry, $key) use ($array, $additional, $default): array {
129
+            function($carry, $key) use ($array, $additional, $default): array {
130 130
                 $carry[] = array(
131
-                    $array[ $key ],
132
-                    array_key_exists($key, $additional) ? $additional[ $key ] : $default,
131
+                    $array[$key],
132
+                    array_key_exists($key, $additional) ? $additional[$key] : $default,
133 133
                 );
134 134
                 return $carry;
135 135
             },
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
      * @param mixed $value Adds value to inner array if value set, else returns.
160 160
      * @return mixed[]|Closure
161 161
      */
162
-    return function ($value = null) use ($inital) {
162
+    return function($value = null) use ($inital) {
163 163
         if ($value) {
164 164
             $inital[] = $value;
165 165
         }
166
-        return ! is_null($value) ? arrayCompiler($inital) : $inital;
166
+        return !is_null($value) ? arrayCompiler($inital) : $inital;
167 167
     };
168 168
 }
169 169
 
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
      * @param mixed $value
185 185
      * @return mixed[]|Closure
186 186
      */
187
-    return function ($value = null) use ($validator, $inital) {
188
-        if (! is_null($value) && $validator($value)) {
187
+    return function($value = null) use ($validator, $inital) {
188
+        if (!is_null($value) && $validator($value)) {
189 189
             $inital[] = $value;
190 190
         }
191
-        return ! is_null($value) ? arrayCompilerTyped($validator, $inital) : $inital;
191
+        return !is_null($value) ? arrayCompilerTyped($validator, $inital) : $inital;
192 192
     };
193 193
 }
194 194
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      * @param array<int|string, mixed> $source Array to filter
214 214
      * @return array<int|string, mixed> Filtered array.
215 215
      */
216
-    return function (array $source) use ($callable): array {
216
+    return function(array $source) use ($callable): array {
217 217
         return array_filter($source, $callable);
218 218
     };
219 219
 }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      * @param array<int|string, mixed> $source Array to filter
231 231
      * @return array<int|string, mixed> Filtered array.
232 232
      */
233
-    return function (array $source) use ($callable): array {
233
+    return function(array $source) use ($callable): array {
234 234
         return array_filter($source, $callable, \ARRAY_FILTER_USE_KEY);
235 235
     };
236 236
 }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      * @param array<int|string, mixed> $source Array to filter
250 250
      * @return array<int|string, mixed> Filtered array.
251 251
      */
252
-    return function (array $source) use ($callables): array {
252
+    return function(array $source) use ($callables): array {
253 253
         return array_filter($source, Comp\groupAnd(...$callables));
254 254
     };
255 255
 }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
      * @param array<int|string, mixed> $source Array to filter
268 268
      * @return array<int|string, mixed> Filtered array.
269 269
      */
270
-    return function (array $source) use ($callables): array {
270
+    return function(array $source) use ($callables): array {
271 271
         return array_filter($source, Comp\groupOr(...$callables));
272 272
     };
273 273
 }
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
      * @param array<int|string, mixed> $array The array to filter
285 285
      * @return mixed|null The first element from the filtered array or null if filter returns empty
286 286
      */
287
-    return function (array $array) use ($func) {
287
+    return function(array $array) use ($func) {
288 288
         return head(array_filter($array, $func));
289 289
     };
290 290
 }
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
      * @param array<int|string, mixed> $array The array to filter
302 302
      * @return mixed|null The last element from the filtered array.
303 303
      */
304
-    return function (array $array) use ($func) {
304
+    return function(array $array) use ($func) {
305 305
         return tail(array_filter($array, $func));
306 306
     };
307 307
 }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
      * @param array<int|string, mixed> $array The array to filter then map.
322 322
      * @return array<int|string, mixed>
323 323
      */
324
-    return function (array $array) use ($filter, $map): array {
324
+    return function(array $array) use ($filter, $map): array {
325 325
         return array_map($map, array_filter($array, $filter));
326 326
     };
327 327
 }
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
      * @param array<int|string, mixed> $array
339 339
      * @return int Count
340 340
      */
341
-    return function (array $array) use ($function) {
341
+    return function(array $array) use ($function) {
342 342
         return count(array_filter($array, $function));
343 343
     };
344 344
 }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
      * @param mixed[] $array
358 358
      * @return array{0:mixed[], 1:mixed[]}
359 359
      */
360
-    return function (array $array) use ($function): array {
360
+    return function(array $array) use ($function): array {
361 361
         return array_reduce(
362 362
             $array,
363 363
             /**
@@ -365,12 +365,12 @@  discard block
 block discarded – undo
365 365
              * @param mixed $element
366 366
              * @return array{0:mixed[], 1:mixed[]}
367 367
              */
368
-            function ($carry, $element) use ($function): array {
368
+            function($carry, $element) use ($function): array {
369 369
                 $key             = (bool) $function($element) ? 1 : 0;
370
-                $carry[ $key ][] = $element;
370
+                $carry[$key][] = $element;
371 371
                 return $carry;
372 372
             },
373
-            array( array(), array() )
373
+            array(array(), array())
374 374
         );
375 375
     };
376 376
 }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
      * @param mixed[] $array The array to map
400 400
      * @return mixed[]
401 401
      */
402
-    return function (array $array) use ($func): array {
402
+    return function(array $array) use ($func): array {
403 403
         return array_map($func, $array);
404 404
     };
405 405
 }
@@ -417,11 +417,11 @@  discard block
 block discarded – undo
417 417
      * @param mixed[] $array The array to map
418 418
      * @return mixed[]
419 419
      */
420
-    return function (array $array) use ($func): array {
420
+    return function(array $array) use ($func): array {
421 421
         return array_reduce(
422 422
             array_keys($array),
423
-            function ($carry, $key) use ($func, $array) {
424
-                $carry[ $func($key) ] = $array[ $key ];
423
+            function($carry, $key) use ($func, $array) {
424
+                $carry[$func($key)] = $array[$key];
425 425
                 return $carry;
426 426
             },
427 427
             array()
@@ -442,9 +442,9 @@  discard block
 block discarded – undo
442 442
      * @param mixed[] $array The array to map
443 443
      * @return mixed[]
444 444
      */
445
-    return function (array $array) use ($func, $data): array {
445
+    return function(array $array) use ($func, $data): array {
446 446
         return array_map(
447
-            function ($e) use ($data, $func) {
447
+            function($e) use ($data, $func) {
448 448
                 return $func($e, ...$data);
449 449
             },
450 450
             $array
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
      * @param mixed[] $array
466 466
      * @return mixed[]
467 467
      */
468
-    return function (array $array) use ($n, $function): array {
468
+    return function(array $array) use ($n, $function) : array {
469 469
         return array_reduce(
470 470
             $array,
471 471
             /**
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
              * @param mixed $element
474 474
              * @return mixed[]
475 475
              */
476
-            function (array $carry, $element) use ($n, $function): array {
476
+            function(array $carry, $element) use ($n, $function) : array {
477 477
                 if (is_array($element) && (is_null($n) || $n > 0)) {
478 478
                     $carry = array_merge($carry, flatMap($function, $n ? $n - 1 : null)($element));
479 479
                 } else {
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
      * @param mixed[] $array The array to be grouped
506 506
      * @return mixed[] Grouped array.
507 507
      */
508
-    return function (array $array) use ($function): array {
508
+    return function(array $array) use ($function): array {
509 509
         return array_reduce(
510 510
             $array,
511 511
             /**
@@ -513,8 +513,8 @@  discard block
 block discarded – undo
513 513
              * @param mixed $element
514 514
              * @return mixed[]
515 515
              */
516
-            function ($carry, $item) use ($function): array {
517
-                $carry[ call_user_func($function, $item) ][] = $item;
516
+            function($carry, $item) use ($function): array {
517
+                $carry[call_user_func($function, $item)][] = $item;
518 518
                 return $carry;
519 519
             },
520 520
             array()
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
      * @param mixed[] $array Array to chunk
536 536
      * @return mixed[]
537 537
      */
538
-    return function (array $array) use ($count, $preserveKeys): array {
538
+    return function(array $array) use ($count, $preserveKeys): array {
539 539
         return array_chunk($array, max(1, $count), $preserveKeys);
540 540
     };
541 541
 }
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
      * @param mixed[] $array
554 554
      * @return mixed[]
555 555
      */
556
-    return function (array $array) use ($column, $key): array {
556
+    return function(array $array) use ($column, $key) : array {
557 557
         return array_column($array, $column, $key);
558 558
     };
559 559
 }
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
      * @param mixed[] $array Array to flatten
571 571
      * @return mixed[]
572 572
      */
573
-    return function (array $array) use ($n): array {
573
+    return function(array $array) use ($n) : array {
574 574
         return array_reduce(
575 575
             $array,
576 576
             /**
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
              * @param mixed|mixed[] $element
579 579
              * @return array<int|string, mixed>
580 580
              */
581
-            function (array $carry, $element) use ($n): array {
581
+            function(array $carry, $element) use ($n) : array {
582 582
                 // Remove empty arrays.
583 583
                 if (is_array($element) && empty($element)) {
584 584
                     return $carry;
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
      * @param mixed[] $array The array to have elements replaced from.
610 610
      * @return mixed[] Array with replacements.
611 611
      */
612
-    return function (array $array) use ($with): array {
612
+    return function(array $array) use ($with): array {
613 613
         return array_replace_recursive($array, ...$with);
614 614
     };
615 615
 }
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
      * @param mixed[] $array The array to have elements replaced from.
627 627
      * @return mixed[] Array with replacements.
628 628
      */
629
-    return function (array $array) use ($with): array {
629
+    return function(array $array) use ($with): array {
630 630
         return array_replace($array, ...$with);
631 631
     };
632 632
 }
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
      * @param mixed[] $array Array to do sum() on.
644 644
      * @return Number The total.
645 645
      */
646
-    return function (array $array) use ($function) {
646
+    return function(array $array) use ($function) {
647 647
         return array_sum(array_map($function, $array));
648 648
     };
649 649
 }
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
      * @param mixed[] $array
665 665
      * @return object
666 666
      */
667
-    return function (array $array) use ($object): object {
667
+    return function(array $array) use ($object): object {
668 668
         foreach ($array as $key => $value) {
669 669
             $key            = is_string($key) ? $key : (string) $key;
670 670
             $object->{$key} = $value;
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
      * @param mixed $data
693 693
      * @return string|null
694 694
      */
695
-    return function ($data) use ($flags, $depth): ?string {
695
+    return function($data) use ($flags, $depth): ?string {
696 696
         return \json_encode($data, $flags, max(1, $depth)) ?: null;
697 697
     };
698 698
 }
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
      *  @param mixed[]$array The array to sort
719 719
      *  @return mixed[] The sorted array (new array)
720 720
      */
721
-    return function (array $array) use ($flag) {
721
+    return function(array $array) use ($flag) {
722 722
         \sort($array, $flag);
723 723
         return $array;
724 724
     };
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
      *  @param mixed[]$array The array to sort
738 738
      *  @return mixed[] The sorted array (new array)
739 739
      */
740
-    return function (array $array) use ($flag) {
740
+    return function(array $array) use ($flag) {
741 741
         \rsort($array, $flag);
742 742
         return $array;
743 743
     };
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
      *  @param mixed[]$array The array to sort
757 757
      *  @return mixed[] The sorted array (new array)
758 758
      */
759
-    return function (array $array) use ($flag) {
759
+    return function(array $array) use ($flag) {
760 760
         \ksort($array, $flag);
761 761
         return $array;
762 762
     };
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
      *  @param mixed[]$array The array to sort
775 775
      *  @return mixed[] The sorted array (new array)
776 776
      */
777
-    return function (array $array) use ($flag) {
777
+    return function(array $array) use ($flag) {
778 778
         \krsort($array, $flag);
779 779
         return $array;
780 780
     };
@@ -793,7 +793,7 @@  discard block
 block discarded – undo
793 793
      *  @param mixed[]$array The array to sort
794 794
      *  @return mixed[] The sorted array (new array)
795 795
      */
796
-    return function (array $array) use ($flag) {
796
+    return function(array $array) use ($flag) {
797 797
         \asort($array, $flag);
798 798
         return $array;
799 799
     };
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
      *  @param mixed[]$array The array to sort
813 813
      *  @return mixed[] The sorted array (new array)
814 814
      */
815
-    return function (array $array) use ($flag) {
815
+    return function(array $array) use ($flag) {
816 816
         \arsort($array, $flag);
817 817
         return $array;
818 818
     };
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
      *  @param mixed[]$array The array to sort
830 830
      *  @return mixed[] The sorted array (new array)
831 831
      */
832
-    return function (array $array) {
832
+    return function(array $array) {
833 833
         \natsort($array);
834 834
         return $array;
835 835
     };
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
      *  @param mixed[]$array The array to sort
847 847
      *  @return mixed[] The sorted array (new array)
848 848
      */
849
-    return function (array $array) {
849
+    return function(array $array) {
850 850
         \natcasesort($array);
851 851
         return $array;
852 852
     };
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
      *  @param mixed[] $array The array to sort
865 865
      *  @return mixed[] The sorted array (new array)
866 866
      */
867
-    return function (array $array) use ($function) {
867
+    return function(array $array) use ($function) {
868 868
         \uksort($array, $function);
869 869
         return $array;
870 870
     };
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
      *  @param mixed[]$array The array to sort
884 884
      *  @return mixed[] The sorted array (new array)
885 885
      */
886
-    return function (array $array) use ($function) {
886
+    return function(array $array) use ($function) {
887 887
         \uasort($array, $function);
888 888
         return $array;
889 889
     };
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
      *  @param mixed[]$array The array to sort
904 904
      *  @return mixed[] The sorted array (new array)
905 905
      */
906
-    return function (array $array) use ($function) {
906
+    return function(array $array) use ($function) {
907 907
         \usort($array, $function);
908 908
         return $array;
909 909
     };
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
  */
919 919
 function scan(callable $function, $initialValue): Closure
920 920
 {
921
-    return function (array $array) use ($function, $initialValue) {
921
+    return function(array $array) use ($function, $initialValue) {
922 922
         $carry[] = $initialValue;
923 923
         foreach ($array as $key => $value) {
924 924
             $initialValue = $function($initialValue, $value);
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
  */
938 938
 function scanR(callable $function, $initialValue): Closure
939 939
 {
940
-    return function (array $array) use ($function, $initialValue) {
940
+    return function(array $array) use ($function, $initialValue) {
941 941
         $carry[] = $initialValue;
942 942
         foreach (array_reverse($array) as $key => $value) {
943 943
             $initialValue = $function($initialValue, $value);
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
      * @param mixed[] $array
961 961
      * @return mixed
962 962
      */
963
-    return function (array $array) use ($callable, $initial) {
963
+    return function(array $array) use ($callable, $initial) {
964 964
         return array_reduce($array, $callable, $initial);
965 965
     };
966 966
 }
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
      * @param mixed[] $array
979 979
      * @return mixed
980 980
      */
981
-    return function (array $array) use ($callable, $initial) {
981
+    return function(array $array) use ($callable, $initial) {
982 982
         return array_reduce(\array_reverse($array), $callable, $initial);
983 983
     };
984 984
 }
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
      * @param mixed[] $array
998 998
      * @return mixed
999 999
      */
1000
-    return function (array $array) use ($callable, $initial) {
1000
+    return function(array $array) use ($callable, $initial) {
1001 1001
         foreach ($array as $key => $value) {
1002 1002
             $initial = $callable($initial, $key, $value);
1003 1003
         }
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
      * @param mixed[] $array
1024 1024
      * @return mixed[]
1025 1025
      */
1026
-    return function (array $array) use ($count) {
1026
+    return function(array $array) use ($count) {
1027 1027
         return \array_slice($array, 0, $count);
1028 1028
     };
1029 1029
 }
@@ -1044,7 +1044,7 @@  discard block
 block discarded – undo
1044 1044
 
1045 1045
     // If count is 0, return an empty array
1046 1046
     if ($count === 0) {
1047
-        return function (array $array) {
1047
+        return function(array $array) {
1048 1048
             return [];
1049 1049
         };
1050 1050
     }
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
      * @param mixed[] $array
1054 1054
      * @return mixed[]
1055 1055
      */
1056
-    return function (array $array) use ($count) {
1056
+    return function(array $array) use ($count) {
1057 1057
         return \array_slice($array, - $count);
1058 1058
     };
1059 1059
 }
@@ -1071,13 +1071,13 @@  discard block
 block discarded – undo
1071 1071
      * @param mixed[] $array
1072 1072
      * @return mixed[]
1073 1073
      */
1074
-    return function (array $array) use ($conditional) {
1074
+    return function(array $array) use ($conditional) {
1075 1075
         $carry = array();
1076 1076
         foreach ($array as $key => $value) {
1077 1077
             if (true === $conditional($value)) {
1078 1078
                 break;
1079 1079
             }
1080
-            $carry[ $key ] = $value;
1080
+            $carry[$key] = $value;
1081 1081
         }
1082 1082
         return $carry;
1083 1083
     };
@@ -1096,13 +1096,13 @@  discard block
 block discarded – undo
1096 1096
      * @param mixed[] $array
1097 1097
      * @return mixed[]
1098 1098
      */
1099
-    return function (array $array) use ($conditional) {
1099
+    return function(array $array) use ($conditional) {
1100 1100
         $carry = array();
1101 1101
         foreach ($array as $key => $value) {
1102 1102
             if (false === $conditional($value)) {
1103 1103
                 break;
1104 1104
             }
1105
-            $carry[ $key ] = $value;
1105
+            $carry[$key] = $value;
1106 1106
         }
1107 1107
         return $carry;
1108 1108
     };
Please login to merge, or discard this patch.
src/numbers.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param int|null $value
47 47
      * @return Closure(int|null):(Closure|int)|int
48 48
      */
49
-    return function (?int $value = null) use ($initial) {
49
+    return function(?int $value = null) use ($initial) {
50 50
         if ($value) {
51 51
             $initial += $value;
52 52
         }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      * @param float|null $value
67 67
      * @return Closure(float|null):(Closure|float)|float
68 68
      */
69
-    return function (?float $value = null) use ($initial) {
69
+    return function(?float $value = null) use ($initial) {
70 70
         if ($value) {
71 71
             $initial += $value;
72 72
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * @param Number $value
92 92
      * @return int|float
93 93
      */
94
-    return function ($value) use ($initial) {
94
+    return function($value) use ($initial) {
95 95
         return $initial + $value;
96 96
     };
97 97
 }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
      * @param Number $value
115 115
      * @return int|float
116 116
      */
117
-    return function ($value) use ($initial) {
117
+    return function($value) use ($initial) {
118 118
         return $value - $initial;
119 119
     };
120 120
 }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      * @param Number $value
138 138
      * @return Number
139 139
      */
140
-    return function ($value) use ($initial) {
140
+    return function($value) use ($initial) {
141 141
         return $value * $initial;
142 142
     };
143 143
 }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      * @param float $value
162 162
      * @return float
163 163
      */
164
-    return function ($value) use ($divisor): float {
164
+    return function($value) use ($divisor): float {
165 165
         return $value / $divisor;
166 166
     };
167 167
 }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      * @param float $value
184 184
      * @return float
185 185
      */
186
-    return function ($value) use ($dividend): float {
186
+    return function($value) use ($dividend): float {
187 187
         return $dividend / $value;
188 188
     };
189 189
 }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      * @param float $value
206 206
      * @return float
207 207
      */
208
-    return function ($value) use ($divisor): float {
208
+    return function($value) use ($divisor): float {
209 209
         return $value % $divisor;
210 210
     };
211 211
 }
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      * @param float $value
228 228
      * @return float
229 229
      */
230
-    return function ($value) use ($dividend): float {
230
+    return function($value) use ($dividend): float {
231 231
         return $dividend % $value;
232 232
     };
233 233
 }
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      * @return bool
251 251
      * @throws InvalidArgumentException If neither int or float passed.
252 252
      */
253
-    return function ($value) use ($multiple): bool {
253
+    return function($value) use ($multiple): bool {
254 254
         if (!C\isNumber($value)) {
255 255
             throw new \InvalidArgumentException(__FUNCTION__ . 'only accepts a Number (Float or Int)');
256 256
         }
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      * @return bool
278 278
      * @throws InvalidArgumentException If neither int or float passed.
279 279
      */
280
-    return function (int $value) use ($factor): bool {
280
+    return function(int $value) use ($factor): bool {
281 281
         // Return false if 0
282 282
         if ($value === 0) {
283 283
             return false;
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
      * @return float
307 307
      * @throws InvalidArgumentException If neither int or float passed.
308 308
      */
309
-    return function ($value) use ($precision): float {
309
+    return function($value) use ($precision): float {
310 310
         if (!C\isNumber($value)) {
311 311
             throw new \InvalidArgumentException("Num\\round() only accepts a valid Number ( Int|Float -> Float )");
312 312
         }
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
      * @return Number
333 333
      * @throws InvalidArgumentException If neither int or float passed.
334 334
      */
335
-    return function ($value) use ($exponent) {
335
+    return function($value) use ($exponent) {
336 336
         if (!C\isNumber($value)) {
337 337
             throw new \InvalidArgumentException('Num\\power() only accepts a valid Number ( Int|Float )');
338 338
         }
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
      * @return Number
359 359
      * @throws InvalidArgumentException If neither int or float passed.
360 360
      */
361
-    return function ($value) use ($root) {
361
+    return function($value) use ($root) {
362 362
         if (!C\isNumber($value)) {
363 363
             throw new \InvalidArgumentException('Num\\root() only accepts a valid Number ( Int|Float )');
364 364
         }
Please login to merge, or discard this patch.
src/strings.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * @param string $string
49 49
      * @return string
50 50
      */
51
-    return function (string $string) use ($opening, $closing): string {
51
+    return function(string $string) use ($opening, $closing) : string {
52 52
         return \sprintf('%s%s%s', $opening, $string, $closing ?? $opening);
53 53
     };
54 54
 }
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
      * @param string $string
69 69
      * @return string
70 70
      */
71
-    return function (string $string) use ($start, $finish): string {
72
-        return ! $finish
71
+    return function(string $string) use ($start, $finish) : string {
72
+        return !$finish
73 73
             ? substr($string, $start)
74 74
             : substr($string, $start, $finish);
75 75
     };
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      * @param string $string
88 88
      * @return string
89 89
      */
90
-    return function (string $string) use ($prepend): string {
90
+    return function(string $string) use ($prepend): string {
91 91
         return \sprintf('%s%s', $prepend, $string);
92 92
     };
93 93
 }
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      * @param string $string
105 105
      * @return string
106 106
      */
107
-    return function (string $string) use ($append): string {
107
+    return function(string $string) use ($append): string {
108 108
         return \sprintf('%s%s', $string, $append);
109 109
     };
110 110
 }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      * @param array<string, mixed> $values
122 122
      * @return string Will return original string if false.
123 123
      */
124
-    return function (array $values = array()) use ($template): string {
124
+    return function(array $values = array()) use ($template): string {
125 125
         return \vsprintf($template, $values);
126 126
     };
127 127
 }
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
      * @param string $replace value to replace with
139 139
      * @return Closure(string):string
140 140
      */
141
-    return function (string $replace) use ($find): Closure {
141
+    return function(string $replace) use ($find): Closure {
142 142
         /**
143 143
          * @param string $subject String to carry out find and replace.
144 144
          * @return string
145 145
          */
146
-        return function ($subject) use ($find, $replace): string {
146
+        return function($subject) use ($find, $replace): string {
147 147
             return \str_replace($find, $replace, $subject);
148 148
         };
149 149
     };
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @param string $source
163 163
      * @return string
164 164
      */
165
-    return function ($source) use ($find, $replace): string {
165
+    return function($source) use ($find, $replace): string {
166 166
         return \str_replace($find, $replace, $source);
167 167
     };
168 168
 }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      * @param string $string
182 182
      * @return string
183 183
      */
184
-    return function (string $string) use ($replace, $offset, $length): string {
184
+    return function(string $string) use ($replace, $offset, $length) : string {
185 185
         return $length
186 186
             ? \substr_replace($string, $replace, $offset, $length)
187 187
             : \substr_replace($string, $replace, $offset);
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
      * @param string $source
201 201
      * @return bool
202 202
      */
203
-    return function (string $source) use ($find): bool {
203
+    return function(string $source) use ($find): bool {
204 204
         return (\substr($source, 0, \strlen($find)) === $find);
205 205
     };
206 206
 }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
      * @param string $source
218 218
      * @return bool
219 219
      */
220
-    return function (string $source) use ($find): bool {
220
+    return function(string $source) use ($find): bool {
221 221
         if (\strlen($find) === 0) {
222 222
             return true;
223 223
         }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
      * @param string $haystack String to look in.
238 238
      * @return bool
239 239
      */
240
-    return function (string $haystack) use ($needle): bool {
240
+    return function(string $haystack) use ($needle): bool {
241 241
         return \stringContains($haystack, $needle);
242 242
     };
243 243
 }
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
      * @param string $source String to look in.
255 255
      * @return bool
256 256
      */
257
-    return function (string $source) use ($pattern): bool {
257
+    return function(string $source) use ($pattern): bool {
258 258
         return (bool) \preg_match($pattern, $source);
259 259
     };
260 260
 }
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
      * @param string $name
272 272
      * @return string[]
273 273
      */
274
-    return function (string $string) use ($pattern): ?array {
274
+    return function(string $string) use ($pattern): ?array {
275 275
         return \preg_split($pattern, $string) ?: null;
276 276
     };
277 277
 }
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
      * @param string|int|float $number
291 291
      * @return string
292 292
      */
293
-    return function ($number) use ($precision, $point, $thousands): string {
293
+    return function($number) use ($precision, $point, $thousands): string {
294 294
         return \is_numeric($number)
295 295
             ? \number_format((float) $number, (int) $precision, $point, $thousands)
296 296
             : '';
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      * @param string $string The string to have char, slash escaped.
312 312
      * @return string
313 313
      */
314
-    return function (string $string) use ($charList): string {
314
+    return function(string $string) use ($charList): string {
315 315
         return \addcslashes($string, $charList);
316 316
     };
317 317
 }
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
      * @param string $string The string to be split
329 329
      * @return array<int, string>
330 330
      */
331
-    return function (string $string) use ($length): array {
331
+    return function(string $string) use ($length): array {
332 332
         return \str_split($string, max(1, $length)) ?: array(); // @phpstan-ignore-line, inconsistent errors with differing php versions.
333 333
     };
334 334
 }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
      * @param string $string The string to be chunked
347 347
      * @return string
348 348
      */
349
-    return function (string $string) use ($length, $end): string {
349
+    return function(string $string) use ($length, $end): string {
350 350
         return \chunk_split($string, max(1, $length), $end);
351 351
     };
352 352
 }
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
      * @param string $string The string to be wrapped
366 366
      * @return string
367 367
      */
368
-    return function (string $string) use ($width, $break, $cut): string {
368
+    return function(string $string) use ($width, $break, $cut): string {
369 369
         return \wordwrap($string, $width, $break, $cut);
370 370
     };
371 371
 }
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 function countChars(int $mode = 1): Closure
381 381
 {
382 382
     // Throw an exception if the mode is not supported.
383
-    if (! in_array($mode, array( 0, 1, 2, 3, 4 ), true)) {
383
+    if (!in_array($mode, array(0, 1, 2, 3, 4), true)) {
384 384
         throw new \InvalidArgumentException('Invalid mode');
385 385
     }
386 386
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
      * @param string $string The string to have its char counted.
389 389
      * @return int[]|string
390 390
      */
391
-    return function (string $string) use ($mode) {
391
+    return function(string $string) use ($mode) {
392 392
         return \count_chars($string, $mode);
393 393
     };
394 394
 }
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
      * @param string $haystack
408 408
      * @return int
409 409
      */
410
-    return function (string $haystack) use ($needle, $offset, $length): int {
410
+    return function(string $haystack) use ($needle, $offset, $length) : int {
411 411
         return $length
412 412
             ? \substr_count($haystack, $needle, $offset, $length)
413 413
             : \substr_count($haystack, $needle, $offset);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
      * @param string $string The string to be trimmed
427 427
      * @return string
428 428
      */
429
-    return function (string $string) use ($mask): string {
429
+    return function(string $string) use ($mask): string {
430 430
         return \trim($string, $mask);
431 431
     };
432 432
 }
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
      * @param string $string The string to be trimmed
444 444
      * @return string
445 445
      */
446
-    return function (string $string) use ($mask): string {
446
+    return function(string $string) use ($mask): string {
447 447
         return \ltrim($string, $mask);
448 448
     };
449 449
 }
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
      * @param string $string The string to be trimmed
461 461
      * @return string
462 462
      */
463
-    return function (string $string) use ($mask): string {
463
+    return function(string $string) use ($mask): string {
464 464
         return \rtrim($string, $mask);
465 465
     };
466 466
 }
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
      * @param string $comparisonString The string to compare against base.
480 480
      * @return Number
481 481
      */
482
-    return function (string $comparisonString) use ($base, $asPc) {
482
+    return function(string $comparisonString) use ($base, $asPc) {
483 483
         $pc       = 0.00;
484 484
         $matching = similar_text($base, $comparisonString, $pc);
485 485
         return $asPc ? $pc : $matching;
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
      * @param string $comparisonString The string to act as the base.
501 501
      * @return Number
502 502
      */
503
-    return function (string $base) use ($comparisonString, $asPc) {
503
+    return function(string $base) use ($comparisonString, $asPc) {
504 504
         $pc       = 0.00;
505 505
         $matching = similar_text($base, $comparisonString, $pc);
506 506
         return $asPc ? $pc : $matching;
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
      * @param string $string The string to pad out.
522 522
      * @return string
523 523
      */
524
-    return function (string $string) use ($length, $padContent, $type): string {
524
+    return function(string $string) use ($length, $padContent, $type): string {
525 525
         return \str_pad($string, $length, $padContent, $type);
526 526
     };
527 527
 }
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
      * @param string $string The string to repeat
539 539
      * @return string
540 540
      */
541
-    return function (string $string) use ($count): string {
541
+    return function(string $string) use ($count): string {
542 542
         return \str_repeat($string, $count);
543 543
     };
544 544
 }
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
      * @param string $string The string to pad out.
557 557
      * @return int|string[]
558 558
      */
559
-    return function (string $string) use ($format, $charList) {
559
+    return function(string $string) use ($format, $charList) {
560 560
         return $charList
561 561
             ? (\str_word_count($string, $format, $charList) ?: 0)
562 562
             : (\str_word_count($string, $format) ?: 0);
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
      * @param string $string The string to strip tags from.
576 576
      * @return string
577 577
      */
578
-    return function (string $string) use ($allowedTags): string {
578
+    return function(string $string) use ($allowedTags) : string {
579 579
         return $allowedTags
580 580
             ? \strip_tags($string, $allowedTags)
581 581
             : \strip_tags($string);
@@ -592,13 +592,13 @@  discard block
 block discarded – undo
592 592
  */
593 593
 function firstPosition(string $needle, int $offset = 0, int $flags = STRINGS_CASE_SENSITIVE): Closure
594 594
 {
595
-    $caseSensitive = ! (bool) ($flags & STRINGS_CASE_INSENSITIVE); // Assumes true unless INSESNITVE passed
595
+    $caseSensitive = !(bool) ($flags & STRINGS_CASE_INSENSITIVE); // Assumes true unless INSESNITVE passed
596 596
 
597 597
     /**
598 598
      * @param string $haystack The haystack to look through.
599 599
      * @return int|null
600 600
      */
601
-    return function (string $haystack) use ($needle, $offset, $caseSensitive): ?int {
601
+    return function(string $haystack) use ($needle, $offset, $caseSensitive): ?int {
602 602
         $pos = $caseSensitive
603 603
             ? strpos($haystack, $needle, $offset)
604 604
             : stripos($haystack, $needle, $offset);
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
  */
617 617
 function lastPosition(string $needle, int $offset = 0, int $flags = STRINGS_CASE_SENSITIVE): Closure
618 618
 {
619
-    $caseSensitive = ! (bool) ($flags & STRINGS_CASE_INSENSITIVE); // Assumes true unless INSESNITVE passed
619
+    $caseSensitive = !(bool) ($flags & STRINGS_CASE_INSENSITIVE); // Assumes true unless INSESNITVE passed
620 620
 
621 621
     /**
622 622
      * @param string $haystack The haystack to look through.
623 623
      * @return int|null
624 624
      */
625
-    return function (string $haystack) use ($needle, $offset, $caseSensitive): ?int {
625
+    return function(string $haystack) use ($needle, $offset, $caseSensitive): ?int {
626 626
         $pos = $caseSensitive
627 627
             ? strrpos($haystack, $needle, $offset)
628 628
             : strripos($haystack, $needle, $offset);
@@ -644,13 +644,13 @@  discard block
 block discarded – undo
644 644
 
645 645
     // Decode flags, only look for none defaults.
646 646
     $beforeNeedle  = (bool) ($flags & STRINGS_BEFORE_NEEDLE);
647
-    $caseSensitive = ! (bool) ($flags & STRINGS_CASE_INSENSITIVE); // Assumes true unless INSESNITVE passed
647
+    $caseSensitive = !(bool) ($flags & STRINGS_CASE_INSENSITIVE); // Assumes true unless INSESNITVE passed
648 648
 
649 649
     /**
650 650
      * @param string $haystack The haystack to look through.
651 651
      * @return string
652 652
      */
653
-    return function (string $haystack) use ($needle, $beforeNeedle, $caseSensitive): string {
653
+    return function(string $haystack) use ($needle, $beforeNeedle, $caseSensitive): string {
654 654
         $result = $caseSensitive
655 655
             ? strstr($haystack, $needle, $beforeNeedle)
656 656
             : stristr($haystack, $needle, $beforeNeedle);
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
      * @param string $haystack
672 672
      * @return string
673 673
      */
674
-    return function (string $haystack) use ($chars): string {
674
+    return function(string $haystack) use ($chars): string {
675 675
         $result = strpbrk($haystack, $chars);
676 676
         return is_string($result) ? $result : '';
677 677
     };
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
      * @param string $haystack
691 691
      * @return string
692 692
      */
693
-    return function (string $haystack) use ($char): string {
693
+    return function(string $haystack) use ($char): string {
694 694
         $result = strrchr($haystack, $char);
695 695
         return is_string($result) ? $result : '';
696 696
     };
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
      * @param string $haystack
710 710
      * @return string
711 711
      */
712
-    return function (string $haystack) use ($dictionary): string {
712
+    return function(string $haystack) use ($dictionary): string {
713 713
         $result = strtr($haystack, $dictionary);
714 714
         return $result;
715 715
     };
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
      * @param string|null $value
740 740
      * @return Closure|string
741 741
      */
742
-    return function (?string $value = null) use ($initial) {
742
+    return function(?string $value = null) use ($initial) {
743 743
         if ($value) {
744 744
             $initial .= $value;
745 745
         }
Please login to merge, or discard this patch.
src/objects.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @param Class $value
61 61
      * @return bool
62 62
      */
63
-    return function ($value) use ($class): bool {
63
+    return function($value) use ($class): bool {
64 64
         if (is_object($value)) {
65 65
             $value = get_class($value);
66 66
         }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
      * @param Class $class
85 85
      * @return bool
86 86
      */
87
-    return function ($class) use ($interface): bool {
87
+    return function($class) use ($interface): bool {
88 88
         return in_array(
89 89
             $interface,
90 90
             class_implements($class, false) ?: array(),
@@ -105,18 +105,18 @@  discard block
 block discarded – undo
105 105
      * @param object $object
106 106
      * @return array<string, mixed>
107 107
      */
108
-    return function ($object): array {
108
+    return function($object): array {
109 109
 
110 110
         // If not object, return empty array.
111
-        if (! is_object($object)) {
111
+        if (!is_object($object)) {
112 112
             return array();
113 113
         }
114 114
 
115 115
         $objectVars = get_object_vars($object);
116 116
         return array_reduce(
117 117
             array_keys($objectVars),
118
-            function (array $array, $key) use ($objectVars): array {
119
-                $array[ ltrim((string) $key, '_') ] = $objectVars[ $key ];
118
+            function(array $array, $key) use ($objectVars): array {
119
+                $array[ltrim((string) $key, '_')] = $objectVars[$key];
120 120
                 return $array;
121 121
             },
122 122
             array()
Please login to merge, or discard this patch.