GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Push — master ( 1870d0...1ad186 )
by Marios
12:06
created
src/Parse.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
         // Explodes rows
90 90
         $dataArray = static::explodeWith($data, [PHP_EOL, "\r", "\n"]);
91
-        $dataArray = array_map(function ($row) {
91
+        $dataArray = array_map(function($row) {
92 92
             return Parse::explodeWith($row, [';', "\t", ',']);
93 93
         }, $dataArray);
94 94
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
         // Convert objects to arrays
126 126
         if (\is_object($data)) {
127
-            $data = (array) $data;
127
+            $data = (array)$data;
128 128
         }
129 129
 
130 130
         // Don't convert if it's not an array
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
             $data = $data->toArray();
176 176
         }
177 177
 
178
-        return (array) $data;
178
+        return (array)$data;
179 179
     }
180 180
 
181 181
     /**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
             return static::toJSON($data);
194 194
         }
195 195
 
196
-        return (string) $data;
196
+        return (string)$data;
197 197
     }
198 198
 
199 199
     /**
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             return \strlen($data);
216 216
         }
217 217
 
218
-        return (int) $data;
218
+        return (int)$data;
219 219
     }
220 220
 
221 221
     /**
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      */
228 228
     public static function toBoolean(mixed $data) : bool
229 229
     {
230
-        return (bool) $data;
230
+        return (bool)$data;
231 231
     }
232 232
 
233 233
     /**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
      */
240 240
     public static function toObject(mixed $data) : object
241 241
     {
242
-        return (object) $data;
242
+        return (object)$data;
243 243
     }
244 244
 
245 245
     ////////////////////////////////////////////////////////////////////
Please login to merge, or discard this patch.
src/Underscore.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
     public static function option(string $option) : mixed
