Passed
Push — develop ( 715668...400ecc )
by Glynn
03:57 queued 01:03
created
src/general.php 1 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/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.