@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -return array ( |
|
3 | +return array( |
|
4 | 4 | 'a' => 'A', |
5 | 5 | 'b' => 'B', |
6 | 6 | 'c' => 'C', |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | private const SIMPLE_CASE_FOLD = [ |
78 | 78 | ['µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"], |
79 | - ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'], |
|
79 | + ['μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'], |
|
80 | 80 | ]; |
81 | 81 | |
82 | 82 | private static $encodingList = ['ASCII', 'UTF-8']; |
@@ -127,13 +127,13 @@ discard block |
||
127 | 127 | $fromEncoding = 'UTF-8'; |
128 | 128 | } |
129 | 129 | |
130 | - return iconv($fromEncoding, $toEncoding.'//IGNORE', $s); |
|
130 | + return iconv($fromEncoding, $toEncoding . '//IGNORE', $s); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars) |
134 | 134 | { |
135 | 135 | $ok = true; |
136 | - array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) { |
|
136 | + array_walk_recursive($vars, function(&$v) use (&$ok, $toEncoding, $fromEncoding) { |
|
137 | 137 | if (false === $v = self::mb_convert_encoding($v, $toEncoding, $fromEncoding)) { |
138 | 138 | $ok = false; |
139 | 139 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | public static function mb_decode_numericentity($s, $convmap, $encoding = null) |
156 | 156 | { |
157 | 157 | if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { |
158 | - trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
|
158 | + trigger_error('mb_decode_numericentity() expects parameter 1 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
159 | 159 | |
160 | 160 | return null; |
161 | 161 | } |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | if (null !== $encoding && !\is_scalar($encoding)) { |
168 | - trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
|
168 | + trigger_error('mb_decode_numericentity() expects parameter 3 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
169 | 169 | |
170 | - return ''; // Instead of null (cf. mb_encode_numericentity). |
|
170 | + return ''; // Instead of null (cf. mb_encode_numericentity). |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | $s = (string) $s; |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $convmap[$i + 1] += $convmap[$i + 2]; |
195 | 195 | } |
196 | 196 | |
197 | - $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) { |
|
197 | + $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function(array $m) use ($cnt, $convmap) { |
|
198 | 198 | $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1]; |
199 | 199 | for ($i = 0; $i < $cnt; $i += 4) { |
200 | 200 | if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) { |
@@ -209,13 +209,13 @@ discard block |
||
209 | 209 | return $s; |
210 | 210 | } |
211 | 211 | |
212 | - return iconv('UTF-8', $encoding.'//IGNORE', $s); |
|
212 | + return iconv('UTF-8', $encoding . '//IGNORE', $s); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) |
216 | 216 | { |
217 | 217 | if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) { |
218 | - trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
|
218 | + trigger_error('mb_encode_numericentity() expects parameter 1 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
219 | 219 | |
220 | 220 | return null; |
221 | 221 | } |
@@ -225,13 +225,13 @@ discard block |
||
225 | 225 | } |
226 | 226 | |
227 | 227 | if (null !== $encoding && !\is_scalar($encoding)) { |
228 | - trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING); |
|
228 | + trigger_error('mb_encode_numericentity() expects parameter 3 to be string, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
229 | 229 | |
230 | - return null; // Instead of '' (cf. mb_decode_numericentity). |
|
230 | + return null; // Instead of '' (cf. mb_decode_numericentity). |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | if (null !== $is_hex && !\is_scalar($is_hex)) { |
234 | - trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING); |
|
234 | + trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, ' . \gettype($s) . ' given', \E_USER_WARNING); |
|
235 | 235 | |
236 | 236 | return null; |
237 | 237 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | for ($j = 0; $j < $cnt; $j += 4) { |
269 | 269 | if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) { |
270 | 270 | $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3]; |
271 | - $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';'; |
|
271 | + $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#' . $cOffset . ';'; |
|
272 | 272 | continue 2; |
273 | 273 | } |
274 | 274 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | return $result; |
280 | 280 | } |
281 | 281 | |
282 | - return iconv('UTF-8', $encoding.'//IGNORE', $result); |
|
282 | + return iconv('UTF-8', $encoding . '//IGNORE', $result); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | public static function mb_convert_case($s, $mode, $encoding = null) |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | return $s; |
362 | 362 | } |
363 | 363 | |
364 | - return iconv('UTF-8', $encoding.'//IGNORE', $s); |
|
364 | + return iconv('UTF-8', $encoding . '//IGNORE', $s); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | public static function mb_internal_encoding($encoding = null) |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | $needle = (string) $needle; |
533 | 533 | if ('' === $needle) { |
534 | 534 | if (80000 > \PHP_VERSION_ID) { |
535 | - trigger_error(__METHOD__.': Empty delimiter', \E_USER_WARNING); |
|
535 | + trigger_error(__METHOD__ . ': Empty delimiter', \E_USER_WARNING); |
|
536 | 536 | |
537 | 537 | return false; |
538 | 538 | } |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | public static function mb_str_split($string, $split_length = 1, $encoding = null) |
574 | 574 | { |
575 | 575 | if (null !== $string && !\is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) { |
576 | - trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING); |
|
576 | + trigger_error('mb_str_split() expects parameter 1 to be string, ' . \gettype($string) . ' given', \E_USER_WARNING); |
|
577 | 577 | |
578 | 578 | return null; |
579 | 579 | } |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | $rx .= '.{65535}'; |
599 | 599 | $split_length -= 65535; |
600 | 600 | } |
601 | - $rx .= '.{'.$split_length.'})/us'; |
|
601 | + $rx .= '.{' . $split_length . '})/us'; |
|
602 | 602 | |
603 | 603 | return preg_split($rx, $string, -1, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY); |
604 | 604 | } |
@@ -796,11 +796,11 @@ discard block |
||
796 | 796 | if (0x80 > $code %= 0x200000) { |
797 | 797 | $s = \chr($code); |
798 | 798 | } elseif (0x800 > $code) { |
799 | - $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F); |
|
799 | + $s = \chr(0xC0 | $code >> 6) . \chr(0x80 | $code & 0x3F); |
|
800 | 800 | } elseif (0x10000 > $code) { |
801 | - $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); |
|
801 | + $s = \chr(0xE0 | $code >> 12) . \chr(0x80 | $code >> 6 & 0x3F) . \chr(0x80 | $code & 0x3F); |
|
802 | 802 | } else { |
803 | - $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F); |
|
803 | + $s = \chr(0xF0 | $code >> 18) . \chr(0x80 | $code >> 12 & 0x3F) . \chr(0x80 | $code >> 6 & 0x3F) . \chr(0x80 | $code & 0x3F); |
|
804 | 804 | } |
805 | 805 | |
806 | 806 | if ('UTF-8' !== $encoding = self::getEncoding($encoding)) { |
@@ -858,14 +858,14 @@ discard block |
||
858 | 858 | |
859 | 859 | switch ($pad_type) { |
860 | 860 | case \STR_PAD_LEFT: |
861 | - return self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding).$string; |
|
861 | + return self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding) . $string; |
|
862 | 862 | case \STR_PAD_RIGHT: |
863 | - return $string.self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding); |
|
863 | + return $string . self::mb_substr(str_repeat($pad_string, $paddingRequired), 0, $paddingRequired, $encoding); |
|
864 | 864 | default: |
865 | 865 | $leftPaddingLength = floor($paddingRequired / 2); |
866 | 866 | $rightPaddingLength = $paddingRequired - $leftPaddingLength; |
867 | 867 | |
868 | - return self::mb_substr(str_repeat($pad_string, $leftPaddingLength), 0, $leftPaddingLength, $encoding).$string.self::mb_substr(str_repeat($pad_string, $rightPaddingLength), 0, $rightPaddingLength, $encoding); |
|
868 | + return self::mb_substr(str_repeat($pad_string, $leftPaddingLength), 0, $leftPaddingLength, $encoding) . $string . self::mb_substr(str_repeat($pad_string, $rightPaddingLength), 0, $rightPaddingLength, $encoding); |
|
869 | 869 | } |
870 | 870 | } |
871 | 871 | |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | $firstChar = mb_substr($string, 0, 1, $encoding); |
881 | 881 | $firstChar = mb_convert_case($firstChar, \MB_CASE_TITLE, $encoding); |
882 | 882 | |
883 | - return $firstChar.mb_substr($string, 1, null, $encoding); |
|
883 | + return $firstChar . mb_substr($string, 1, null, $encoding); |
|
884 | 884 | } |
885 | 885 | |
886 | 886 | public static function mb_lcfirst(string $string, ?string $encoding = null): string |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | $firstChar = mb_substr($string, 0, 1, $encoding); |
895 | 895 | $firstChar = mb_convert_case($firstChar, \MB_CASE_LOWER, $encoding); |
896 | 896 | |
897 | - return $firstChar.mb_substr($string, 1, null, $encoding); |
|
897 | + return $firstChar . mb_substr($string, 1, null, $encoding); |
|
898 | 898 | } |
899 | 899 | |
900 | 900 | private static function getSubpart($pos, $part, $haystack, $encoding) |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80; |
929 | 929 | } |
930 | 930 | |
931 | - $entities .= '&#'.$c.';'; |
|
931 | + $entities .= '&#' . $c . ';'; |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | return $entities; |
@@ -936,12 +936,12 @@ discard block |
||
936 | 936 | |
937 | 937 | private static function title_case(array $s) |
938 | 938 | { |
939 | - return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8'); |
|
939 | + return self::mb_convert_case($s[1], \MB_CASE_UPPER, 'UTF-8') . self::mb_convert_case($s[2], \MB_CASE_LOWER, 'UTF-8'); |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | private static function getData($file) |
943 | 943 | { |
944 | - if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { |
|
944 | + if (file_exists($file = __DIR__ . '/Resources/unidata/' . $file . '.php')) { |
|
945 | 945 | return require $file; |
946 | 946 | } |
947 | 947 | |
@@ -991,7 +991,7 @@ discard block |
||
991 | 991 | if (null === $encoding) { |
992 | 992 | $encoding = self::mb_internal_encoding(); |
993 | 993 | } else { |
994 | - self::assertEncoding($encoding, $function.'(): Argument #3 ($encoding) must be a valid encoding, "%s" given'); |
|
994 | + self::assertEncoding($encoding, $function . '(): Argument #3 ($encoding) must be a valid encoding, "%s" given'); |
|
995 | 995 | } |
996 | 996 | |
997 | 997 | if ('' === $characters) { |
@@ -1026,7 +1026,7 @@ discard block |
||
1026 | 1026 | return $string; |
1027 | 1027 | } |
1028 | 1028 | |
1029 | - return iconv('UTF-8', $encoding.'//IGNORE', $string); |
|
1029 | + return iconv('UTF-8', $encoding . '//IGNORE', $string); |
|
1030 | 1030 | } |
1031 | 1031 | |
1032 | 1032 | private static function assertEncoding(string $encoding, string $errorFormat): void |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | use Symfony\Polyfill\Mbstring as p; |
13 | 13 | |
14 | 14 | if (!function_exists('mb_convert_encoding')) { |
15 | - function mb_convert_encoding(array|string|null $string, ?string $to_encoding, array|string|null $from_encoding = null): array|string|false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); } |
|
15 | + function mb_convert_encoding(array | string | null $string, ?string $to_encoding, array | string | null $from_encoding = null): array | string | false { return p\Mbstring::mb_convert_encoding($string ?? '', (string) $to_encoding, $from_encoding); } |
|
16 | 16 | } |
17 | 17 | if (!function_exists('mb_decode_mimeheader')) { |
18 | 18 | function mb_decode_mimeheader(?string $string): string { return p\Mbstring::mb_decode_mimeheader((string) $string); } |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | function mb_convert_case(?string $string, ?int $mode, ?string $encoding = null): string { return p\Mbstring::mb_convert_case((string) $string, (int) $mode, $encoding); } |
31 | 31 | } |
32 | 32 | if (!function_exists('mb_internal_encoding')) { |
33 | - function mb_internal_encoding(?string $encoding = null): string|bool { return p\Mbstring::mb_internal_encoding($encoding); } |
|
33 | + function mb_internal_encoding(?string $encoding = null): string | bool { return p\Mbstring::mb_internal_encoding($encoding); } |
|
34 | 34 | } |
35 | 35 | if (!function_exists('mb_language')) { |
36 | - function mb_language(?string $language = null): string|bool { return p\Mbstring::mb_language($language); } |
|
36 | + function mb_language(?string $language = null): string | bool { return p\Mbstring::mb_language($language); } |
|
37 | 37 | } |
38 | 38 | if (!function_exists('mb_list_encodings')) { |
39 | 39 | function mb_list_encodings(): array { return p\Mbstring::mb_list_encodings(); } |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | function mb_encoding_aliases(?string $encoding): array { return p\Mbstring::mb_encoding_aliases((string) $encoding); } |
43 | 43 | } |
44 | 44 | if (!function_exists('mb_check_encoding')) { |
45 | - function mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); } |
|
45 | + function mb_check_encoding(array | string | null $value = null, ?string $encoding = null): bool { return p\Mbstring::mb_check_encoding($value, $encoding); } |
|
46 | 46 | } |
47 | 47 | if (!function_exists('mb_detect_encoding')) { |
48 | - function mb_detect_encoding(?string $string, array|string|null $encodings = null, ?bool $strict = false): string|false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); } |
|
48 | + function mb_detect_encoding(?string $string, array | string | null $encodings = null, ?bool $strict = false): string | false { return p\Mbstring::mb_detect_encoding((string) $string, $encodings, (bool) $strict); } |
|
49 | 49 | } |
50 | 50 | if (!function_exists('mb_detect_order')) { |
51 | - function mb_detect_order(array|string|null $encoding = null): array|bool { return p\Mbstring::mb_detect_order($encoding); } |
|
51 | + function mb_detect_order(array | string | null $encoding = null): array | bool { return p\Mbstring::mb_detect_order($encoding); } |
|
52 | 52 | } |
53 | 53 | if (!function_exists('mb_parse_str')) { |
54 | 54 | function mb_parse_str(?string $string, &$result = []): bool { parse_str((string) $string, $result); return (bool) $result; } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | function mb_strlen(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strlen((string) $string, $encoding); } |
58 | 58 | } |
59 | 59 | if (!function_exists('mb_strpos')) { |
60 | - function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
60 | + function mb_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int | false { return p\Mbstring::mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
61 | 61 | } |
62 | 62 | if (!function_exists('mb_strtolower')) { |
63 | 63 | function mb_strtolower(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtolower((string) $string, $encoding); } |
@@ -66,37 +66,37 @@ discard block |
||
66 | 66 | function mb_strtoupper(?string $string, ?string $encoding = null): string { return p\Mbstring::mb_strtoupper((string) $string, $encoding); } |
67 | 67 | } |
68 | 68 | if (!function_exists('mb_substitute_character')) { |
69 | - function mb_substitute_character(string|int|null $substitute_character = null): string|int|bool { return p\Mbstring::mb_substitute_character($substitute_character); } |
|
69 | + function mb_substitute_character(string | int | null $substitute_character = null): string | int | bool { return p\Mbstring::mb_substitute_character($substitute_character); } |
|
70 | 70 | } |
71 | 71 | if (!function_exists('mb_substr')) { |
72 | 72 | function mb_substr(?string $string, ?int $start, ?int $length = null, ?string $encoding = null): string { return p\Mbstring::mb_substr((string) $string, (int) $start, $length, $encoding); } |
73 | 73 | } |
74 | 74 | if (!function_exists('mb_stripos')) { |
75 | - function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
75 | + function mb_stripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int | false { return p\Mbstring::mb_stripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
76 | 76 | } |
77 | 77 | if (!function_exists('mb_stristr')) { |
78 | - function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
78 | + function mb_stristr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string | false { return p\Mbstring::mb_stristr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
79 | 79 | } |
80 | 80 | if (!function_exists('mb_strrchr')) { |
81 | - function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
81 | + function mb_strrchr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string | false { return p\Mbstring::mb_strrchr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
82 | 82 | } |
83 | 83 | if (!function_exists('mb_strrichr')) { |
84 | - function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
84 | + function mb_strrichr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string | false { return p\Mbstring::mb_strrichr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
85 | 85 | } |
86 | 86 | if (!function_exists('mb_strripos')) { |
87 | - function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
87 | + function mb_strripos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int | false { return p\Mbstring::mb_strripos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
88 | 88 | } |
89 | 89 | if (!function_exists('mb_strrpos')) { |
90 | - function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
90 | + function mb_strrpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int | false { return p\Mbstring::mb_strrpos((string) $haystack, (string) $needle, (int) $offset, $encoding); } |
|
91 | 91 | } |
92 | 92 | if (!function_exists('mb_strstr')) { |
93 | - function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string|false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
93 | + function mb_strstr(?string $haystack, ?string $needle, ?bool $before_needle = false, ?string $encoding = null): string | false { return p\Mbstring::mb_strstr((string) $haystack, (string) $needle, (bool) $before_needle, $encoding); } |
|
94 | 94 | } |
95 | 95 | if (!function_exists('mb_get_info')) { |
96 | - function mb_get_info(?string $type = 'all'): array|string|int|false|null { return p\Mbstring::mb_get_info((string) $type); } |
|
96 | + function mb_get_info(?string $type = 'all'): array | string | int | false | null { return p\Mbstring::mb_get_info((string) $type); } |
|
97 | 97 | } |
98 | 98 | if (!function_exists('mb_http_output')) { |
99 | - function mb_http_output(?string $encoding = null): string|bool { return p\Mbstring::mb_http_output($encoding); } |
|
99 | + function mb_http_output(?string $encoding = null): string | bool { return p\Mbstring::mb_http_output($encoding); } |
|
100 | 100 | } |
101 | 101 | if (!function_exists('mb_strwidth')) { |
102 | 102 | function mb_strwidth(?string $string, ?string $encoding = null): int { return p\Mbstring::mb_strwidth((string) $string, $encoding); } |
@@ -108,18 +108,18 @@ discard block |
||
108 | 108 | function mb_output_handler(?string $string, ?int $status): string { return p\Mbstring::mb_output_handler((string) $string, (int) $status); } |
109 | 109 | } |
110 | 110 | if (!function_exists('mb_http_input')) { |
111 | - function mb_http_input(?string $type = null): array|string|false { return p\Mbstring::mb_http_input($type); } |
|
111 | + function mb_http_input(?string $type = null): array | string | false { return p\Mbstring::mb_http_input($type); } |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | if (!function_exists('mb_convert_variables')) { |
115 | - function mb_convert_variables(?string $to_encoding, array|string|null $from_encoding, mixed &$var, mixed &...$vars): string|false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); } |
|
115 | + function mb_convert_variables(?string $to_encoding, array | string | null $from_encoding, mixed &$var, mixed &...$vars): string | false { return p\Mbstring::mb_convert_variables((string) $to_encoding, $from_encoding ?? '', $var, ...$vars); } |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | if (!function_exists('mb_ord')) { |
119 | - function mb_ord(?string $string, ?string $encoding = null): int|false { return p\Mbstring::mb_ord((string) $string, $encoding); } |
|
119 | + function mb_ord(?string $string, ?string $encoding = null): int | false { return p\Mbstring::mb_ord((string) $string, $encoding); } |
|
120 | 120 | } |
121 | 121 | if (!function_exists('mb_chr')) { |
122 | - function mb_chr(?int $codepoint, ?string $encoding = null): string|false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); } |
|
122 | + function mb_chr(?int $codepoint, ?string $encoding = null): string | false { return p\Mbstring::mb_chr((int) $codepoint, $encoding); } |
|
123 | 123 | } |
124 | 124 | if (!function_exists('mb_scrub')) { |
125 | 125 | function mb_scrub(?string $string, ?string $encoding = null): string { $encoding ??= mb_internal_encoding(); return mb_convert_encoding((string) $string, $encoding, $encoding); } |
@@ -51,14 +51,14 @@ |
||
51 | 51 | |
52 | 52 | /* @var SubscribedService $attribute */ |
53 | 53 | $attribute = $attribute->newInstance(); |
54 | - $attribute->key ??= self::class.'::'.$method->name; |
|
54 | + $attribute->key ??= self::class . '::' . $method->name; |
|
55 | 55 | $attribute->type ??= $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType; |
56 | 56 | $attribute->nullable = $returnType->allowsNull(); |
57 | 57 | |
58 | 58 | if ($attribute->attributes) { |
59 | 59 | $services[] = $attribute; |
60 | 60 | } else { |
61 | - $services[$attribute->key] = ($attribute->nullable ? '?' : '').$attribute->type; |
|
61 | + $services[$attribute->key] = ($attribute->nullable ? '?' : '') . $attribute->type; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | foreach ($paths as $path) { |
60 | 60 | if (preg_match('/\.php$/i', $path)) { |
61 | 61 | // Prevent variable leak into deploy.php file |
62 | - call_user_func(function () use ($path) { |
|
62 | + call_user_func(function() use ($path) { |
|
63 | 63 | // Reorder autoload stack |
64 | 64 | $originStack = spl_autoload_functions(); |
65 | 65 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | } elseif (preg_match('/\.ya?ml$/i', $path)) { |
77 | 77 | self::$recipeFilename = basename($path); |
78 | 78 | self::$recipeSource = file_get_contents($path, true); |
79 | - $root = array_filter(Yaml::parse(self::$recipeSource), static function (string $key) { |
|
79 | + $root = array_filter(Yaml::parse(self::$recipeSource), static function(string $key) { |
|
80 | 80 | return substr($key, 0, 1) !== '.'; |
81 | 81 | }, ARRAY_FILTER_USE_KEY); |
82 | 82 | |
@@ -131,17 +131,17 @@ discard block |
||
131 | 131 | |
132 | 132 | protected static function tasks(array $tasks) |
133 | 133 | { |
134 | - $buildTask = function ($name, $steps) { |
|
135 | - $body = function () {}; |
|
134 | + $buildTask = function($name, $steps) { |
|
135 | + $body = function() {}; |
|
136 | 136 | $task = task($name, $body); |
137 | 137 | |
138 | 138 | foreach ($steps as $step) { |
139 | - $buildStep = function ($step) use (&$body, $task) { |
|
139 | + $buildStep = function($step) use (&$body, $task) { |
|
140 | 140 | extract($step); |
141 | 141 | |
142 | 142 | if (isset($cd)) { |
143 | 143 | $prev = $body; |
144 | - $body = function () use ($cd, $prev) { |
|
144 | + $body = function() use ($cd, $prev) { |
|
145 | 145 | $prev(); |
146 | 146 | cd($cd); |
147 | 147 | }; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | if (isset($run)) { |
151 | 151 | $has = 'run'; |
152 | 152 | $prev = $body; |
153 | - $body = function () use ($run, $prev) { |
|
153 | + $body = function() use ($run, $prev) { |
|
154 | 154 | $prev(); |
155 | 155 | try { |
156 | 156 | run($run); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | $has = 'run_locally'; |
170 | 170 | $prev = $body; |
171 | - $body = function () use ($run_locally, $prev) { |
|
171 | + $body = function() use ($run_locally, $prev) { |
|
172 | 172 | $prev(); |
173 | 173 | try { |
174 | 174 | runLocally($run_locally); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | } |
187 | 187 | $has = 'upload'; |
188 | 188 | $prev = $body; |
189 | - $body = function () use ($upload, $prev) { |
|
189 | + $body = function() use ($upload, $prev) { |
|
190 | 190 | $prev(); |
191 | 191 | upload($upload['src'], $upload['dest']); |
192 | 192 | }; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | } |
199 | 199 | $has = 'download'; |
200 | 200 | $prev = $body; |
201 | - $body = function () use ($download, $prev) { |
|
201 | + $body = function() use ($download, $prev) { |
|
202 | 202 | $prev(); |
203 | 203 | download($download['src'], $download['dest']); |
204 | 204 | }; |
@@ -120,7 +120,7 @@ |
||
120 | 120 | |
121 | 121 | usort( |
122 | 122 | $updates, |
123 | - function (Update $a, Update $b) { |
|
123 | + function(Update $a, Update $b) { |
|
124 | 124 | return Comparator::isGreaterThan( |
125 | 125 | $a->getVersion(), |
126 | 126 | $b->getVersion(), |
@@ -88,7 +88,7 @@ |
||
88 | 88 | ->setTimeout((null === $config['timeout']) ? null : (float) $config['timeout']) |
89 | 89 | ->setIdleTimeout((null === $config['idle_timeout']) ? null : (float) $config['idle_timeout']); |
90 | 90 | |
91 | - $callback = function ($type, $buffer) use ($config, $host) { |
|
91 | + $callback = function($type, $buffer) use ($config, $host) { |
|
92 | 92 | $this->logger->printBuffer($host, $type, $buffer); |
93 | 93 | $this->pop->callback($host, boolval($config['real_time_output']))($type, $buffer); |
94 | 94 | }; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $dealersHand = []; |
81 | 81 | $playersHand = []; |
82 | 82 | shuffle($deck); |
83 | - $deal = function () use (&$deck, &$graveyard) { |
|
83 | + $deal = function() use (&$deck, &$graveyard) { |
|
84 | 84 | if (count($deck) == 0) { |
85 | 85 | shuffle($graveyard); |
86 | 86 | $deck = $graveyard; |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | } |
288 | 288 | $variants = [$value]; |
289 | 289 | while ($aces-- > 0) { |
290 | - $variants = array_flatten(array_map(function ($v) { |
|
290 | + $variants = array_flatten(array_map(function($v) { |
|
291 | 291 | return [$v + 1, $v + 11]; |
292 | 292 | }, $variants)); |
293 | 293 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | function array_flatten(array $array) |
20 | 20 | { |
21 | 21 | $flatten = []; |
22 | - array_walk_recursive($array, function ($value) use (&$flatten) { |
|
22 | + array_walk_recursive($array, function($value) use (&$flatten) { |
|
23 | 23 | $flatten[] = $value; |
24 | 24 | }); |
25 | 25 | return $flatten; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | function env_stringify(array $array): string |
89 | 89 | { |
90 | 90 | return implode(' ', array_map( |
91 | - function ($key, $value) { |
|
91 | + function($key, $value) { |
|
92 | 92 | return sprintf("%s=%s", $key, escapeshellarg((string) $value)); |
93 | 93 | }, |
94 | 94 | array_keys($array), |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | if (getenv('COLORTERM') === 'truecolor') { |
182 | - $hsv = function ($h, $s, $v) { |
|
182 | + $hsv = function($h, $s, $v) { |
|
183 | 183 | $r = $g = $b = $i = $f = $p = $q = $t = 0; |
184 | 184 | $i = floor($h * 6); |
185 | 185 | $f = $h * 6 - $i; |