60 60
     {
61 61
         // Get config file
62
-        if (!static::$options) {
62
+        if ( ! static::$options) {
63 63
             static::$options = include __DIR__.'/../config/underscore.php';
64 64
         }
65 65
 
Please login to merge, or discard this patch.
src/Methods/StringsMethods.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -160,11 +160,11 @@
 block discarded – undo
160 160
     public static function randomStrings(int $words, int $length = 10) : string
161 161
     {
162 162
         return Strings::from('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
163
-                      ->shuffle()
164
-                      ->split($length)
165
-                      ->slice(0, $words)
166
-                      ->implode(' ')
167
-                      ->obtain();
163
+                        ->shuffle()
164
+                        ->split($length)
165
+                        ->slice(0, $words)
166
+                        ->implode(' ')
167
+                        ->obtain();
168 168
     }
169 169
 
170 170
     ////////////////////////////////////////////////////////////////////
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
      *
182 182
      * @return bool
183 183
      */
184
-    public static function endsWith(string $haystack, array|string $needles) : bool
184
+    public static function endsWith(string $haystack, array | string $needles) : bool
185 185
     {
186
-        foreach ((array) $needles as $needle) {
187
-            if ((string) $needle === substr($haystack, -\strlen($needle))) {
186
+        foreach ((array)$needles as $needle) {
187
+            if ((string)$needle === substr($haystack, -\strlen($needle))) {
188 188
                 return true;
189 189
             }
190 190
         }
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
      *
239 239
      * @return bool
240 240
      */
241
-    public static function startsWith(string $haystack, array|string $needles) : bool
241
+    public static function startsWith(string $haystack, array | string $needles) : bool
242 242
     {
243
-        foreach ((array) $needles as $needle) {
243
+        foreach ((array)$needles as $needle) {
244 244
             if ($needle !== '' && str_starts_with($haystack, $needle)) {
245 245
                 return true;
246 246
             }
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
      * @return bool Found or not
265 265
      */
266 266
     public static function find(
267
-        array|string $string,
268
-        array|string $needle,
267
+        array | string $string,
268
+        array | string $needle,
269 269
         bool $caseSensitive = false,
270 270
         bool $absolute = false
271 271
     ) : bool
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
         }
292 292
 
293 293
         // If not case sensitive
294
-        if (!$caseSensitive) {
294
+        if ( ! $caseSensitive) {
295 295
             $string = strtolower($string);
296 296
             $needle = strtolower($needle);
297 297
         }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
         // If string found
300 300
         $pos = strpos($string, $needle);
301 301
 
302
-        return !($pos === false);
302
+        return ! ($pos === false);
303 303
     }
304 304
 
305 305
     /**
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
      *
327 327
      * @return false|string
328 328
      */
329
-    public static function sliceFrom($string, $slice) : bool|string
329
+    public static function sliceFrom($string, $slice) : bool | string
330 330
     {
331 331
         $slice = strpos($string, $slice);
332 332
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
      *
342 342
      * @return false|string
343 343
      */
344
-    public static function sliceTo($string, $slice) : bool|string
344
+    public static function sliceTo($string, $slice) : bool | string
345 345
     {
346 346
         $slice = strpos($string, $slice);
347 347
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
      *
440 440
      * @return string|string[]
441 441
      */
442
-    public static function replace($string, $replace, $with) : array|string
442
+    public static function replace($string, $replace, $with) : array | string
443 443
     {
444 444
         return str_replace($replace, $with, $string);
445 445
     }
Please login to merge, or discard this patch.
src/Methods/FunctionsMethods.php 1 patch
Spacing   +12 added lines, -15 removed lines patch added patch discarded remove patch
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
         $unique = random_int(0, mt_getrandmax());
74 74
 
75 75
         // Create a closure that check if the function was already called
76
-        return function (...$arguments) use ($function, $canBeCalledTimes, $unique) {
76
+        return function(...$arguments) use ($function, $canBeCalledTimes, $unique) {
77 77
 
78
-            $signature = FunctionsMethods::getSignature((string) $unique, $function, $arguments);
78
+            $signature = FunctionsMethods::getSignature((string)$unique, $function, $arguments);
79 79
 
80 80
             // Get counter
81 81
             $numberOfTimesCalled = FunctionsMethods::hasBeenCalledTimes($signature);
@@ -84,9 +84,7 @@  discard block
 block discarded – undo
84 84
             // Else, increment the count
85 85
             if ($numberOfTimesCalled >= $canBeCalledTimes) {
86 86
                 return false;
87
-            }
88
-
89
-            ++FunctionsMethods::$canBeCalledTimes[$signature];
87
+            }++FunctionsMethods::$canBeCalledTimes[$signature];
90 88
 
91 89
             return \call_user_func_array($function, $arguments);
92 90
         };
@@ -106,16 +104,15 @@  discard block
 block discarded – undo
106 104
         $unique = random_int(0, mt_getrandmax());
107 105
 
108 106
         // Create a closure that check if the function was already called
109
-        return function (...$arguments) use ($function, $times, $unique) {
107
+        return function(...$arguments) use ($function, $times, $unique) {
110 108
 
111
-            $signature = FunctionsMethods::getSignature((string) $unique, $function, $arguments);
109
+            $signature = FunctionsMethods::getSignature((string)$unique, $function, $arguments);
112 110
 
113 111
             // Get counter
114 112
             $called = FunctionsMethods::hasBeenCalledTimes($signature);
115 113
 
116 114
             // Prevent calling before a certain number
117
-            if ($called < $times) {
118
-                ++FunctionsMethods::$canBeCalledTimes[$signature];
115
+            if ($called < $times) {++FunctionsMethods::$canBeCalledTimes[$signature];
119 116
 
120 117
                 return false;
121 118
             }
@@ -136,9 +133,9 @@  discard block
 block discarded – undo
136 133
     {
137 134
         $unique = random_int(0, mt_getrandmax());
138 135
 
139
-        return function (...$arguments) use ($function, $unique) {
136
+        return function(...$arguments) use ($function, $unique) {
140 137
 
141
-            $signature = FunctionsMethods::getSignature((string) $unique, $function, $arguments);
138
+            $signature = FunctionsMethods::getSignature((string)$unique, $function, $arguments);
142 139
 
143 140
             if (isset(FunctionsMethods::$cached[$signature])) {
144 141
                 return FunctionsMethods::$cached[$signature];
@@ -164,9 +161,9 @@  discard block
 block discarded – undo
164 161
     {
165 162
         $unique = random_int(0, mt_getrandmax());
166 163
 
167
-        return function (...$arguments) use ($function, $ms, $unique) {
164
+        return function(...$arguments) use ($function, $ms, $unique) {
168 165
 
169
-            $signature = FunctionsMethods::getSignature((string) $unique, $function, $arguments);
166
+            $signature = FunctionsMethods::getSignature((string)$unique, $function, $arguments);
170 167
 
171 168
             // Check last called time and update it if necessary
172 169
             $last       = FunctionsMethods::getLastCalledTime($signature);
@@ -193,7 +190,7 @@  discard block
 block discarded – undo
193 190
     {
194 191
         $boundArgs = \array_slice(\func_get_args(), 1);
195 192
 
196
-        return function () use ($boundArgs, $func) {
193
+        return function() use ($boundArgs, $func) {
197 194
             $args       = [];
198 195
             $calledArgs = \func_get_args();
199 196
             $position   = 0;
@@ -240,7 +237,7 @@  discard block
 block discarded – undo
240 237
      */
241 238
     public static function getSignature(string $unique, Closure $function, array $arguments) : string
242 239
     {
243
-        $function  = var_export($function, true);
240
+        $function = var_export($function, true);
244 241
         $argumentsStr = var_export($arguments, true);
245 242
 
246 243
         return md5($unique.'_'.$function.'_'.$argumentsStr);
Please login to merge, or discard this patch.
src/Methods/CollectionMethods.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -58,17 +58,17 @@  discard block
 block discarded – undo
58 58
             return $collection;
59 59
         }
60 60
 
61
-        $collection = (array) $collection;
61
+        $collection = (array)$collection;
62 62
 
63 63
         if (isset($collection[$key])) {
64 64
             return $collection[$key];
65 65
         }
66 66
 
67 67
         // Crawl through collection, get key according to object or not
68
-        foreach (explode('.', (string) $key) as $segment) {
69
-            $collection = (array) $collection;
68
+        foreach (explode('.', (string)$key) as $segment) {
69
+            $collection = (array)$collection;
70 70
 
71
-            if (!isset($collection[$segment])) {
71
+            if ( ! isset($collection[$segment])) {
72 72
                 return $default instanceof Closure ? $default() : $default;
73 73
             }
74 74
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     public static function setAndGet(mixed &$collection, string $key, mixed $default = null) : mixed
107 107
     {
108 108
         // If the key doesn't exist, set it
109
-        if (!static::has($collection, $key)) {
109
+        if ( ! static::has($collection, $key)) {
110 110
             $collection = static::set($collection, $key, $default);
111 111
         }
112 112
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      *
122 122
      * @return mixed
123 123
      */
124
-    public static function remove(mixed $collection, string|array $key) : mixed
124
+    public static function remove(mixed $collection, string | array $key) : mixed
125 125
     {
126 126
         // Recursive call
127 127
         if (\is_array($key)) {
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
      *
146 146
      * @return array|object
147 147
      */
148
-    public static function pluck($collection, $property) : object|array
148
+    public static function pluck($collection, $property) : object | array
149 149
     {
150
-        $plucked = array_map(fn($value) => ArraysMethods::get($value, $property), (array) $collection);
150
+        $plucked = array_map(fn($value) => ArraysMethods::get($value, $property), (array)$collection);
151 151
 
152 152
         // Convert back to object if necessary
153 153
         if (\is_object($collection)) {
154
-            return (object) $plucked;
154
+            return (object)$plucked;
155 155
         }
156 156
 
157 157
         return $plucked;
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
      * @return array|object
170 170
      */
171 171
     public static function filterBy($collection, string $property, mixed $value, string $comparisonOp = null) :
172
-    object|array
172
+    object | array
173 173
     {
174
-        if (!$comparisonOp) {
174
+        if ( ! $comparisonOp) {
175 175
             $comparisonOp = \is_array($value) ? 'contains' : 'eq';
176 176
         }
177 177
 
@@ -182,32 +182,32 @@  discard block
 block discarded – undo
182 182
             'lt'          => fn($item, $prop, $value) : bool => $item[$prop] < $value,
183 183
             'lte'         => fn($item, $prop, $value) : bool => $item[$prop] <= $value,
184 184
             'ne'          => fn($item, $prop, $value) : bool => $item[$prop] !== $value,
185
-            'contains'    => fn($item, $prop, $value) : bool => \in_array($item[$prop], (array) $value, true),
186
-            'notContains' => fn($item, $prop, $value) : bool => ! \in_array($item[$prop], (array) $value, true),
185
+            'contains'    => fn($item, $prop, $value) : bool => \in_array($item[$prop], (array)$value, true),
186
+            'notContains' => fn($item, $prop, $value) : bool => ! \in_array($item[$prop], (array)$value, true),
187 187
             'newer'       => fn(
188 188
                 $item,
189 189
                 $prop,
190 190
                 $value
191
-            ) : bool => strtotime((string) $item[$prop]) > strtotime((string) $value),
191
+            ) : bool => strtotime((string)$item[$prop]) > strtotime((string)$value),
192 192
             'older'       => fn(
193 193
                 $item,
194 194
                 $prop,
195 195
                 $value
196
-            ) : bool => strtotime((string) $item[$prop]) < strtotime((string) $value),
196
+            ) : bool => strtotime((string)$item[$prop]) < strtotime((string)$value),
197 197
         ];
198
-        $result = array_values(array_filter((array) $collection, function ($item) use (
198
+        $result = array_values(array_filter((array)$collection, function($item) use (
199 199
             $property,
200 200
             $value,
201 201
             $ops,
202 202
             $comparisonOp
203 203
         ) {
204
-            $item = (array) $item;
204
+            $item = (array)$item;
205 205
             $item[$property] = static::get($item, $property, []);
206 206
 
207 207
             return $ops[$comparisonOp]($item, $property, $value);
208 208
         }));
209 209
         if (\is_object($collection)) {
210
-            return (object) $result;
210
+            return (object)$result;
211 211
         }
212 212
 
213 213
         return $result;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      */
241 241
     public static function keys($collection) : array
242 242
     {
243
-        return array_keys((array) $collection);
243
+        return array_keys((array)$collection);
244 244
     }
245 245
 
246 246
     /**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
      */
253 253
     public static function values($collection) : array
254 254
     {
255
-        return array_values((array) $collection);
255
+        return array_values((array)$collection);
256 256
     }
257 257
 
258 258
     ////////////////////////////////////////////////////////////////////
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
      *
270 270
      * @return mixed
271 271
      */
272
-    public static function replace(array|object $collection, string $replace, string $key, mixed $value) : mixed
272
+    public static function replace(array | object $collection, string $replace, string $key, mixed $value) : mixed
273 273
     {
274 274
         $collection = static::remove($collection, $replace);
275 275
 
@@ -286,9 +286,9 @@  discard block
 block discarded – undo
286 286
      *
287 287
      * @return array
288 288
      */
289
-    public static function sort(array|object $collection, $sorter = null, string $direction = 'asc') : array
289
+    public static function sort(array | object $collection, $sorter = null, string $direction = 'asc') : array
290 290
     {
291
-        $collection = (array) $collection;
291
+        $collection = (array)$collection;
292 292
 
293 293
         // Get correct PHP constant for direction
294 294
         $directionNumber = (strtolower($direction) === 'desc') ? SORT_DESC : SORT_ASC;
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
      *
319 319
      * @return array
320 320
      */
321
-    public static function group(mixed $collection, callable|string $grouper, bool $saveKeys = false) : array
321
+    public static function group(mixed $collection, callable | string $grouper, bool $saveKeys = false) : array
322 322
     {
323
-        $collection = (array) $collection;
323
+        $collection = (array)$collection;
324 324
         $result     = [];
325 325
 
326 326
         // Iterate over values, group by property/results from closure
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
         }
362 362
 
363 363
         // Explode the keys
364
-        $keys = explode('.', (string) $key);
364
+        $keys = explode('.', (string)$key);
365 365
 
366 366
         // Crawl through the keys
367 367
         while (\count($keys) > 1) {
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
      *
398 398
      * @return mixed
399 399
      */
400
-    protected static function internalRemove(array|object &$collection, mixed $key) : bool
400
+    protected static function internalRemove(array | object &$collection, mixed $key) : bool
401 401
     {
402 402
         // Explode keys
403 403
         $keys = explode('.', $key);
Please login to merge, or discard this patch.
src/Methods/ArraysMethods.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     /**
48 48
      * Fill an array with $times times some $data.
49 49
      */
50
-    public static function repeat(mixed $data, int|float $times) : array
50
+    public static function repeat(mixed $data, int | float $times) : array
51 51
     {
52 52
         $times = abs($times);
53 53
         if ($times === 0) {
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @return int|string|bool
71 71
      */
72
-    public static function search(array $array, mixed $value) : int|string|bool
72
+    public static function search(array $array, mixed $value) : int | string | bool
73 73
     {
74 74
         return array_search($value, $array, true);
75 75
     }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public static function clean(array $array) : mixed
209 209
     {
210
-        return static::filter($array, fn($value) : bool => (bool) $value);
210
+        return static::filter($array, fn($value) : bool => (bool)$value);
211 211
     }
212 212
 
213 213
     /**
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public static function without(...$arguments)
234 234
     {
235
-        $array     = array_shift($arguments);
235
+        $array = array_shift($arguments);
236 236
         // if singular argument and is an array treat this AS the array to run without agains
237 237
         if (\is_array($arguments[0]) && \count($arguments) === 1) {
238 238
             $arguments = $arguments[0];
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
      */
346 346
     public static function replaceValue(array $array, string $replace, string $with) : array
347 347
     {
348
-        return static::each($array, fn($value) : string|array => str_replace($replace, $with, (string) $value));
348
+        return static::each($array, fn($value) : string | array => str_replace($replace, $with, (string)$value));
349 349
     }
350 350
 
351 351
     /**
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
      *
476 476
      * @return array
477 477
      */
478
-    public static function invoke(array $array, Closure|string $callable, mixed $arguments = []) : array
478
+    public static function invoke(array $array, Closure | string $callable, mixed $arguments = []) : array
479 479
     {
480 480
         // If one argument given for each iteration, create an array for it
481 481
         if ( ! \is_array($arguments)) {
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
      */
586 586
     public static function unique(array $array) : array
587 587
     {
588
-        return array_reduce($array, function (array $resultArray, $value) : array {
588
+        return array_reduce($array, function(array $resultArray, $value) : array {
589 589
             if ( ! static::contains($resultArray, $value)) {
590 590
                 $resultArray[] = $value;
591 591
             }
Please login to merge, or discard this patch.
src/Methods/NumberMethods.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      */
30 30
     public static function padding(mixed $number, int $padding = 1, int $direction = STR_PAD_BOTH) : string
31 31
     {
32
-        return str_pad((string) $number, $padding, '0', $direction);
32
+        return str_pad((string)$number, $padding, '0', $direction);
33 33
     }
34 34
 
35 35
     /**
Please login to merge, or discard this patch.
src/Methods/BaseObjectMethods.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@
 block discarded – undo
40 40
      */
41 41
     public static function unpack($object, $attribute = null) : object
42 42
     {
43
-        $object = (array) $object;
43
+        $object = (array)$object;
44 44
         $object = $attribute
45 45
             ? ArraysMethods::get($object, $attribute)
46 46
             : ArraysMethods::first($object);
47 47
 
48
-        return (object) $object;
48
+        return (object)$object;
49 49
     }
50 50
 }
Please login to merge, or discard this patch.
src/Dispatch.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      *
75 75
      * @return bool|string The correct function to call
76 76
      */
77
-    public static function toNative(string $class, string $method) : bool|string
77
+    public static function toNative(string $class, string $method) : bool | string
78 78
     {
79 79
         // Aliased native function
80 80
         $native = Method::getNative($method);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         }
95 95
 
96 96
         // If no function prefix found, return false
97
-        if (!isset($prefix)) {
97
+        if ( ! isset($prefix)) {
98 98
             return false;
99 99
         }
100 100
 
Please login to merge, or discard this patch.