Passed
Pull Request — develop (#86)
by Glynn
02:44
created
src/objects.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     if (is_object($class)) {
53 53
         $class = get_class($class);
54 54
     }
55
-    if (! class_exists($class)) {
55
+    if (!class_exists($class)) {
56 56
         throw new InvalidArgumentException(__FUNCTION__ . 'only accepts a Class or Class Name');
57 57
     }
58 58
 
@@ -60,11 +60,11 @@  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
         }
67
-        if (! class_exists($value)) {
67
+        if (!class_exists($value)) {
68 68
             throw new InvalidArgumentException(__FUNCTION__ . 'only accepts a Class or Class Name');
69 69
         }
70 70
         return is_a($value, $class, true);
@@ -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()
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
      * @param object|class-string $object
139 139
      * @return bool
140 140
      */
141
-    return function ($object) use ($trait, $autoload): bool {
141
+    return function($object) use ($trait, $autoload): bool {
142 142
         // Throw type error if not object or class-string.
143
-        if (! is_object($object) && ! class_exists($object, false)) {
143
+        if (!is_object($object) && !class_exists($object, false)) {
144 144
             throw new InvalidArgumentException(__FUNCTION__ . ' only accepts an object or class-string');
145 145
         }
146 146
 
@@ -168,10 +168,10 @@  discard block
 block discarded – undo
168 168
     $constructorArgs = $constructor->getConstructor() ? $constructor->getConstructor()->getParameters() : array();
169 169
     $constructorArgs = array_reduce(
170 170
         $constructorArgs,
171
-        function (array $args, \ReflectionParameter $param) use ($baseProperties): array {
171
+        function(array $args, \ReflectionParameter $param) use ($baseProperties): array {
172 172
             // If the param exists in base properties use that, else use the default value or null.
173
-            $args[ $param->getName() ] = \array_key_exists($param->getName(), $baseProperties)
174
-                ? $baseProperties[ $param->getName() ]
173
+            $args[$param->getName()] = \array_key_exists($param->getName(), $baseProperties)
174
+                ? $baseProperties[$param->getName()]
175 175
                 : ($param->isDefaultValueAvailable()
176 176
                     ? $param->getDefaultValue()
177 177
                     : null);
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
      * @param array<string, mixed> $properties
186 186
      * @return Class
187 187
      */
188
-    return function (array $properties = array()) use ($class, $constructorArgs) {
188
+    return function(array $properties = array()) use ($class, $constructorArgs) {
189 189
         // Loop through constructorArgs and replace with any passed properties.
190 190
         $constructorArgs = array_reduce(
191 191
             array_keys($constructorArgs),
192
-            function (array $args, string $key) use ($constructorArgs, $properties): array {
192
+            function(array $args, string $key) use ($constructorArgs, $properties): array {
193 193
                 $args[] = \array_key_exists($key, $properties)
194
-                    ? $properties[ $key ]
195
-                    : $constructorArgs[ $key ];
194
+                    ? $properties[$key]
195
+                    : $constructorArgs[$key];
196 196
                 return $args;
197 197
             },
198 198
             array()
Please login to merge, or discard this patch.
src/numbers.php 1 patch
Spacing   +29 added lines, -29 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 (null !== $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 (null !== $value) {
71 71
             $initial += $value;
72 72
         }
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
  */
84 84
 function sum($initial = 0): Closure
85 85
 {
86
-    if (! C\isNumber($initial)) {
86
+    if (!C\isNumber($initial)) {
87 87
         throw new InvalidArgumentException(__FUNCTION__ . 'only accepts a Number (Float or Int)');
88 88
     }
89 89
 
@@ -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
 }
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
  */
107 107
 function subtract($initial = 0): Closure
108 108
 {
109
-    if (! C\isNumber($initial)) {
109
+    if (!C\isNumber($initial)) {
110 110
         throw new InvalidArgumentException(__FUNCTION__ . 'only accepts a Number (Float or Int)');
111 111
     }
112 112
 
@@ -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
 }
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
  */
130 130
 function multiply($initial = 1): Closure
131 131
 {
132
-    if (! C\isNumber($initial)) {
132
+    if (!C\isNumber($initial)) {
133 133
         throw new InvalidArgumentException(__FUNCTION__ . 'only accepts a Number (Float or Int)');
134 134
     }
135 135
 
@@ -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
 }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
  */
154 154
 function divideBy($divisor = 1): Closure
155 155
 {
156
-    if (! C\isNumber($divisor)) {
156
+    if (!C\isNumber($divisor)) {
157 157
         throw new \InvalidArgumentException(__FUNCTION__ . 'only accepts a Number (Float or Int)');
158 158
     }
159 159
 
@@ -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
 }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
  */
176 176
 function divideInto($dividend = 1): Closure
177 177
 {
178
-    if (! C\isNumber($dividend)) {
178
+    if (!C\isNumber($dividend)) {
179 179
         throw new \InvalidArgumentException(__FUNCTION__ . 'only accepts a Number (Float or Int)');
180 180
     }
181 181
 
@@ -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
 }
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
  */
198 198
 function remainderBy($divisor = 1): Closure
199 199
 {
200
-    if (! C\isNumber($divisor)) {
200
+    if (!C\isNumber($divisor)) {
201 201
         throw new \InvalidArgumentException(__FUNCTION__ . 'only accepts a Number (Float or Int)');
202 202
     }
203 203
 
@@ -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
 }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
  */
220 220
 function remainderInto($dividend = 1): Closure
221 221
 {
222
-    if (! C\isNumber($dividend)) {
222
+    if (!C\isNumber($dividend)) {
223 223
         throw new \InvalidArgumentException(__FUNCTION__ . 'only accepts a Number (Float or Int)');
224 224
     }
225 225
 
@@ -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
 }
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
  */
242 242
 function isMultipleOf($multiple): Closure
243 243
 {
244
-    if (! C\isNumber($multiple)) {
244
+    if (!C\isNumber($multiple)) {
245 245
         throw new \InvalidArgumentException(__FUNCTION__ . 'only accepts a Number (Float or Int)');
246 246
     }
247 247
 
@@ -250,8 +250,8 @@  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 {
254
-        if (! C\isNumber($value)) {
253
+    return function($value) use ($multiple): bool {
254
+        if (!C\isNumber($value)) {
255 255
             throw new \InvalidArgumentException(__FUNCTION__ . 'only accepts a Number (Float or Int)');
256 256
         }
257 257
 
@@ -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;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
  */
298 298
 function round($precision = 1): Closure
299 299
 {
300
-    if (! C\isNumber($precision)) {
300
+    if (!C\isNumber($precision)) {
301 301
         throw new \InvalidArgumentException(__FUNCTION__ . 'only accepts a Number (Float or Int)');
302 302
     }
303 303
 
@@ -306,8 +306,8 @@  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 {
310
-        if (! C\isNumber($value)) {
309
+    return function($value) use ($precision): float {
310
+        if (!C\isNumber($value)) {
311 311
             throw new \InvalidArgumentException("Num\\round() only accepts a valid Number ( Int|Float -> Float )");
312 312
         }
313 313
         return \round(\floatval($value), $precision);
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
  */
324 324
 function power($exponent): Closure
325 325
 {
326
-    if (! C\isNumber($exponent)) {
326
+    if (!C\isNumber($exponent)) {
327 327
         throw new \InvalidArgumentException(__FUNCTION__ . 'only accepts a Number (Float or Int) for the exponent');
328 328
     }
329 329
 
@@ -332,8 +332,8 @@  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) {
336
-        if (! C\isNumber($value)) {
335
+    return function($value) use ($exponent) {
336
+        if (!C\isNumber($value)) {
337 337
             throw new \InvalidArgumentException('Num\\power() only accepts a valid Number ( Int|Float )');
338 338
         }
339 339
         return \pow($value, $exponent);
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
  */
350 350
 function root($root): Closure
351 351
 {
352
-    if (! C\isNumber($root)) {
352
+    if (!C\isNumber($root)) {
353 353
         throw new \InvalidArgumentException(__FUNCTION__ . 'only accepts a Number (Float or Int) for the root');
354 354
     }
355 355
 
@@ -358,8 +358,8 @@  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) {
362
-        if (! C\isNumber($value)) {
361
+    return function($value) use ($root) {
362
+        if (!C\isNumber($value)) {
363 363
             throw new \InvalidArgumentException('Num\\root() only accepts a valid Number ( Int|Float )');
364 364
         }
365 365
         return pow($value, (1 / $root));
Please login to merge, or discard this patch.
src/procedural.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 use PinkCrab\FunctionConstructors\Arrays as Arr;
27 27
 
28
-if (! function_exists('stringContains')) {
28
+if (!function_exists('stringContains')) {
29 29
     /**
30 30
      * Checks if a string contains a sub string
31 31
      *
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     }
40 40
 }
41 41
 
42
-if (! function_exists('array_flatten')) {
42
+if (!function_exists('array_flatten')) {
43 43
     /**
44 44
      * Flattens an array to desired depth.
45 45
      * doesn't preserve keys
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     }
55 55
 }
56 56
 
57
-if (! function_exists('toObject')) {
57
+if (!function_exists('toObject')) {
58 58
     /**
59 59
      * Simple mapper for turning arrays into stdClass objects.
60 60
      *
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     }
68 68
 }
69 69
 
70
-if (! function_exists('invokeCallable')) {
70
+if (!function_exists('invokeCallable')) {
71 71
     /**
72 72
      * Used to invoke a callable.
73 73
      *
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     }
82 82
 }
83 83
 
84
-if (! function_exists('isArrayAccess')) {
84
+if (!function_exists('isArrayAccess')) {
85 85
     /**
86 86
      * Checks if an array or an object which has array like access.
87 87
      *
Please login to merge, or discard this patch.
src/constants.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
  * Constants used for Str\wordCount() => str_word_count()
33 33
  * https://www.php.net/manual/en/function.str-word-count.php
34 34
  */
35
-if (! defined('WORD_COUNT_NUMBER_OF_WORDS')) {
35
+if (!defined('WORD_COUNT_NUMBER_OF_WORDS')) {
36 36
     define('WORD_COUNT_NUMBER_OF_WORDS', 0);
37 37
 }
38
-if (! defined('WORD_COUNT_ARRAY')) {
38
+if (!defined('WORD_COUNT_ARRAY')) {
39 39
     define('WORD_COUNT_ARRAY', 1);
40 40
 }
41
-if (! defined('WORD_COUNT_ASSOCIATIVE_ARRAY')) {
41
+if (!defined('WORD_COUNT_ASSOCIATIVE_ARRAY')) {
42 42
     define('WORD_COUNT_ASSOCIATIVE_ARRAY', 2);
43 43
 }
44 44
 
@@ -46,36 +46,36 @@  discard block
 block discarded – undo
46 46
  * Constants used for Strings\countChars() => count_chars()
47 47
  * https://www.php.net/manual/en/function.count-chars.php
48 48
  */
49
-if (! defined('CHAR_COUNT_ARRAY')) {
49
+if (!defined('CHAR_COUNT_ARRAY')) {
50 50
     define('CHAR_COUNT_ARRAY', 0);
51 51
 }
52 52
 
53
-if (! defined('CHAR_COUNT_ARRAY_UNIQUE')) {
53
+if (!defined('CHAR_COUNT_ARRAY_UNIQUE')) {
54 54
     define('CHAR_COUNT_ARRAY_UNIQUE', 1);
55 55
 }
56 56
 
57
-if (! defined('CHAR_COUNT_ARRAY_UNUSED')) {
57
+if (!defined('CHAR_COUNT_ARRAY_UNUSED')) {
58 58
     define('CHAR_COUNT_ARRAY_UNUSED', 2);
59 59
 }
60 60
 
61
-if (! defined('CHAR_COUNT_STRING_UNIQUE')) {
61
+if (!defined('CHAR_COUNT_STRING_UNIQUE')) {
62 62
     define('CHAR_COUNT_STRING_UNIQUE', 3);
63 63
 }
64 64
 
65
-if (! defined('CHAR_COUNT_STRING_UNUSED')) {
65
+if (!defined('CHAR_COUNT_STRING_UNUSED')) {
66 66
     define('CHAR_COUNT_STRING_UNUSED', 4);
67 67
 }
68 68
 
69 69
 // String function flags
70
-if (! defined('STRINGS_CASE_INSENSITIVE')) {
70
+if (!defined('STRINGS_CASE_INSENSITIVE')) {
71 71
     define('STRINGS_CASE_INSENSITIVE', 0x1);
72 72
 }
73
-if (! defined('STRINGS_CASE_SENSITIVE')) {
73
+if (!defined('STRINGS_CASE_SENSITIVE')) {
74 74
     define('STRINGS_CASE_SENSITIVE', 0x2);
75 75
 }
76
-if (! defined('STRINGS_BEFORE_NEEDLE')) {
76
+if (!defined('STRINGS_BEFORE_NEEDLE')) {
77 77
     define('STRINGS_BEFORE_NEEDLE', 0x4);
78 78
 }
79
-if (! defined('STRINGS_AFTER_NEEDLE')) {
79
+if (!defined('STRINGS_AFTER_NEEDLE')) {
80 80
     define('STRINGS_AFTER_NEEDLE', 0x8);
81 81
 }
Please login to merge, or discard this patch.
src/comparisons.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  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 {
48
+    return function($b) use ($a): bool {
49 49
         if (!sameScalar($b, $a)) {
50 50
             return false;
51 51
         }
@@ -83,7 +83,7 @@  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 {
86
+    return function($b) use ($a): bool {
87 87
         return !isEqualTo($a)($b);
88 88
     };
89 89
 }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      * @param Number $b
102 102
      * @return bool
103 103
      */
104
-    return function ($b) use ($a): bool {
104
+    return function($b) use ($a): bool {
105 105
         return isEqualIn(array('integer', 'double'))(gettype($b))
106 106
             ? $a < $b : false;
107 107
     };
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
      * @param mixed $b
121 121
      * @return bool
122 122
      */
123
-    return function ($b) use ($a): bool {
123
+    return function($b) use ($a): bool {
124 124
         return isEqualIn(array('integer', 'double'))(gettype($b))
125 125
             ? $a > $b : false;
126 126
     };
@@ -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
@@ -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
 }
@@ -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 {
391
+    return function($value) use ($callable): bool {
392 392
         return !(bool) $callable($value);
393 393
     };
394 394
 }
Please login to merge, or discard this patch.
src/general.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      * @param mixed $e 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 $e 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,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * @param mixed $e 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 96
             if (!is_null($e)) {
97 97
                 $e = $callable($e);
@@ -116,7 +116,7 @@  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 122
             if (!$validator($e)) {
@@ -172,7 +172,7 @@  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 177
             return array_key_exists($property, $data) ? $data[$property] : null;
178 178
         } elseif (is_object($data)) {
@@ -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),
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
      * @param mixed $value The value to set to keu.
280 280
      * @return array<string,mixed>|ArrayObject<string,mixed>|object The datastore.
281 281
      */
282
-    return function ($value) use ($store, $property) {
282
+    return function($value) use ($store, $property) {
283 283
         if (isArrayAccess($store)) {
284 284
             /** @phpstan-ignore-next-line */
285 285
             $store[$property] = $value;
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      * @param mixed $data The data to pass through the callable
306 306
      * @return array
307 307
      */
308
-    return function ($data) use ($key, $value): array {
308
+    return function($data) use ($key, $value): array {
309 309
         return array($key => $value($data));
310 310
     };
311 311
 }
@@ -323,12 +323,12 @@  discard block
 block discarded – undo
323 323
      * @param callable(mixed):mixed ...$encoders encodeProperty() functions.
324 324
      * @return Closure
325 325
      */
326
-    return function (...$encoders) use ($dataType): Closure {
326
+    return function(...$encoders) use ($dataType): Closure {
327 327
         /**
328 328
          * @param mixed $data The data to pass through the encoders.
329 329
          * @return array<string,mixed>|object The encoded object/array.
330 330
          */
331
-        return function ($data) use ($dataType, $encoders) {
331
+        return function($data) use ($dataType, $encoders) {
332 332
             foreach ($encoders as $encoder) {
333 333
                 $key = array_keys($encoder($data))[0];
334 334
                 // throw exception if key is int
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
      * @param mixed ...$args
356 356
      * @return mixed
357 357
      */
358
-    return function (...$args) use ($fn) {
358
+    return function(...$args) use ($fn) {
359 359
         return $fn(...$args);
360 360
     };
361 361
 }
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
      * @param mixed $ignored Any values can be passed and ignored.
373 373
      * @return mixed
374 374
      */
375
-    return function (...$ignored) use ($value) {
375
+    return function(...$ignored) use ($value) {
376 376
         return $value;
377 377
     };
378 378
 }
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
      * @param  mixed $value
408 408
      * @return mixed
409 409
      */
410
-    return function ($value) use ($condition, $then) {
410
+    return function($value) use ($condition, $then) {
411 411
         return true === (bool) $condition($value)
412 412
             ? $then($value)
413 413
             : $value;
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
      * @param  mixed $value
431 431
      * @return mixed
432 432
      */
433
-    return function ($value) use ($condition, $then, $else) {
433
+    return function($value) use ($condition, $then, $else) {
434 434
         return true === (bool) $condition($value)
435 435
             ? $then($value)
436 436
             : $else($value);
Please login to merge, or discard this patch.
src/strings.php 1 patch
Spacing   +38 added lines, -38 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,7 +68,7 @@  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 {
71
+    return function(string $string) use ($start, $finish) : string {
72 72
         return !$finish
73 73
             ? substr($string, $start)
74 74
             : substr($string, $start, $finish);
@@ -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
 }
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
      * @param string $string The string to be split
330 330
      * @return array<int, string>
331 331
      */
332
-    return function (string $string) use ($separator, $limit): array {
332
+    return function(string $string) use ($separator, $limit): array {
333 333
         $chunks = explode($separator, $string, $limit);
334 334
         return is_array($chunks) ? $chunks : array(); // @phpstan-ignore-line, inconsistent errors with differing php versions.
335 335
     };
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
      * @param string $string The string to be split
348 348
      * @return array<int, string>
349 349
      */
350
-    return function (string $string) use ($length): array {
350
+    return function(string $string) use ($length): array {
351 351
         return \str_split($string, max(1, $length)) ?: array(); // @phpstan-ignore-line, inconsistent errors with differing php versions.
352 352
     };
353 353
 }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
      * @param string $string The string to be chunked
367 367
      * @return string
368 368
      */
369
-    return function (string $string) use ($length, $end): string {
369
+    return function(string $string) use ($length, $end): string {
370 370
         return \chunk_split($string, max(1, $length), $end);
371 371
     };
372 372
 }
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
      * @param string $string The string to be wrapped
386 386
      * @return string
387 387
      */
388
-    return function (string $string) use ($width, $break, $cut): string {
388
+    return function(string $string) use ($width, $break, $cut): string {
389 389
         return \wordwrap($string, $width, $break, $cut);
390 390
     };
391 391
 }
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
      * @param string $string The string to have its char counted.
409 409
      * @return int[]|string
410 410
      */
411
-    return function (string $string) use ($mode) {
411
+    return function(string $string) use ($mode) {
412 412
         return \count_chars($string, $mode);
413 413
     };
414 414
 }
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
      * @param string $haystack
428 428
      * @return int
429 429
      */
430
-    return function (string $haystack) use ($needle, $offset, $length): int {
430
+    return function(string $haystack) use ($needle, $offset, $length) : int {
431 431
         return $length
432 432
             ? \substr_count($haystack, $needle, $offset, $length)
433 433
             : \substr_count($haystack, $needle, $offset);
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
      * @param string $string The string to be trimmed
447 447
      * @return string
448 448
      */
449
-    return function (string $string) use ($mask): string {
449
+    return function(string $string) use ($mask): string {
450 450
         return \trim($string, $mask);
451 451
     };
452 452
 }
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
      * @param string $string The string to be trimmed
464 464
      * @return string
465 465
      */
466
-    return function (string $string) use ($mask): string {
466
+    return function(string $string) use ($mask): string {
467 467
         return \ltrim($string, $mask);
468 468
     };
469 469
 }
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
      * @param string $string The string to be trimmed
481 481
      * @return string
482 482
      */
483
-    return function (string $string) use ($mask): string {
483
+    return function(string $string) use ($mask): string {
484 484
         return \rtrim($string, $mask);
485 485
     };
486 486
 }
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
      * @param string $comparisonString The string to compare against base.
500 500
      * @return Number
501 501
      */
502
-    return function (string $comparisonString) use ($base, $asPc) {
502
+    return function(string $comparisonString) use ($base, $asPc) {
503 503
         $pc       = 0.00;
504 504
         $matching = similar_text($base, $comparisonString, $pc);
505 505
         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);
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 
579 579
     // If using pre php7.4, cast to string.
580 580
     if (version_compare(PHP_VERSION, '7.4.0', '<') && is_array($allowedTags)) {
581
-        $allowedTags = implode('', array_map(function ($tag) {
581
+        $allowedTags = implode('', array_map(function($tag) {
582 582
             return "<{$tag}>"; // @phpstan-ignore-line
583 583
         }, array_filter($allowedTags, 'is_string')));
584 584
     }
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
      * @param string $string The string to strip tags from.
591 591
      * @return string
592 592
      */
593
-    return function (string $string) use ($allowedTags): string {
593
+    return function(string $string) use ($allowedTags): string {
594 594
         return $allowedTags
595 595
             ? \strip_tags($string, $allowedTags) // @phpstan-ignore-line
596 596
             : \strip_tags($string);
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
      * @param string $haystack The haystack to look through.
614 614
      * @return int|null
615 615
      */
616
-    return function (string $haystack) use ($needle, $offset, $caseSensitive): ?int {
616
+    return function(string $haystack) use ($needle, $offset, $caseSensitive): ?int {
617 617
         $pos = $caseSensitive
618 618
             ? strpos($haystack, $needle, $offset)
619 619
             : stripos($haystack, $needle, $offset);
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
      * @param string $haystack The haystack to look through.
638 638
      * @return int|null
639 639
      */
640
-    return function (string $haystack) use ($needle, $offset, $caseSensitive): ?int {
640
+    return function(string $haystack) use ($needle, $offset, $caseSensitive): ?int {
641 641
         $pos = $caseSensitive
642 642
             ? strrpos($haystack, $needle, $offset)
643 643
             : strripos($haystack, $needle, $offset);
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
      * @param string $haystack The haystack to look through.
665 665
      * @return string
666 666
      */
667
-    return function (string $haystack) use ($needle, $beforeNeedle, $caseSensitive): string {
667
+    return function(string $haystack) use ($needle, $beforeNeedle, $caseSensitive): string {
668 668
         $result = $caseSensitive
669 669
             ? strstr($haystack, $needle, $beforeNeedle)
670 670
             : stristr($haystack, $needle, $beforeNeedle);
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
      * @param string $haystack
686 686
      * @return string
687 687
      */
688
-    return function (string $haystack) use ($chars): string {
688
+    return function(string $haystack) use ($chars): string {
689 689
         $result = strpbrk($haystack, $chars);
690 690
         return is_string($result) ? $result : '';
691 691
     };
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
      * @param string $haystack
705 705
      * @return string
706 706
      */
707
-    return function (string $haystack) use ($char): string {
707
+    return function(string $haystack) use ($char): string {
708 708
         $result = strrchr($haystack, $char);
709 709
         return is_string($result) ? $result : '';
710 710
     };
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
      * @param string $haystack
724 724
      * @return string
725 725
      */
726
-    return function (string $haystack) use ($dictionary): string {
726
+    return function(string $haystack) use ($dictionary): string {
727 727
         $result = strtr($haystack, $dictionary);
728 728
         return $result;
729 729
     };
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
      * @param string|null $value
754 754
      * @return Closure|string
755 755
      */
756
-    return function (?string $value = null) use ($initial) {
756
+    return function(?string $value = null) use ($initial) {
757 757
         if ($value) {
758 758
             $initial .= $value;
759 759
         }
Please login to merge, or discard this patch.
src/arrays.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      * @param array<int|string, mixed> $array
47 47
      * @return array<int|string, mixed>
48 48
      */
49
-    return function (array $array) use ($value): array {
49
+    return function(array $array) use ($value): array {
50 50
         $array[] = $value;
51 51
         return $array;
52 52
     };
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * @param array<int|string, mixed> $array
65 65
      * @return array<int|string, mixed>
66 66
      */
67
-    return function (array $array) use ($value): array {
67
+    return function(array $array) use ($value): array {
68 68
         array_unshift($array, $value);
69 69
         return $array;
70 70
     };
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      * @return array New array with value on head.
86 86
      */
87 87
     // codecov:ignore:start --t (Will be removed in 0.3.0)
88
-    return function ($value) use ($array): array {
88
+    return function($value) use ($array): array {
89 89
         array_unshift($array, $value);
90 90
         return $array;
91 91
     };
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      * @param mixed $value Adds value end of array.
107 107
      * @return array<int|string, mixed> New array with value on tail.
108 108
      */
109
-    return function ($value) use ($array): array {
109
+    return function($value) use ($array): array {
110 110
         $array[] = $value;
111 111
         return $array;
112 112
     };
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      * @param array<int|string, mixed> $array Array join
167 167
      * @return string
168 168
      */
169
-    return function (array $array) use ($glue): string {
169
+    return function(array $array) use ($glue) : string {
170 170
         return $glue ? \join($glue, $array) : \join($array);
171 171
     };
172 172
 }
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
 function zip(array $additional, $default = null): Closure
183 183
 {
184 184
     $additional = array_values($additional);
185
-    return function (array $array) use ($additional, $default) {
185
+    return function(array $array) use ($additional, $default) {
186 186
         $array = array_values($array);
187 187
         return array_reduce(
188 188
             array_keys($array),
189
-            function ($carry, $key) use ($array, $additional, $default): array {
189
+            function($carry, $key) use ($array, $additional, $default): array {
190 190
                 $carry[] = array(
191 191
                     $array[$key],
192 192
                     array_key_exists($key, $additional) ? $additional[$key] : $default,
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      * @param mixed $value Adds value to inner array if value set, else returns.
220 220
      * @return mixed[]|Closure
221 221
      */
222
-    return function ($value = null) use ($inital) {
222
+    return function($value = null) use ($inital) {
223 223
         if ($value) {
224 224
             $inital[] = $value;
225 225
         }
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
      * @param mixed $value
245 245
      * @return mixed[]|Closure
246 246
      */
247
-    return function ($value = null) use ($validator, $inital) {
247
+    return function($value = null) use ($validator, $inital) {
248 248
         if (!is_null($value) && $validator($value)) {
249 249
             $inital[] = $value;
250 250
         }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
      * @param array<int|string, mixed> $source Array to filter
274 274
      * @return array<int|string, mixed> Filtered array.
275 275
      */
276
-    return function (array $source) use ($callable): array {
276
+    return function(array $source) use ($callable): array {
277 277
         return array_filter($source, $callable);
278 278
     };
279 279
 }
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
      * @param array<int|string, mixed> $source Array to filter
291 291
      * @return array<int|string, mixed> Filtered array.
292 292
      */
293
-    return function (array $source) use ($callable): array {
293
+    return function(array $source) use ($callable): array {
294 294
         return array_filter($source, $callable, \ARRAY_FILTER_USE_KEY);
295 295
     };
296 296
 }
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      * @param array<int|string, mixed> $source Array to filter
309 309
      * @return array<int|string, mixed> Filtered array.
310 310
      */
311
-    return function (array $source) use ($callables): array {
311
+    return function(array $source) use ($callables): array {
312 312
         return array_filter($source, Comp\groupAnd(...$callables));
313 313
     };
314 314
 }
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
      * @param array<int|string, mixed> $source Array to filter
327 327
      * @return array<int|string, mixed> Filtered array.
328 328
      */
329
-    return function (array $source) use ($callables): array {
329
+    return function(array $source) use ($callables): array {
330 330
         return array_filter($source, Comp\groupOr(...$callables));
331 331
     };
332 332
 }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
      * @param array<int|string, mixed> $array The array to filter
344 344
      * @return mixed|null The first element from the filtered array or null if filter returns empty
345 345
      */
346
-    return function (array $array) use ($func) {
346
+    return function(array $array) use ($func) {
347 347
         foreach ($array as $value) {
348 348
             $result = $func($value);
349 349
             if (\is_bool($result) && $result) {
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
      * @param array<int|string, mixed> $array The array to filter
366 366
      * @return mixed|null The last element from the filtered array.
367 367
      */
368
-    return function (array $array) use ($func) {
368
+    return function(array $array) use ($func) {
369 369
         while ($value = array_pop($array)) {
370 370
             $result = $func($value);
371 371
             if (\is_bool($result) && $result) {
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
      * @param array<int|string, mixed> $array The array to filter then map.
391 391
      * @return array<int|string, mixed>
392 392
      */
393
-    return function (array $array) use ($filter, $map): array {
393
+    return function(array $array) use ($filter, $map): array {
394 394
         return array_map($map, array_filter($array, $filter));
395 395
     };
396 396
 }
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
      * @param array<int|string, mixed> $array
408 408
      * @return int Count
409 409
      */
410
-    return function (array $array) use ($function) {
410
+    return function(array $array) use ($function) {
411 411
         return count(array_filter($array, $function));
412 412
     };
413 413
 }
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
      * @param mixed[] $array
427 427
      * @return array{0:mixed[], 1:mixed[]}
428 428
      */
429
-    return function (array $array) use ($function): array {
429
+    return function(array $array) use ($function): array {
430 430
         return array_reduce(
431 431
             $array,
432 432
             /**
@@ -434,8 +434,8 @@  discard block
 block discarded – undo
434 434
              * @param mixed $element
435 435
              * @return array{0:mixed[], 1:mixed[]}
436 436
              */
437
-            function ($carry, $element) use ($function): array {
438
-                $key             = (bool) $function($element) ? 1 : 0;
437
+            function($carry, $element) use ($function): array {
438
+                $key = (bool) $function($element) ? 1 : 0;
439 439
                 $carry[$key][] = $element;
440 440
                 return $carry;
441 441
             },
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
      * @param mixed[] $array
457 457
      * @return bool
458 458
      */
459
-    return function (array $array) use ($function): bool {
459
+    return function(array $array) use ($function): bool {
460 460
         foreach ($array as $value) {
461 461
             if (false === $function($value)) {
462 462
                 return false;
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
      * @param mixed[] $array
480 480
      * @return bool
481 481
      */
482
-    return function (array $array) use ($function): bool {
482
+    return function(array $array) use ($function): bool {
483 483
         foreach ($array as $value) {
484 484
             if (true === $function($value)) {
485 485
                 return true;
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
      * @param mixed[] $array The array to map
511 511
      * @return mixed[]
512 512
      */
513
-    return function (array $array) use ($func): array {
513
+    return function(array $array) use ($func): array {
514 514
         return array_map($func, $array);
515 515
     };
516 516
 }
@@ -528,10 +528,10 @@  discard block
 block discarded – undo
528 528
      * @param mixed[] $array The array to map
529 529
      * @return mixed[]
530 530
      */
531
-    return function (array $array) use ($func): array {
531
+    return function(array $array) use ($func): array {
532 532
         return array_reduce(
533 533
             array_keys($array),
534
-            function ($carry, $key) use ($func, $array) {
534
+            function($carry, $key) use ($func, $array) {
535 535
                 $carry[$func($key)] = $array[$key];
536 536
                 return $carry;
537 537
             },
@@ -553,9 +553,9 @@  discard block
 block discarded – undo
553 553
      * @param mixed[] $array The array to map
554 554
      * @return mixed[]
555 555
      */
556
-    return function (array $array) use ($func, $data): array {
556
+    return function(array $array) use ($func, $data): array {
557 557
         return array_map(
558
-            function ($e) use ($data, $func) {
558
+            function($e) use ($data, $func) {
559 559
                 return $func($e, ...$data);
560 560
             },
561 561
             $array
@@ -575,9 +575,9 @@  discard block
 block discarded – undo
575 575
      * @param mixed[] $array The array to map
576 576
      * @return mixed[]
577 577
      */
578
-    return function (array $array) use ($func): array {
578
+    return function(array $array) use ($func): array {
579 579
         return array_map(
580
-            function ($key, $value) use ($func) {
580
+            function($key, $value) use ($func) {
581 581
                 return $func($value, $key);
582 582
             },
583 583
             $array,
@@ -598,9 +598,9 @@  discard block
 block discarded – undo
598 598
      * @param mixed[] $array The array to map
599 599
      * @return void
600 600
      */
601
-    return function (array $array) use ($func): void {
601
+    return function(array $array) use ($func): void {
602 602
         array_map(
603
-            function ($key, $value) use ($func) {
603
+            function($key, $value) use ($func) {
604 604
                 $func($key, $value);
605 605
             },
606 606
             array_keys($array),
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
      * @param mixed[] $array
623 623
      * @return mixed[]
624 624
      */
625
-    return function (array $array) use ($n, $function): array {
625
+    return function(array $array) use ($n, $function) : array {
626 626
         return array_reduce(
627 627
             $array,
628 628
             /**
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
              * @param mixed $element
631 631
              * @return mixed[]
632 632
              */
633
-            function (array $carry, $element) use ($n, $function): array {
633
+            function(array $carry, $element) use ($n, $function) : array {
634 634
                 if (is_array($element) && (is_null($n) || $n > 0)) {
635 635
                     $carry = array_merge($carry, flatMap($function, $n ? $n - 1 : null)($element));
636 636
                 } else {
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
      * @param mixed[] $array The array to be grouped
663 663
      * @return mixed[] Grouped array.
664 664
      */
665
-    return function (array $array) use ($function): array {
665
+    return function(array $array) use ($function): array {
666 666
         return array_reduce(
667 667
             $array,
668 668
             /**
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
              * @param mixed $element
671 671
              * @return mixed[]
672 672
              */
673
-            function ($carry, $item) use ($function): array {
673
+            function($carry, $item) use ($function): array {
674 674
                 $carry[call_user_func($function, $item)][] = $item;
675 675
                 return $carry;
676 676
             },
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
      * @param mixed[] $array Array to chunk
693 693
      * @return mixed[]
694 694
      */
695
-    return function (array $array) use ($count, $preserveKeys): array {
695
+    return function(array $array) use ($count, $preserveKeys): array {
696 696
         return array_chunk($array, max(1, $count), $preserveKeys);
697 697
     };
698 698
 }
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
      * @param mixed[] $array
711 711
      * @return mixed[]
712 712
      */
713
-    return function (array $array) use ($column, $key): array {
713
+    return function(array $array) use ($column, $key) : array {
714 714
         return array_column($array, $column, $key);
715 715
     };
716 716
 }
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
      * @param mixed[] $array Array to flatten
728 728
      * @return mixed[]
729 729
      */
730
-    return function (array $array) use ($n): array {
730
+    return function(array $array) use ($n) : array {
731 731
         return array_reduce(
732 732
             $array,
733 733
             /**
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
              * @param mixed|mixed[] $element
736 736
              * @return array<int|string, mixed>
737 737
              */
738
-            function (array $carry, $element) use ($n): array {
738
+            function(array $carry, $element) use ($n) : array {
739 739
                 // Remove empty arrays.
740 740
                 if (is_array($element) && empty($element)) {
741 741
                     return $carry;
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
      * @param mixed[] $array The array to have elements replaced from.
767 767
      * @return mixed[] Array with replacements.
768 768
      */
769
-    return function (array $array) use ($with): array {
769
+    return function(array $array) use ($with): array {
770 770
         return array_replace_recursive($array, ...$with);
771 771
     };
772 772
 }
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
      * @param mixed[] $array The array to have elements replaced from.
784 784
      * @return mixed[] Array with replacements.
785 785
      */
786
-    return function (array $array) use ($with): array {
786
+    return function(array $array) use ($with): array {
787 787
         return array_replace($array, ...$with);
788 788
     };
789 789
 }
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
      * @param mixed[] $array Array to do sum() on.
801 801
      * @return Number The total.
802 802
      */
803
-    return function (array $array) use ($function) {
803
+    return function(array $array) use ($function) {
804 804
         return array_sum(array_map($function, $array));
805 805
     };
806 806
 }
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
      * @param mixed[] $array
828 828
      * @return object
829 829
      */
830
-    return function (array $array) use ($object) {
830
+    return function(array $array) use ($object) {
831 831
         foreach ($array as $key => $value) {
832 832
             // If key is not a string or numerical, skip it.
833 833
             if (!is_string($key) || is_numeric($key)) {
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
      * @param mixed $data
864 864
      * @return string|null
865 865
      */
866
-    return function ($data) use ($flags, $depth): ?string {
866
+    return function($data) use ($flags, $depth): ?string {
867 867
         return \json_encode($data, $flags, max(1, $depth)) ?: null;
868 868
     };
869 869
 }
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
      *  @param mixed[]$array The array to sort
890 890
      *  @return mixed[] The sorted array (new array)
891 891
      */
892
-    return function (array $array) use ($flag) {
892
+    return function(array $array) use ($flag) {
893 893
         \sort($array, $flag);
894 894
         return $array;
895 895
     };
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
      *  @param mixed[]$array The array to sort
909 909
      *  @return mixed[] The sorted array (new array)
910 910
      */
911
-    return function (array $array) use ($flag) {
911
+    return function(array $array) use ($flag) {
912 912
         \rsort($array, $flag);
913 913
         return $array;
914 914
     };
@@ -927,7 +927,7 @@  discard block
 block discarded – undo
927 927
      *  @param mixed[]$array The array to sort
928 928
      *  @return mixed[] The sorted array (new array)
929 929
      */
930
-    return function (array $array) use ($flag) {
930
+    return function(array $array) use ($flag) {
931 931
         \ksort($array, $flag);
932 932
         return $array;
933 933
     };
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
      *  @param mixed[]$array The array to sort
946 946
      *  @return mixed[] The sorted array (new array)
947 947
      */
948
-    return function (array $array) use ($flag) {
948
+    return function(array $array) use ($flag) {
949 949
         \krsort($array, $flag);
950 950
         return $array;
951 951
     };
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
      *  @param mixed[]$array The array to sort
965 965
      *  @return mixed[] The sorted array (new array)
966 966
      */
967
-    return function (array $array) use ($flag) {
967
+    return function(array $array) use ($flag) {
968 968
         \asort($array, $flag);
969 969
         return $array;
970 970
     };
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
      *  @param mixed[]$array The array to sort
984 984
      *  @return mixed[] The sorted array (new array)
985 985
      */
986
-    return function (array $array) use ($flag) {
986
+    return function(array $array) use ($flag) {
987 987
         \arsort($array, $flag);
988 988
         return $array;
989 989
     };
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
      *  @param mixed[]$array The array to sort
1001 1001
      *  @return mixed[] The sorted array (new array)
1002 1002
      */
1003
-    return function (array $array) {
1003
+    return function(array $array) {
1004 1004
         \natsort($array);
1005 1005
         return $array;
1006 1006
     };
@@ -1017,7 +1017,7 @@  discard block
 block discarded – undo
1017 1017
      *  @param mixed[]$array The array to sort
1018 1018
      *  @return mixed[] The sorted array (new array)
1019 1019
      */
1020
-    return function (array $array) {
1020
+    return function(array $array) {
1021 1021
         \natcasesort($array);
1022 1022
         return $array;
1023 1023
     };
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
      *  @param mixed[] $array The array to sort
1036 1036
      *  @return mixed[] The sorted array (new array)
1037 1037
      */
1038
-    return function (array $array) use ($function) {
1038
+    return function(array $array) use ($function) {
1039 1039
         \uksort($array, $function);
1040 1040
         return $array;
1041 1041
     };
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
      *  @param mixed[]$array The array to sort
1055 1055
      *  @return mixed[] The sorted array (new array)
1056 1056
      */
1057
-    return function (array $array) use ($function) {
1057
+    return function(array $array) use ($function) {
1058 1058
         \uasort($array, $function);
1059 1059
         return $array;
1060 1060
     };
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
      *  @param mixed[]$array The array to sort
1075 1075
      *  @return mixed[] The sorted array (new array)
1076 1076
      */
1077
-    return function (array $array) use ($function) {
1077
+    return function(array $array) use ($function) {
1078 1078
         \usort($array, $function);
1079 1079
         return $array;
1080 1080
     };
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
  */
1091 1091
 function scan(callable $function, $initialValue): Closure
1092 1092
 {
1093
-    return function (array $array) use ($function, $initialValue) {
1093
+    return function(array $array) use ($function, $initialValue) {
1094 1094
         $carry[] = $initialValue;
1095 1095
         foreach ($array as $key => $value) {
1096 1096
             $initialValue = $function($initialValue, $value);
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
  */
1110 1110
 function scanR(callable $function, $initialValue): Closure
1111 1111
 {
1112
-    return function (array $array) use ($function, $initialValue) {
1112
+    return function(array $array) use ($function, $initialValue) {
1113 1113
         $carry[] = $initialValue;
1114 1114
         foreach (array_reverse($array) as $key => $value) {
1115 1115
             $initialValue = $function($initialValue, $value);
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
      * @param mixed[] $array
1133 1133
      * @return mixed
1134 1134
      */
1135
-    return function (array $array) use ($callable, $initial) {
1135
+    return function(array $array) use ($callable, $initial) {
1136 1136
         return array_reduce($array, $callable, $initial);
1137 1137
     };
1138 1138
 }
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
      * @param mixed[] $array
1151 1151
      * @return mixed
1152 1152
      */
1153
-    return function (array $array) use ($callable, $initial) {
1153
+    return function(array $array) use ($callable, $initial) {
1154 1154
         return array_reduce(\array_reverse($array), $callable, $initial);
1155 1155
     };
1156 1156
 }
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
      * @param mixed[] $array
1170 1170
      * @return mixed
1171 1171
      */
1172
-    return function (array $array) use ($callable, $initial) {
1172
+    return function(array $array) use ($callable, $initial) {
1173 1173
         foreach ($array as $key => $value) {
1174 1174
             $initial = $callable($initial, $key, $value);
1175 1175
         }
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
      * @param mixed[] $array
1196 1196
      * @return mixed[]
1197 1197
      */
1198
-    return function (array $array) use ($count) {
1198
+    return function(array $array) use ($count) {
1199 1199
         return \array_slice($array, 0, $count);
1200 1200
     };
1201 1201
 }
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 
1217 1217
     // If count is 0, return an empty array
1218 1218
     if ($count === 0) {
1219
-        return function (array $array) {
1219
+        return function(array $array) {
1220 1220
             return array();
1221 1221
         };
1222 1222
     }
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
      * @param mixed[] $array
1226 1226
      * @return mixed[]
1227 1227
      */
1228
-    return function (array $array) use ($count) {
1228
+    return function(array $array) use ($count) {
1229 1229
         return \array_slice($array, -$count);
1230 1230
     };
1231 1231
 }
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
      * @param mixed[] $array
1244 1244
      * @return mixed[]
1245 1245
      */
1246
-    return function (array $array) use ($conditional) {
1246
+    return function(array $array) use ($conditional) {
1247 1247
         $carry = array();
1248 1248
         foreach ($array as $key => $value) {
1249 1249
             if (true === $conditional($value)) {
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
      * @param mixed[] $array
1269 1269
      * @return mixed[]
1270 1270
      */
1271
-    return function (array $array) use ($conditional) {
1271
+    return function(array $array) use ($conditional) {
1272 1272
         $carry = array();
1273 1273
         foreach ($array as $key => $value) {
1274 1274
             if (false === $conditional($value)) {
@@ -1292,7 +1292,7 @@  discard block
 block discarded – undo
1292 1292
      * @param mixed[] $array
1293 1293
      * @return mixed[]
1294 1294
      */
1295
-    return function (array $array) use ($indexes) {
1295
+    return function(array $array) use ($indexes) {
1296 1296
         return array_intersect_key($array, array_flip($indexes));
1297 1297
     };
1298 1298
 }
Please login to merge, or discard this patch.