@@ -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 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $value = str_replace($val, $key, $value); |
86 | 86 | } |
87 | 87 | |
88 | - return (string)preg_replace('/[^\x20-\x7E]/u', '', $value); |
|
88 | + return (string) preg_replace('/[^\x20-\x7E]/u', '', $value); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | // pattern such as "library/*", making any string check convenient. |
253 | 253 | $cleanQuoted = str_replace('\*', '.*', $quoted); |
254 | 254 | |
255 | - return (bool)preg_match('#^' . $cleanQuoted . '\z#', $value); |
|
255 | + return (bool) preg_match('#^' . $cleanQuoted . '\z#', $value); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | */ |
565 | 565 | public static function isAscii(string $value): bool |
566 | 566 | { |
567 | - return (bool)!preg_match('/[^\x00-\x7F]/S', $value); |
|
567 | + return (bool) !preg_match('/[^\x00-\x7F]/S', $value); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | /** |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | { |
598 | 598 | $bytes = random_bytes((int) ceil($length / 2)); |
599 | 599 | |
600 | - return (string)substr(bin2hex($bytes), 0, $length); |
|
600 | + return (string) substr(bin2hex($bytes), 0, $length); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | /** |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | $pool = '2345679ACDEFHJKLMNPRSTUVWXYZ'; |
663 | 663 | break; |
664 | 664 | default: |
665 | - $pool = (string)$type; |
|
665 | + $pool = (string) $type; |
|
666 | 666 | $utf8 = !self::isAscii($pool); |
667 | 667 | break; |
668 | 668 | } |
@@ -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) { |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | return; |
468 | 468 | } |
469 | 469 | |
470 | - $count = count($keys); |
|
470 | + $count = count($keys); |
|
471 | 471 | if (is_scalar($direction)) { |
472 | 472 | $direction = array_fill(0, $count, $direction); |
473 | 473 | } elseif (count($direction) !== $count) { |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | $max = 0; |
930 | 930 | foreach ($array as $key => $value) { |
931 | 931 | if (!$expectInt || !is_numeric($key)) { |
932 | - $width = mb_strlen((string)$key, 'UTF-8'); |
|
932 | + $width = mb_strlen((string) $key, 'UTF-8'); |
|
933 | 933 | if ($width > $max) { |
934 | 934 | $max = $width; |
935 | 935 | } |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | } else { |
1050 | 1050 | $itemKey = static::get($item, $key); |
1051 | 1051 | if (is_object($itemKey) && method_exists($itemKey, '__toString')) { |
1052 | - $itemKey = (string)$itemKey; |
|
1052 | + $itemKey = (string) $itemKey; |
|
1053 | 1053 | } |
1054 | 1054 | |
1055 | 1055 | $results[$itemKey] = $itemValue; |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | $keys = array_rand($array, $number); |
1153 | 1153 | |
1154 | 1154 | $results = []; |
1155 | - foreach ((array)$keys as $key) { |
|
1155 | + foreach ((array) $keys as $key) { |
|
1156 | 1156 | $results[] = $array[$key]; |
1157 | 1157 | } |
1158 | 1158 | |
@@ -1202,18 +1202,18 @@ discard block |
||
1202 | 1202 | if (preg_match('/^\-\w=/', $arg)) { |
1203 | 1203 | $normalized = array_merge( |
1204 | 1204 | $normalized, |
1205 | - (array)explode('=', $arg) |
|
1205 | + (array) explode('=', $arg) |
|
1206 | 1206 | ); |
1207 | 1207 | } elseif (preg_match('/^\-\w{2,}/', $arg)) { |
1208 | 1208 | $splitArgs = implode(' -', str_split(ltrim($arg, '-'))); |
1209 | 1209 | $normalized = array_merge( |
1210 | 1210 | $normalized, |
1211 | - (array)explode(' ', '-' . $splitArgs) |
|
1211 | + (array) explode(' ', '-' . $splitArgs) |
|
1212 | 1212 | ); |
1213 | 1213 | } elseif (preg_match('/^\-\-([^\s\=]+)\=/', $arg)) { |
1214 | 1214 | $normalized = array_merge( |
1215 | 1215 | $normalized, |
1216 | - (array)explode('=', $arg) |
|
1216 | + (array) explode('=', $arg) |
|
1217 | 1217 | ); |
1218 | 1218 | } else { |
1219 | 1219 | $normalized[] = $arg; |