@@ -74,7 +74,7 @@ |
||
| 74 | 74 | return self::$classLoader; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $autoloadFunctions = (array)spl_autoload_functions(); |
|
| 77 | + $autoloadFunctions = (array) spl_autoload_functions(); |
|
| 78 | 78 | foreach ($autoloadFunctions as $loader) { |
| 79 | 79 | if (is_array($loader) && isset($loader[0])) { |
| 80 | 80 | $composerLoader = $loader[0]; |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | if (array_key_exists('unit', $matches)) { |
| 68 | 68 | $unit = strtoupper($matches['unit']); |
| 69 | 69 | } |
| 70 | - return (int)(floatval($matches['size']) * pow(1024, $units[$unit])); |
|
| 70 | + return (int) (floatval($matches['size']) * pow(1024, $units[$unit])); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $result = $object->toArray(); |
| 108 | 108 | } else { |
| 109 | 109 | $result = []; |
| 110 | - foreach ((array)$object as $key => $value) { |
|
| 110 | + foreach ((array) $object as $key => $value) { |
|
| 111 | 111 | $result[$key] = $value; |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public static function merge(array ...$args): array |
| 129 | 129 | { |
| 130 | - $res = (array)array_shift($args); |
|
| 130 | + $res = (array) array_shift($args); |
|
| 131 | 131 | while (!empty($args)) { |
| 132 | 132 | $next = array_shift($args); |
| 133 | 133 | foreach ($next as $key => $value) { |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | return; |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | - $count = count($keys); |
|
| 472 | + $count = count($keys); |
|
| 473 | 473 | if (is_scalar($direction)) { |
| 474 | 474 | $direction = array_fill(0, $count, $direction); |
| 475 | 475 | } elseif (count($direction) !== $count) { |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | $max = 0; |
| 937 | 937 | foreach ($array as $key => $value) { |
| 938 | 938 | if (!$expectInt || !is_numeric($key)) { |
| 939 | - $width = mb_strlen((string)$key, 'UTF-8'); |
|
| 939 | + $width = mb_strlen((string) $key, 'UTF-8'); |
|
| 940 | 940 | if ($width > $max) { |
| 941 | 941 | $max = $width; |
| 942 | 942 | } |
@@ -1057,7 +1057,7 @@ discard block |
||
| 1057 | 1057 | } else { |
| 1058 | 1058 | $itemKey = static::get($item, $key); |
| 1059 | 1059 | if (is_object($itemKey) && method_exists($itemKey, '__toString')) { |
| 1060 | - $itemKey = (string)$itemKey; |
|
| 1060 | + $itemKey = (string) $itemKey; |
|
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | $results[$itemKey] = $itemValue; |
@@ -1161,7 +1161,7 @@ discard block |
||
| 1161 | 1161 | $keys = array_rand($array, $number); |
| 1162 | 1162 | |
| 1163 | 1163 | $results = []; |
| 1164 | - foreach ((array)$keys as $key) { |
|
| 1164 | + foreach ((array) $keys as $key) { |
|
| 1165 | 1165 | $results[] = $array[$key]; |
| 1166 | 1166 | } |
| 1167 | 1167 | |
@@ -1211,18 +1211,18 @@ discard block |
||
| 1211 | 1211 | if (preg_match('/^\-\w=/', $arg)) { |
| 1212 | 1212 | $normalized = array_merge( |
| 1213 | 1213 | $normalized, |
| 1214 | - (array)explode('=', $arg) |
|
| 1214 | + (array) explode('=', $arg) |
|
| 1215 | 1215 | ); |
| 1216 | 1216 | } elseif (preg_match('/^\-\w{2,}/', $arg)) { |
| 1217 | 1217 | $splitArgs = implode(' -', str_split(ltrim($arg, '-'))); |
| 1218 | 1218 | $normalized = array_merge( |
| 1219 | 1219 | $normalized, |
| 1220 | - (array)explode(' ', '-' . $splitArgs) |
|
| 1220 | + (array) explode(' ', '-' . $splitArgs) |
|
| 1221 | 1221 | ); |
| 1222 | 1222 | } elseif (preg_match('/^\-\-([^\s\=]+)\=/', $arg)) { |
| 1223 | 1223 | $normalized = array_merge( |
| 1224 | 1224 | $normalized, |
| 1225 | - (array)explode('=', $arg) |
|
| 1225 | + (array) explode('=', $arg) |
|
| 1226 | 1226 | ); |
| 1227 | 1227 | } else { |
| 1228 | 1228 | $normalized[] = $arg; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $value = str_replace($val, $key, $value); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - return (string)preg_replace('/[^\x20-\x7E]/u', '', $value); |
|
| 94 | + return (string) preg_replace('/[^\x20-\x7E]/u', '', $value); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | // pattern such as "library/*", making any string check convenient. |
| 259 | 259 | $cleanQuoted = str_replace('\*', '.*', $quoted); |
| 260 | 260 | |
| 261 | - return (bool)preg_match('#^' . $cleanQuoted . '\z#', $value); |
|
| 261 | + return (bool) preg_match('#^' . $cleanQuoted . '\z#', $value); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /** |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | */ |
| 571 | 571 | public static function isAscii(string $value): bool |
| 572 | 572 | { |
| 573 | - return (bool)!preg_match('/[^\x00-\x7F]/S', $value); |
|
| 573 | + return (bool) !preg_match('/[^\x00-\x7F]/S', $value); |
|
| 574 | 574 | } |
| 575 | 575 | |
| 576 | 576 | /** |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | { |
| 604 | 604 | $bytes = random_bytes((int) ceil($length / 2)); |
| 605 | 605 | |
| 606 | - return (string)substr(bin2hex($bytes), 0, $length); |
|
| 606 | + return (string) substr(bin2hex($bytes), 0, $length); |
|
| 607 | 607 | } |
| 608 | 608 | |
| 609 | 609 | /** |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | $pool = '2345679ACDEFHJKLMNPRSTUVWXYZ'; |
| 669 | 669 | break; |
| 670 | 670 | default: |
| 671 | - $pool = (string)$type; |
|
| 671 | + $pool = (string) $type; |
|
| 672 | 672 | $utf8 = !self::isAscii($pool); |
| 673 | 673 | break; |
| 674 | 674 | } |
@@ -772,7 +772,7 @@ discard block |
||
| 772 | 772 | $ignoreKeys = $firstKey === 0; |
| 773 | 773 | |
| 774 | 774 | return sprintf('[%s]', implode(', ', array_map( |
| 775 | - function ($key, $value) use ($ignoreKeys) { |
|
| 775 | + function($key, $value) use ($ignoreKeys) { |
|
| 776 | 776 | return $ignoreKeys |
| 777 | 777 | ? self::stringify($value) |
| 778 | 778 | : sprintf( |