@@ -622,22 +622,22 @@ discard block |
||
622 | 622 | * @psalm-suppress PossiblyNullArrayAccess |
623 | 623 | */ |
624 | 624 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
625 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
625 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
626 | 626 | } elseif ($code_point <= 0xFFFF) { |
627 | 627 | /** |
628 | 628 | * @psalm-suppress PossiblyNullArrayAccess |
629 | 629 | */ |
630 | 630 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
631 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
632 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
631 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
632 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
633 | 633 | } else { |
634 | 634 | /** |
635 | 635 | * @psalm-suppress PossiblyNullArrayAccess |
636 | 636 | */ |
637 | 637 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
638 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
639 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
640 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
638 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
639 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
640 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | if ($encoding !== 'UTF-8') { |
@@ -2447,10 +2447,10 @@ discard block |
||
2447 | 2447 | } |
2448 | 2448 | |
2449 | 2449 | $unique_helper = $rand_int . |
2450 | - \session_id() . |
|
2451 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2452 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2453 | - $extra_entropy; |
|
2450 | + \session_id() . |
|
2451 | + ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2452 | + ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2453 | + $extra_entropy; |
|
2454 | 2454 | |
2455 | 2455 | $unique_string = \uniqid($unique_helper, true); |
2456 | 2456 | |
@@ -6307,8 +6307,8 @@ discard block |
||
6307 | 6307 | |
6308 | 6308 | /** @noinspection UnnecessaryCastingInspection */ |
6309 | 6309 | return (string) \mb_substr($str, 0, $index) . |
6310 | - $substring . |
|
6311 | - (string) \mb_substr($str, $index, $len); |
|
6310 | + $substring . |
|
6311 | + (string) \mb_substr($str, $index, $len); |
|
6312 | 6312 | } |
6313 | 6313 | |
6314 | 6314 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -6319,8 +6319,8 @@ discard block |
||
6319 | 6319 | } |
6320 | 6320 | |
6321 | 6321 | return ((string) self::substr($str, 0, $index, $encoding)) . |
6322 | - $substring . |
|
6323 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6322 | + $substring . |
|
6323 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
6324 | 6324 | } |
6325 | 6325 | |
6326 | 6326 | /** |
@@ -8492,11 +8492,11 @@ discard block |
||
8492 | 8492 | if ($use_mb_functions) { |
8493 | 8493 | if ($encoding === 'UTF-8') { |
8494 | 8494 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
8495 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
8495 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
8496 | 8496 | } |
8497 | 8497 | |
8498 | 8498 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
8499 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
8499 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
8500 | 8500 | } |
8501 | 8501 | |
8502 | 8502 | return self::ucfirst( |
@@ -8898,13 +8898,13 @@ discard block |
||
8898 | 8898 | } |
8899 | 8899 | |
8900 | 8900 | return ( |
8901 | - (string) self::substr( |
|
8902 | - $str, |
|
8903 | - 0, |
|
8904 | - $length, |
|
8905 | - $encoding |
|
8906 | - ) |
|
8907 | - ) . $substring; |
|
8901 | + (string) self::substr( |
|
8902 | + $str, |
|
8903 | + 0, |
|
8904 | + $length, |
|
8905 | + $encoding |
|
8906 | + ) |
|
8907 | + ) . $substring; |
|
8908 | 8908 | } |
8909 | 8909 | |
8910 | 8910 | /** |
@@ -11937,8 +11937,8 @@ discard block |
||
11937 | 11937 | |
11938 | 11938 | /** @noinspection AdditionOperationOnArraysInspection */ |
11939 | 11939 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
11940 | - $replacement . |
|
11941 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11940 | + $replacement . |
|
11941 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11942 | 11942 | } |
11943 | 11943 | |
11944 | 11944 | // |
@@ -245,10 +245,10 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | if ($encoding === 'UTF-8') { |
248 | - return (string) \mb_substr($str, $pos, 1); |
|
248 | + return (string)\mb_substr($str, $pos, 1); |
|
249 | 249 | } |
250 | 250 | |
251 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
251 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | public static function add_bom_to_string(string $str): string |
267 | 267 | { |
268 | 268 | if (!self::string_has_bom($str)) { |
269 | - $str = self::bom() . $str; |
|
269 | + $str = self::bom().$str; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | return $str; |
@@ -301,8 +301,8 @@ discard block |
||
301 | 301 | $return = []; |
302 | 302 | foreach ($array as $key => &$value) { |
303 | 303 | $key = $case === \CASE_LOWER |
304 | - ? self::strtolower((string) $key, $encoding) |
|
305 | - : self::strtoupper((string) $key, $encoding); |
|
304 | + ? self::strtolower((string)$key, $encoding) |
|
305 | + : self::strtoupper((string)$key, $encoding); |
|
306 | 306 | |
307 | 307 | $return[$key] = $value; |
308 | 308 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | return ''; |
339 | 339 | } |
340 | 340 | |
341 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
341 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
342 | 342 | $end_position = \mb_strpos($str, $end, $substr_index); |
343 | 343 | if ( |
344 | 344 | $end_position === false |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | return ''; |
349 | 349 | } |
350 | 350 | |
351 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
351 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | return ''; |
359 | 359 | } |
360 | 360 | |
361 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
361 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
362 | 362 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
363 | 363 | if ( |
364 | 364 | $end_position === false |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | return ''; |
369 | 369 | } |
370 | 370 | |
371 | - return (string) self::substr( |
|
371 | + return (string)self::substr( |
|
372 | 372 | $str, |
373 | 373 | $substr_index, |
374 | 374 | $end_position - $substr_index, |
@@ -446,10 +446,10 @@ discard block |
||
446 | 446 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
447 | 447 | { |
448 | 448 | if ($encoding === 'UTF-8') { |
449 | - return (string) \mb_substr($str, $index, 1); |
|
449 | + return (string)\mb_substr($str, $index, 1); |
|
450 | 450 | } |
451 | 451 | |
452 | - return (string) self::substr($str, $index, 1, $encoding); |
|
452 | + return (string)self::substr($str, $index, 1, $encoding); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | /** |
@@ -562,10 +562,10 @@ discard block |
||
562 | 562 | /** |
563 | 563 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
564 | 564 | */ |
565 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
565 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
566 | 566 | } |
567 | 567 | |
568 | - $cache_key = $code_point . '_' . $encoding; |
|
568 | + $cache_key = $code_point.'_'.$encoding; |
|
569 | 569 | if (isset($CHAR_CACHE[$cache_key])) { |
570 | 570 | return $CHAR_CACHE[$cache_key]; |
571 | 571 | } |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | self::$CHR = self::getData('chr'); |
612 | 612 | } |
613 | 613 | |
614 | - $code_point = (int) $code_point; |
|
614 | + $code_point = (int)$code_point; |
|
615 | 615 | if ($code_point <= 0x7F) { |
616 | 616 | /** |
617 | 617 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -621,22 +621,22 @@ discard block |
||
621 | 621 | /** |
622 | 622 | * @psalm-suppress PossiblyNullArrayAccess |
623 | 623 | */ |
624 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
624 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
625 | 625 | self::$CHR[($code_point & 0x3F) + 0x80]; |
626 | 626 | } elseif ($code_point <= 0xFFFF) { |
627 | 627 | /** |
628 | 628 | * @psalm-suppress PossiblyNullArrayAccess |
629 | 629 | */ |
630 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
631 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
630 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
631 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
632 | 632 | self::$CHR[($code_point & 0x3F) + 0x80]; |
633 | 633 | } else { |
634 | 634 | /** |
635 | 635 | * @psalm-suppress PossiblyNullArrayAccess |
636 | 636 | */ |
637 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
638 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
639 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
637 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
638 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
639 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
640 | 640 | self::$CHR[($code_point & 0x3F) + 0x80]; |
641 | 641 | } |
642 | 642 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | |
690 | 690 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
691 | 691 | return \array_map( |
692 | - static function (string $data): int { |
|
692 | + static function(string $data): int { |
|
693 | 693 | // "mb_" is available if overload is used, so use it ... |
694 | 694 | return \mb_strlen($data, 'CP850'); // 8-BIT |
695 | 695 | }, |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | $char = ''; |
771 | 771 | } |
772 | 772 | |
773 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
773 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | /** |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
864 | 864 | /x'; |
865 | 865 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
866 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
866 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
867 | 867 | |
868 | 868 | if ($replace_diamond_question_mark) { |
869 | 869 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | public static function cleanup($str): string |
901 | 901 | { |
902 | 902 | // init |
903 | - $str = (string) $str; |
|
903 | + $str = (string)$str; |
|
904 | 904 | |
905 | 905 | if ($str === '') { |
906 | 906 | return ''; |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | { |
998 | 998 | if (self::$SUPPORT['mbstring'] === true) { |
999 | 999 | /** @noinspection PhpComposerExtensionStubsInspection */ |
1000 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1000 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | */ |
1043 | 1043 | public static function css_stripe_media_queries(string $str): string |
1044 | 1044 | { |
1045 | - return (string) \preg_replace( |
|
1045 | + return (string)\preg_replace( |
|
1046 | 1046 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
1047 | 1047 | '', |
1048 | 1048 | $str |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | */ |
1074 | 1074 | public static function decimal_to_chr($int): string |
1075 | 1075 | { |
1076 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
1076 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
1077 | 1077 | } |
1078 | 1078 | |
1079 | 1079 | /** |
@@ -1117,16 +1117,16 @@ discard block |
||
1117 | 1117 | self::initEmojiData(); |
1118 | 1118 | |
1119 | 1119 | if ($use_reversible_string_mappings) { |
1120 | - return (string) \str_replace( |
|
1121 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1122 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1120 | + return (string)\str_replace( |
|
1121 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1122 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1123 | 1123 | $str |
1124 | 1124 | ); |
1125 | 1125 | } |
1126 | 1126 | |
1127 | - return (string) \str_replace( |
|
1128 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1129 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1127 | + return (string)\str_replace( |
|
1128 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1129 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1130 | 1130 | $str |
1131 | 1131 | ); |
1132 | 1132 | } |
@@ -1150,16 +1150,16 @@ discard block |
||
1150 | 1150 | self::initEmojiData(); |
1151 | 1151 | |
1152 | 1152 | if ($use_reversible_string_mappings) { |
1153 | - return (string) \str_replace( |
|
1154 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1155 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1153 | + return (string)\str_replace( |
|
1154 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1155 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1156 | 1156 | $str |
1157 | 1157 | ); |
1158 | 1158 | } |
1159 | 1159 | |
1160 | - return (string) \str_replace( |
|
1161 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1162 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1160 | + return (string)\str_replace( |
|
1161 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1162 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1163 | 1163 | $str |
1164 | 1164 | ); |
1165 | 1165 | } |
@@ -1215,7 +1215,7 @@ discard block |
||
1215 | 1215 | if ($to_encoding === 'JSON') { |
1216 | 1216 | $return = self::json_encode($str); |
1217 | 1217 | if ($return === false) { |
1218 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1218 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1219 | 1219 | } |
1220 | 1220 | |
1221 | 1221 | return $return; |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | /** |
1306 | 1306 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
1307 | 1307 | */ |
1308 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1308 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1309 | 1309 | } |
1310 | 1310 | |
1311 | 1311 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1403,31 +1403,31 @@ discard block |
||
1403 | 1403 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1404 | 1404 | |
1405 | 1405 | if ($length === null) { |
1406 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
1406 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
1407 | 1407 | } |
1408 | 1408 | |
1409 | 1409 | if ($search === '') { |
1410 | 1410 | if ($encoding === 'UTF-8') { |
1411 | 1411 | if ($length > 0) { |
1412 | - $string_length = (int) \mb_strlen($str); |
|
1412 | + $string_length = (int)\mb_strlen($str); |
|
1413 | 1413 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1414 | 1414 | } else { |
1415 | 1415 | $end = 0; |
1416 | 1416 | } |
1417 | 1417 | |
1418 | - $pos = (int) \min( |
|
1418 | + $pos = (int)\min( |
|
1419 | 1419 | \mb_strpos($str, ' ', $end), |
1420 | 1420 | \mb_strpos($str, '.', $end) |
1421 | 1421 | ); |
1422 | 1422 | } else { |
1423 | 1423 | if ($length > 0) { |
1424 | - $string_length = (int) self::strlen($str, $encoding); |
|
1424 | + $string_length = (int)self::strlen($str, $encoding); |
|
1425 | 1425 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1426 | 1426 | } else { |
1427 | 1427 | $end = 0; |
1428 | 1428 | } |
1429 | 1429 | |
1430 | - $pos = (int) \min( |
|
1430 | + $pos = (int)\min( |
|
1431 | 1431 | self::strpos($str, ' ', $end, $encoding), |
1432 | 1432 | self::strpos($str, '.', $end, $encoding) |
1433 | 1433 | ); |
@@ -1444,18 +1444,18 @@ discard block |
||
1444 | 1444 | return ''; |
1445 | 1445 | } |
1446 | 1446 | |
1447 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1447 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1448 | 1448 | } |
1449 | 1449 | |
1450 | 1450 | return $str; |
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | if ($encoding === 'UTF-8') { |
1454 | - $word_position = (int) \mb_stripos($str, $search); |
|
1455 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1454 | + $word_position = (int)\mb_stripos($str, $search); |
|
1455 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1456 | 1456 | } else { |
1457 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1458 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1457 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1458 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1459 | 1459 | } |
1460 | 1460 | |
1461 | 1461 | $pos_start = 0; |
@@ -1467,12 +1467,12 @@ discard block |
||
1467 | 1467 | } |
1468 | 1468 | if ($half_text !== false) { |
1469 | 1469 | if ($encoding === 'UTF-8') { |
1470 | - $pos_start = (int) \max( |
|
1470 | + $pos_start = (int)\max( |
|
1471 | 1471 | \mb_strrpos($half_text, ' '), |
1472 | 1472 | \mb_strrpos($half_text, '.') |
1473 | 1473 | ); |
1474 | 1474 | } else { |
1475 | - $pos_start = (int) \max( |
|
1475 | + $pos_start = (int)\max( |
|
1476 | 1476 | self::strrpos($half_text, ' ', 0, $encoding), |
1477 | 1477 | self::strrpos($half_text, '.', 0, $encoding) |
1478 | 1478 | ); |
@@ -1482,19 +1482,19 @@ discard block |
||
1482 | 1482 | |
1483 | 1483 | if ($word_position && $half_side > 0) { |
1484 | 1484 | $offset = $pos_start + $length - 1; |
1485 | - $real_length = (int) self::strlen($str, $encoding); |
|
1485 | + $real_length = (int)self::strlen($str, $encoding); |
|
1486 | 1486 | |
1487 | 1487 | if ($offset > $real_length) { |
1488 | 1488 | $offset = $real_length; |
1489 | 1489 | } |
1490 | 1490 | |
1491 | 1491 | if ($encoding === 'UTF-8') { |
1492 | - $pos_end = (int) \min( |
|
1492 | + $pos_end = (int)\min( |
|
1493 | 1493 | \mb_strpos($str, ' ', $offset), |
1494 | 1494 | \mb_strpos($str, '.', $offset) |
1495 | 1495 | ) - $pos_start; |
1496 | 1496 | } else { |
1497 | - $pos_end = (int) \min( |
|
1497 | + $pos_end = (int)\min( |
|
1498 | 1498 | self::strpos($str, ' ', $offset, $encoding), |
1499 | 1499 | self::strpos($str, '.', $offset, $encoding) |
1500 | 1500 | ) - $pos_start; |
@@ -1502,12 +1502,12 @@ discard block |
||
1502 | 1502 | |
1503 | 1503 | if (!$pos_end || $pos_end <= 0) { |
1504 | 1504 | if ($encoding === 'UTF-8') { |
1505 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1505 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1506 | 1506 | } else { |
1507 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1507 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1508 | 1508 | } |
1509 | 1509 | if ($str_sub !== false) { |
1510 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1510 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1511 | 1511 | } else { |
1512 | 1512 | $extract = ''; |
1513 | 1513 | } |
@@ -1518,26 +1518,26 @@ discard block |
||
1518 | 1518 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1519 | 1519 | } |
1520 | 1520 | if ($str_sub !== false) { |
1521 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1521 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1522 | 1522 | } else { |
1523 | 1523 | $extract = ''; |
1524 | 1524 | } |
1525 | 1525 | } |
1526 | 1526 | } else { |
1527 | 1527 | $offset = $length - 1; |
1528 | - $true_length = (int) self::strlen($str, $encoding); |
|
1528 | + $true_length = (int)self::strlen($str, $encoding); |
|
1529 | 1529 | |
1530 | 1530 | if ($offset > $true_length) { |
1531 | 1531 | $offset = $true_length; |
1532 | 1532 | } |
1533 | 1533 | |
1534 | 1534 | if ($encoding === 'UTF-8') { |
1535 | - $pos_end = (int) \min( |
|
1535 | + $pos_end = (int)\min( |
|
1536 | 1536 | \mb_strpos($str, ' ', $offset), |
1537 | 1537 | \mb_strpos($str, '.', $offset) |
1538 | 1538 | ); |
1539 | 1539 | } else { |
1540 | - $pos_end = (int) \min( |
|
1540 | + $pos_end = (int)\min( |
|
1541 | 1541 | self::strpos($str, ' ', $offset, $encoding), |
1542 | 1542 | self::strpos($str, '.', $offset, $encoding) |
1543 | 1543 | ); |
@@ -1550,7 +1550,7 @@ discard block |
||
1550 | 1550 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1551 | 1551 | } |
1552 | 1552 | if ($str_sub !== false) { |
1553 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1553 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1554 | 1554 | } else { |
1555 | 1555 | $extract = ''; |
1556 | 1556 | } |
@@ -1679,7 +1679,7 @@ discard block |
||
1679 | 1679 | { |
1680 | 1680 | $file_content = \file_get_contents($file_path); |
1681 | 1681 | if ($file_content === false) { |
1682 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1682 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1683 | 1683 | } |
1684 | 1684 | |
1685 | 1685 | return self::string_has_bom($file_content); |
@@ -1739,7 +1739,7 @@ discard block |
||
1739 | 1739 | ) { |
1740 | 1740 | // Prevent leading combining chars |
1741 | 1741 | // for NFC-safe concatenations. |
1742 | - $var = $leading_combining . $var; |
|
1742 | + $var = $leading_combining.$var; |
|
1743 | 1743 | } |
1744 | 1744 | } |
1745 | 1745 | |
@@ -2024,10 +2024,10 @@ discard block |
||
2024 | 2024 | } |
2025 | 2025 | |
2026 | 2026 | if ($encoding === 'UTF-8') { |
2027 | - return (string) \mb_substr($str, 0, $n); |
|
2027 | + return (string)\mb_substr($str, 0, $n); |
|
2028 | 2028 | } |
2029 | 2029 | |
2030 | - return (string) self::substr($str, 0, $n, $encoding); |
|
2030 | + return (string)self::substr($str, 0, $n, $encoding); |
|
2031 | 2031 | } |
2032 | 2032 | |
2033 | 2033 | /** |
@@ -2043,7 +2043,7 @@ discard block |
||
2043 | 2043 | */ |
2044 | 2044 | public static function fits_inside(string $str, int $box_size): bool |
2045 | 2045 | { |
2046 | - return (int) self::strlen($str) <= $box_size; |
|
2046 | + return (int)self::strlen($str) <= $box_size; |
|
2047 | 2047 | } |
2048 | 2048 | |
2049 | 2049 | /** |
@@ -2122,7 +2122,7 @@ discard block |
||
2122 | 2122 | return $str; |
2123 | 2123 | } |
2124 | 2124 | |
2125 | - $str = (string) $str; |
|
2125 | + $str = (string)$str; |
|
2126 | 2126 | $last = ''; |
2127 | 2127 | while ($last !== $str) { |
2128 | 2128 | $last = $str; |
@@ -2329,7 +2329,7 @@ discard block |
||
2329 | 2329 | return $fallback; |
2330 | 2330 | } |
2331 | 2331 | /** @noinspection OffsetOperationsInspection */ |
2332 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2332 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2333 | 2333 | |
2334 | 2334 | // DEBUG |
2335 | 2335 | //var_dump($type_code); |
@@ -2387,7 +2387,7 @@ discard block |
||
2387 | 2387 | // |
2388 | 2388 | |
2389 | 2389 | if ($encoding === 'UTF-8') { |
2390 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2390 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2391 | 2391 | if ($max_length === 0) { |
2392 | 2392 | return ''; |
2393 | 2393 | } |
@@ -2408,7 +2408,7 @@ discard block |
||
2408 | 2408 | } else { |
2409 | 2409 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2410 | 2410 | |
2411 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2411 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2412 | 2412 | if ($max_length === 0) { |
2413 | 2413 | return ''; |
2414 | 2414 | } |
@@ -2446,16 +2446,16 @@ discard block |
||
2446 | 2446 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
2447 | 2447 | } |
2448 | 2448 | |
2449 | - $unique_helper = $rand_int . |
|
2450 | - \session_id() . |
|
2451 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2452 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2449 | + $unique_helper = $rand_int. |
|
2450 | + \session_id(). |
|
2451 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2452 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2453 | 2453 | $extra_entropy; |
2454 | 2454 | |
2455 | 2455 | $unique_string = \uniqid($unique_helper, true); |
2456 | 2456 | |
2457 | 2457 | if ($use_md5) { |
2458 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2458 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2459 | 2459 | } |
2460 | 2460 | |
2461 | 2461 | return $unique_string; |
@@ -2566,7 +2566,7 @@ discard block |
||
2566 | 2566 | public static function hex_to_int($hexdec) |
2567 | 2567 | { |
2568 | 2568 | // init |
2569 | - $hexdec = (string) $hexdec; |
|
2569 | + $hexdec = (string)$hexdec; |
|
2570 | 2570 | |
2571 | 2571 | if ($hexdec === '') { |
2572 | 2572 | return false; |
@@ -2663,7 +2663,7 @@ discard block |
||
2663 | 2663 | return \implode( |
2664 | 2664 | '', |
2665 | 2665 | \array_map( |
2666 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2666 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2667 | 2667 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2668 | 2668 | }, |
2669 | 2669 | self::str_split($str) |
@@ -2775,7 +2775,7 @@ discard block |
||
2775 | 2775 | /** |
2776 | 2776 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
2777 | 2777 | */ |
2778 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2778 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2779 | 2779 | } |
2780 | 2780 | |
2781 | 2781 | do { |
@@ -2784,7 +2784,7 @@ discard block |
||
2784 | 2784 | if (\strpos($str, '&') !== false) { |
2785 | 2785 | if (\strpos($str, '&#') !== false) { |
2786 | 2786 | // decode also numeric & UTF16 two byte entities |
2787 | - $str = (string) \preg_replace( |
|
2787 | + $str = (string)\preg_replace( |
|
2788 | 2788 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2789 | 2789 | '$1;', |
2790 | 2790 | $str |
@@ -2834,7 +2834,7 @@ discard block |
||
2834 | 2834 | */ |
2835 | 2835 | public static function html_stripe_empty_tags(string $str): string |
2836 | 2836 | { |
2837 | - return (string) \preg_replace( |
|
2837 | + return (string)\preg_replace( |
|
2838 | 2838 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
2839 | 2839 | '', |
2840 | 2840 | $str |
@@ -3154,9 +3154,9 @@ discard block |
||
3154 | 3154 | { |
3155 | 3155 | $hex = \dechex($int); |
3156 | 3156 | |
3157 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
3157 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
3158 | 3158 | |
3159 | - return $prefix . $hex . ''; |
|
3159 | + return $prefix.$hex.''; |
|
3160 | 3160 | } |
3161 | 3161 | |
3162 | 3162 | /** |
@@ -3477,7 +3477,7 @@ discard block |
||
3477 | 3477 | */ |
3478 | 3478 | public static function is_binary($input, bool $strict = false): bool |
3479 | 3479 | { |
3480 | - $input = (string) $input; |
|
3480 | + $input = (string)$input; |
|
3481 | 3481 | if ($input === '') { |
3482 | 3482 | return false; |
3483 | 3483 | } |
@@ -3821,7 +3821,7 @@ discard block |
||
3821 | 3821 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
3822 | 3822 | { |
3823 | 3823 | // init |
3824 | - $str = (string) $str; |
|
3824 | + $str = (string)$str; |
|
3825 | 3825 | $str_chars = []; |
3826 | 3826 | |
3827 | 3827 | if ( |
@@ -3907,7 +3907,7 @@ discard block |
||
3907 | 3907 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
3908 | 3908 | { |
3909 | 3909 | // init |
3910 | - $str = (string) $str; |
|
3910 | + $str = (string)$str; |
|
3911 | 3911 | $str_chars = []; |
3912 | 3912 | |
3913 | 3913 | if ( |
@@ -3999,7 +3999,7 @@ discard block |
||
3999 | 3999 | return true; |
4000 | 4000 | } |
4001 | 4001 | |
4002 | - return self::is_utf8_string((string) $str, $strict); |
|
4002 | + return self::is_utf8_string((string)$str, $strict); |
|
4003 | 4003 | } |
4004 | 4004 | |
4005 | 4005 | /** |
@@ -4149,15 +4149,15 @@ discard block |
||
4149 | 4149 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
4150 | 4150 | |
4151 | 4151 | if ($encoding === 'UTF-8') { |
4152 | - $str_part_two = (string) \mb_substr($str, 1); |
|
4152 | + $str_part_two = (string)\mb_substr($str, 1); |
|
4153 | 4153 | |
4154 | 4154 | if ($use_mb_functions) { |
4155 | 4155 | $str_part_one = \mb_strtolower( |
4156 | - (string) \mb_substr($str, 0, 1) |
|
4156 | + (string)\mb_substr($str, 0, 1) |
|
4157 | 4157 | ); |
4158 | 4158 | } else { |
4159 | 4159 | $str_part_one = self::strtolower( |
4160 | - (string) \mb_substr($str, 0, 1), |
|
4160 | + (string)\mb_substr($str, 0, 1), |
|
4161 | 4161 | $encoding, |
4162 | 4162 | false, |
4163 | 4163 | $lang, |
@@ -4167,10 +4167,10 @@ discard block |
||
4167 | 4167 | } else { |
4168 | 4168 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4169 | 4169 | |
4170 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
4170 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
4171 | 4171 | |
4172 | 4172 | $str_part_one = self::strtolower( |
4173 | - (string) self::substr($str, 0, 1, $encoding), |
|
4173 | + (string)self::substr($str, 0, 1, $encoding), |
|
4174 | 4174 | $encoding, |
4175 | 4175 | false, |
4176 | 4176 | $lang, |
@@ -4178,7 +4178,7 @@ discard block |
||
4178 | 4178 | ); |
4179 | 4179 | } |
4180 | 4180 | |
4181 | - return $str_part_one . $str_part_two; |
|
4181 | + return $str_part_one.$str_part_two; |
|
4182 | 4182 | } |
4183 | 4183 | |
4184 | 4184 | /** |
@@ -4325,7 +4325,7 @@ discard block |
||
4325 | 4325 | } |
4326 | 4326 | |
4327 | 4327 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4328 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4328 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4329 | 4329 | } |
4330 | 4330 | |
4331 | 4331 | if ($chars) { |
@@ -4378,7 +4378,7 @@ discard block |
||
4378 | 4378 | { |
4379 | 4379 | $bytes = self::chr_size_list($str); |
4380 | 4380 | if ($bytes !== []) { |
4381 | - return (int) \max($bytes); |
|
4381 | + return (int)\max($bytes); |
|
4382 | 4382 | } |
4383 | 4383 | |
4384 | 4384 | return 0; |
@@ -4460,7 +4460,7 @@ discard block |
||
4460 | 4460 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4461 | 4461 | |
4462 | 4462 | // init |
4463 | - $encoding = (string) $encoding; |
|
4463 | + $encoding = (string)$encoding; |
|
4464 | 4464 | |
4465 | 4465 | if (!$encoding) { |
4466 | 4466 | return $fallback; |
@@ -4522,7 +4522,7 @@ discard block |
||
4522 | 4522 | |
4523 | 4523 | $encoding_original = $encoding; |
4524 | 4524 | $encoding = \strtoupper($encoding); |
4525 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4525 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4526 | 4526 | |
4527 | 4527 | $equivalences = [ |
4528 | 4528 | 'ISO8859' => 'ISO-8859-1', |
@@ -4680,13 +4680,13 @@ discard block |
||
4680 | 4680 | static $CHAR_CACHE = []; |
4681 | 4681 | |
4682 | 4682 | // init |
4683 | - $chr = (string) $chr; |
|
4683 | + $chr = (string)$chr; |
|
4684 | 4684 | |
4685 | 4685 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4686 | 4686 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4687 | 4687 | } |
4688 | 4688 | |
4689 | - $cache_key = $chr . '_' . $encoding; |
|
4689 | + $cache_key = $chr.'_'.$encoding; |
|
4690 | 4690 | if (isset($CHAR_CACHE[$cache_key])) { |
4691 | 4691 | return $CHAR_CACHE[$cache_key]; |
4692 | 4692 | } |
@@ -4721,7 +4721,7 @@ discard block |
||
4721 | 4721 | // |
4722 | 4722 | |
4723 | 4723 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
4724 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4724 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4725 | 4725 | /** @noinspection OffsetOperationsInspection */ |
4726 | 4726 | $code = $chr ? $chr[1] : 0; |
4727 | 4727 | |
@@ -4729,21 +4729,21 @@ discard block |
||
4729 | 4729 | if ($code >= 0xF0 && isset($chr[4])) { |
4730 | 4730 | /** @noinspection UnnecessaryCastingInspection */ |
4731 | 4731 | /** @noinspection OffsetOperationsInspection */ |
4732 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4732 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
4733 | 4733 | } |
4734 | 4734 | |
4735 | 4735 | /** @noinspection OffsetOperationsInspection */ |
4736 | 4736 | if ($code >= 0xE0 && isset($chr[3])) { |
4737 | 4737 | /** @noinspection UnnecessaryCastingInspection */ |
4738 | 4738 | /** @noinspection OffsetOperationsInspection */ |
4739 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4739 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
4740 | 4740 | } |
4741 | 4741 | |
4742 | 4742 | /** @noinspection OffsetOperationsInspection */ |
4743 | 4743 | if ($code >= 0xC0 && isset($chr[2])) { |
4744 | 4744 | /** @noinspection UnnecessaryCastingInspection */ |
4745 | 4745 | /** @noinspection OffsetOperationsInspection */ |
4746 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4746 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
4747 | 4747 | } |
4748 | 4748 | |
4749 | 4749 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -4800,7 +4800,7 @@ discard block |
||
4800 | 4800 | public static function pcre_utf8_support(): bool |
4801 | 4801 | { |
4802 | 4802 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4803 | - return (bool) @\preg_match('//u', ''); |
|
4803 | + return (bool)@\preg_match('//u', ''); |
|
4804 | 4804 | } |
4805 | 4805 | |
4806 | 4806 | /** |
@@ -4839,14 +4839,14 @@ discard block |
||
4839 | 4839 | * @psalm-suppress DocblockTypeContradiction |
4840 | 4840 | */ |
4841 | 4841 | if (!\is_numeric($step)) { |
4842 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4842 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4843 | 4843 | } |
4844 | 4844 | |
4845 | 4845 | /** |
4846 | 4846 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
4847 | 4847 | */ |
4848 | 4848 | if ($step <= 0) { |
4849 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4849 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4850 | 4850 | } |
4851 | 4851 | } |
4852 | 4852 | |
@@ -4858,14 +4858,14 @@ discard block |
||
4858 | 4858 | $is_xdigit = false; |
4859 | 4859 | |
4860 | 4860 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4861 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4861 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4862 | 4862 | $is_digit = true; |
4863 | - $start = (int) $var1; |
|
4863 | + $start = (int)$var1; |
|
4864 | 4864 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4865 | 4865 | $is_xdigit = true; |
4866 | - $start = (int) self::hex_to_int($var1); |
|
4866 | + $start = (int)self::hex_to_int($var1); |
|
4867 | 4867 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4868 | - $start = (int) $var1; |
|
4868 | + $start = (int)$var1; |
|
4869 | 4869 | } else { |
4870 | 4870 | $start = self::ord($var1); |
4871 | 4871 | } |
@@ -4875,11 +4875,11 @@ discard block |
||
4875 | 4875 | } |
4876 | 4876 | |
4877 | 4877 | if ($is_digit) { |
4878 | - $end = (int) $var2; |
|
4878 | + $end = (int)$var2; |
|
4879 | 4879 | } elseif ($is_xdigit) { |
4880 | - $end = (int) self::hex_to_int($var2); |
|
4880 | + $end = (int)self::hex_to_int($var2); |
|
4881 | 4881 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4882 | - $end = (int) $var2; |
|
4882 | + $end = (int)$var2; |
|
4883 | 4883 | } else { |
4884 | 4884 | $end = self::ord($var2); |
4885 | 4885 | } |
@@ -4890,7 +4890,7 @@ discard block |
||
4890 | 4890 | |
4891 | 4891 | $array = []; |
4892 | 4892 | foreach (\range($start, $end, $step) as $i) { |
4893 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4893 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4894 | 4894 | } |
4895 | 4895 | |
4896 | 4896 | return $array; |
@@ -5000,8 +5000,8 @@ discard block |
||
5000 | 5000 | $delimiter = '/'; |
5001 | 5001 | } |
5002 | 5002 | |
5003 | - return (string) \preg_replace( |
|
5004 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
5003 | + return (string)\preg_replace( |
|
5004 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
5005 | 5005 | $replacement, |
5006 | 5006 | $str |
5007 | 5007 | ); |
@@ -5049,9 +5049,9 @@ discard block |
||
5049 | 5049 | return ''; |
5050 | 5050 | } |
5051 | 5051 | |
5052 | - $str_length -= (int) $bom_byte_length; |
|
5052 | + $str_length -= (int)$bom_byte_length; |
|
5053 | 5053 | |
5054 | - $str = (string) $str_tmp; |
|
5054 | + $str = (string)$str_tmp; |
|
5055 | 5055 | } |
5056 | 5056 | } |
5057 | 5057 | |
@@ -5080,7 +5080,7 @@ discard block |
||
5080 | 5080 | */ |
5081 | 5081 | if (\is_array($what)) { |
5082 | 5082 | foreach ($what as $item) { |
5083 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
5083 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
5084 | 5084 | } |
5085 | 5085 | } |
5086 | 5086 | |
@@ -5118,7 +5118,7 @@ discard block |
||
5118 | 5118 | */ |
5119 | 5119 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
5120 | 5120 | { |
5121 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5121 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5122 | 5122 | } |
5123 | 5123 | |
5124 | 5124 | /** |
@@ -5173,17 +5173,17 @@ discard block |
||
5173 | 5173 | ): string { |
5174 | 5174 | if ($substring && \strpos($str, $substring) === 0) { |
5175 | 5175 | if ($encoding === 'UTF-8') { |
5176 | - return (string) \mb_substr( |
|
5176 | + return (string)\mb_substr( |
|
5177 | 5177 | $str, |
5178 | - (int) \mb_strlen($substring) |
|
5178 | + (int)\mb_strlen($substring) |
|
5179 | 5179 | ); |
5180 | 5180 | } |
5181 | 5181 | |
5182 | 5182 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5183 | 5183 | |
5184 | - return (string) self::substr( |
|
5184 | + return (string)self::substr( |
|
5185 | 5185 | $str, |
5186 | - (int) self::strlen($substring, $encoding), |
|
5186 | + (int)self::strlen($substring, $encoding), |
|
5187 | 5187 | null, |
5188 | 5188 | $encoding |
5189 | 5189 | ); |
@@ -5211,19 +5211,19 @@ discard block |
||
5211 | 5211 | ): string { |
5212 | 5212 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
5213 | 5213 | if ($encoding === 'UTF-8') { |
5214 | - return (string) \mb_substr( |
|
5214 | + return (string)\mb_substr( |
|
5215 | 5215 | $str, |
5216 | 5216 | 0, |
5217 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
5217 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
5218 | 5218 | ); |
5219 | 5219 | } |
5220 | 5220 | |
5221 | 5221 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5222 | 5222 | |
5223 | - return (string) self::substr( |
|
5223 | + return (string)self::substr( |
|
5224 | 5224 | $str, |
5225 | 5225 | 0, |
5226 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
5226 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
5227 | 5227 | $encoding |
5228 | 5228 | ); |
5229 | 5229 | } |
@@ -5322,7 +5322,7 @@ discard block |
||
5322 | 5322 | $save = \mb_substitute_character(); |
5323 | 5323 | \mb_substitute_character($replacement_char_helper); |
5324 | 5324 | // the polyfill maybe return false, so cast to string |
5325 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5325 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5326 | 5326 | \mb_substitute_character($save); |
5327 | 5327 | } |
5328 | 5328 | |
@@ -5366,7 +5366,7 @@ discard block |
||
5366 | 5366 | } |
5367 | 5367 | |
5368 | 5368 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5369 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5369 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5370 | 5370 | } |
5371 | 5371 | |
5372 | 5372 | if ($chars) { |
@@ -5396,7 +5396,7 @@ discard block |
||
5396 | 5396 | $html .= '<pre>'; |
5397 | 5397 | /** @noinspection AlterInForeachInspection */ |
5398 | 5398 | foreach (self::$SUPPORT as $key => &$value) { |
5399 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5399 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
5400 | 5400 | } |
5401 | 5401 | $html .= '</pre>'; |
5402 | 5402 | |
@@ -5436,7 +5436,7 @@ discard block |
||
5436 | 5436 | return $char; |
5437 | 5437 | } |
5438 | 5438 | |
5439 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5439 | + return '&#'.self::ord($char, $encoding).';'; |
|
5440 | 5440 | } |
5441 | 5441 | |
5442 | 5442 | /** |
@@ -5539,11 +5539,11 @@ discard block |
||
5539 | 5539 | $lang, |
5540 | 5540 | $try_to_keep_the_string_length |
5541 | 5541 | ); |
5542 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5542 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5543 | 5543 | |
5544 | 5544 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5545 | 5545 | |
5546 | - $str = (string) \preg_replace_callback( |
|
5546 | + $str = (string)\preg_replace_callback( |
|
5547 | 5547 | '/[-_\\s]+(.)?/u', |
5548 | 5548 | /** |
5549 | 5549 | * @param array $match |
@@ -5552,7 +5552,7 @@ discard block |
||
5552 | 5552 | * |
5553 | 5553 | * @return string |
5554 | 5554 | */ |
5555 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5555 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5556 | 5556 | if (isset($match[1])) { |
5557 | 5557 | if ($use_mb_functions) { |
5558 | 5558 | if ($encoding === 'UTF-8') { |
@@ -5570,7 +5570,7 @@ discard block |
||
5570 | 5570 | $str |
5571 | 5571 | ); |
5572 | 5572 | |
5573 | - return (string) \preg_replace_callback( |
|
5573 | + return (string)\preg_replace_callback( |
|
5574 | 5574 | '/[\\p{N}]+(.)?/u', |
5575 | 5575 | /** |
5576 | 5576 | * @param array $match |
@@ -5579,7 +5579,7 @@ discard block |
||
5579 | 5579 | * |
5580 | 5580 | * @return string |
5581 | 5581 | */ |
5582 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5582 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5583 | 5583 | if ($use_mb_functions) { |
5584 | 5584 | if ($encoding === 'UTF-8') { |
5585 | 5585 | return \mb_strtoupper($match[0]); |
@@ -5771,7 +5771,7 @@ discard block |
||
5771 | 5771 | ): string { |
5772 | 5772 | if (self::$SUPPORT['mbstring'] === true) { |
5773 | 5773 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5774 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5774 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5775 | 5775 | |
5776 | 5776 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5777 | 5777 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5781,10 +5781,10 @@ discard block |
||
5781 | 5781 | } |
5782 | 5782 | |
5783 | 5783 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5784 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5784 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5785 | 5785 | } |
5786 | 5786 | |
5787 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5787 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5788 | 5788 | |
5789 | 5789 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5790 | 5790 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5793,7 +5793,7 @@ discard block |
||
5793 | 5793 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5794 | 5794 | } |
5795 | 5795 | |
5796 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5796 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5797 | 5797 | } |
5798 | 5798 | |
5799 | 5799 | /** |
@@ -5810,7 +5810,7 @@ discard block |
||
5810 | 5810 | public static function str_detect_encoding($str) |
5811 | 5811 | { |
5812 | 5812 | // init |
5813 | - $str = (string) $str; |
|
5813 | + $str = (string)$str; |
|
5814 | 5814 | |
5815 | 5815 | // |
5816 | 5816 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5912,7 +5912,7 @@ discard block |
||
5912 | 5912 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5913 | 5913 | // INFO: //IGNORE but still throw notice |
5914 | 5914 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5915 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5915 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5916 | 5916 | return $encoding_tmp; |
5917 | 5917 | } |
5918 | 5918 | } |
@@ -6009,7 +6009,7 @@ discard block |
||
6009 | 6009 | return $str; |
6010 | 6010 | } |
6011 | 6011 | |
6012 | - return $substring . $str; |
|
6012 | + return $substring.$str; |
|
6013 | 6013 | } |
6014 | 6014 | |
6015 | 6015 | /** |
@@ -6300,27 +6300,27 @@ discard block |
||
6300 | 6300 | string $encoding = 'UTF-8' |
6301 | 6301 | ): string { |
6302 | 6302 | if ($encoding === 'UTF-8') { |
6303 | - $len = (int) \mb_strlen($str); |
|
6303 | + $len = (int)\mb_strlen($str); |
|
6304 | 6304 | if ($index > $len) { |
6305 | 6305 | return $str; |
6306 | 6306 | } |
6307 | 6307 | |
6308 | 6308 | /** @noinspection UnnecessaryCastingInspection */ |
6309 | - return (string) \mb_substr($str, 0, $index) . |
|
6310 | - $substring . |
|
6311 | - (string) \mb_substr($str, $index, $len); |
|
6309 | + return (string)\mb_substr($str, 0, $index). |
|
6310 | + $substring. |
|
6311 | + (string)\mb_substr($str, $index, $len); |
|
6312 | 6312 | } |
6313 | 6313 | |
6314 | 6314 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6315 | 6315 | |
6316 | - $len = (int) self::strlen($str, $encoding); |
|
6316 | + $len = (int)self::strlen($str, $encoding); |
|
6317 | 6317 | if ($index > $len) { |
6318 | 6318 | return $str; |
6319 | 6319 | } |
6320 | 6320 | |
6321 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
6322 | - $substring . |
|
6323 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6321 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
6322 | + $substring. |
|
6323 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
6324 | 6324 | } |
6325 | 6325 | |
6326 | 6326 | /** |
@@ -6352,15 +6352,15 @@ discard block |
||
6352 | 6352 | */ |
6353 | 6353 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
6354 | 6354 | { |
6355 | - $search = (array) $search; |
|
6355 | + $search = (array)$search; |
|
6356 | 6356 | |
6357 | 6357 | /** @noinspection AlterInForeachInspection */ |
6358 | 6358 | foreach ($search as &$s) { |
6359 | - $s = (string) $s; |
|
6359 | + $s = (string)$s; |
|
6360 | 6360 | if ($s === '') { |
6361 | 6361 | $s = '/^(?<=.)$/'; |
6362 | 6362 | } else { |
6363 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
6363 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
6364 | 6364 | } |
6365 | 6365 | } |
6366 | 6366 | |
@@ -6394,11 +6394,11 @@ discard block |
||
6394 | 6394 | } |
6395 | 6395 | |
6396 | 6396 | if ($search === '') { |
6397 | - return $str . $replacement; |
|
6397 | + return $str.$replacement; |
|
6398 | 6398 | } |
6399 | 6399 | |
6400 | 6400 | if (\stripos($str, $search) === 0) { |
6401 | - return $replacement . \substr($str, \strlen($search)); |
|
6401 | + return $replacement.\substr($str, \strlen($search)); |
|
6402 | 6402 | } |
6403 | 6403 | |
6404 | 6404 | return $str; |
@@ -6429,11 +6429,11 @@ discard block |
||
6429 | 6429 | } |
6430 | 6430 | |
6431 | 6431 | if ($search === '') { |
6432 | - return $str . $replacement; |
|
6432 | + return $str.$replacement; |
|
6433 | 6433 | } |
6434 | 6434 | |
6435 | 6435 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6436 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6436 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6437 | 6437 | } |
6438 | 6438 | |
6439 | 6439 | return $str; |
@@ -6519,15 +6519,15 @@ discard block |
||
6519 | 6519 | } |
6520 | 6520 | |
6521 | 6521 | if ($encoding === 'UTF-8') { |
6522 | - return (string) \mb_substr( |
|
6522 | + return (string)\mb_substr( |
|
6523 | 6523 | $str, |
6524 | - $offset + (int) \mb_strlen($separator) |
|
6524 | + $offset + (int)\mb_strlen($separator) |
|
6525 | 6525 | ); |
6526 | 6526 | } |
6527 | 6527 | |
6528 | - return (string) self::substr( |
|
6528 | + return (string)self::substr( |
|
6529 | 6529 | $str, |
6530 | - $offset + (int) self::strlen($separator, $encoding), |
|
6530 | + $offset + (int)self::strlen($separator, $encoding), |
|
6531 | 6531 | null, |
6532 | 6532 | $encoding |
6533 | 6533 | ); |
@@ -6559,15 +6559,15 @@ discard block |
||
6559 | 6559 | } |
6560 | 6560 | |
6561 | 6561 | if ($encoding === 'UTF-8') { |
6562 | - return (string) \mb_substr( |
|
6562 | + return (string)\mb_substr( |
|
6563 | 6563 | $str, |
6564 | - $offset + (int) self::strlen($separator) |
|
6564 | + $offset + (int)self::strlen($separator) |
|
6565 | 6565 | ); |
6566 | 6566 | } |
6567 | 6567 | |
6568 | - return (string) self::substr( |
|
6568 | + return (string)self::substr( |
|
6569 | 6569 | $str, |
6570 | - $offset + (int) self::strlen($separator, $encoding), |
|
6570 | + $offset + (int)self::strlen($separator, $encoding), |
|
6571 | 6571 | null, |
6572 | 6572 | $encoding |
6573 | 6573 | ); |
@@ -6599,10 +6599,10 @@ discard block |
||
6599 | 6599 | } |
6600 | 6600 | |
6601 | 6601 | if ($encoding === 'UTF-8') { |
6602 | - return (string) \mb_substr($str, 0, $offset); |
|
6602 | + return (string)\mb_substr($str, 0, $offset); |
|
6603 | 6603 | } |
6604 | 6604 | |
6605 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6605 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6606 | 6606 | } |
6607 | 6607 | |
6608 | 6608 | /** |
@@ -6631,7 +6631,7 @@ discard block |
||
6631 | 6631 | return ''; |
6632 | 6632 | } |
6633 | 6633 | |
6634 | - return (string) \mb_substr($str, 0, $offset); |
|
6634 | + return (string)\mb_substr($str, 0, $offset); |
|
6635 | 6635 | } |
6636 | 6636 | |
6637 | 6637 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6639,7 +6639,7 @@ discard block |
||
6639 | 6639 | return ''; |
6640 | 6640 | } |
6641 | 6641 | |
6642 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6642 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6643 | 6643 | } |
6644 | 6644 | |
6645 | 6645 | /** |
@@ -6741,12 +6741,12 @@ discard block |
||
6741 | 6741 | } |
6742 | 6742 | |
6743 | 6743 | if ($encoding === 'UTF-8') { |
6744 | - return (string) \mb_substr($str, -$n); |
|
6744 | + return (string)\mb_substr($str, -$n); |
|
6745 | 6745 | } |
6746 | 6746 | |
6747 | 6747 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6748 | 6748 | |
6749 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6749 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6750 | 6750 | } |
6751 | 6751 | |
6752 | 6752 | /** |
@@ -6772,21 +6772,21 @@ discard block |
||
6772 | 6772 | } |
6773 | 6773 | |
6774 | 6774 | if ($encoding === 'UTF-8') { |
6775 | - if ((int) \mb_strlen($str) <= $length) { |
|
6775 | + if ((int)\mb_strlen($str) <= $length) { |
|
6776 | 6776 | return $str; |
6777 | 6777 | } |
6778 | 6778 | |
6779 | 6779 | /** @noinspection UnnecessaryCastingInspection */ |
6780 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6780 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6781 | 6781 | } |
6782 | 6782 | |
6783 | 6783 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6784 | 6784 | |
6785 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6785 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6786 | 6786 | return $str; |
6787 | 6787 | } |
6788 | 6788 | |
6789 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6789 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6790 | 6790 | } |
6791 | 6791 | |
6792 | 6792 | /** |
@@ -6813,12 +6813,12 @@ discard block |
||
6813 | 6813 | |
6814 | 6814 | if ($encoding === 'UTF-8') { |
6815 | 6815 | /** @noinspection UnnecessaryCastingInspection */ |
6816 | - if ((int) \mb_strlen($str) <= $length) { |
|
6816 | + if ((int)\mb_strlen($str) <= $length) { |
|
6817 | 6817 | return $str; |
6818 | 6818 | } |
6819 | 6819 | |
6820 | 6820 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6821 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6821 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6822 | 6822 | } |
6823 | 6823 | |
6824 | 6824 | $str = \mb_substr($str, 0, $length); |
@@ -6827,33 +6827,33 @@ discard block |
||
6827 | 6827 | $new_str = \implode(' ', $array); |
6828 | 6828 | |
6829 | 6829 | if ($new_str === '') { |
6830 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6830 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6831 | 6831 | } |
6832 | 6832 | } else { |
6833 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6833 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6834 | 6834 | return $str; |
6835 | 6835 | } |
6836 | 6836 | |
6837 | 6837 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6838 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6838 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6839 | 6839 | } |
6840 | 6840 | |
6841 | 6841 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6842 | 6842 | $str = self::substr($str, 0, $length, $encoding); |
6843 | 6843 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6844 | 6844 | if ($str === false) { |
6845 | - return '' . $str_add_on; |
|
6845 | + return ''.$str_add_on; |
|
6846 | 6846 | } |
6847 | 6847 | |
6848 | 6848 | $array = \explode(' ', $str, -1); |
6849 | 6849 | $new_str = \implode(' ', $array); |
6850 | 6850 | |
6851 | 6851 | if ($new_str === '') { |
6852 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6852 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6853 | 6853 | } |
6854 | 6854 | } |
6855 | 6855 | |
6856 | - return $new_str . $str_add_on; |
|
6856 | + return $new_str.$str_add_on; |
|
6857 | 6857 | } |
6858 | 6858 | |
6859 | 6859 | /** |
@@ -6876,7 +6876,7 @@ discard block |
||
6876 | 6876 | $longest_common_prefix = ''; |
6877 | 6877 | |
6878 | 6878 | if ($encoding === 'UTF-8') { |
6879 | - $max_length = (int) \min( |
|
6879 | + $max_length = (int)\min( |
|
6880 | 6880 | \mb_strlen($str1), |
6881 | 6881 | \mb_strlen($str2) |
6882 | 6882 | ); |
@@ -6897,7 +6897,7 @@ discard block |
||
6897 | 6897 | } else { |
6898 | 6898 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6899 | 6899 | |
6900 | - $max_length = (int) \min( |
|
6900 | + $max_length = (int)\min( |
|
6901 | 6901 | self::strlen($str1, $encoding), |
6902 | 6902 | self::strlen($str2, $encoding) |
6903 | 6903 | ); |
@@ -6946,13 +6946,13 @@ discard block |
||
6946 | 6946 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6947 | 6947 | |
6948 | 6948 | if ($encoding === 'UTF-8') { |
6949 | - $str_length = (int) \mb_strlen($str1); |
|
6950 | - $other_length = (int) \mb_strlen($str2); |
|
6949 | + $str_length = (int)\mb_strlen($str1); |
|
6950 | + $other_length = (int)\mb_strlen($str2); |
|
6951 | 6951 | } else { |
6952 | 6952 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6953 | 6953 | |
6954 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6955 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6954 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6955 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6956 | 6956 | } |
6957 | 6957 | |
6958 | 6958 | // Return if either string is empty |
@@ -7005,10 +7005,10 @@ discard block |
||
7005 | 7005 | } |
7006 | 7006 | |
7007 | 7007 | if ($encoding === 'UTF-8') { |
7008 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
7008 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
7009 | 7009 | } |
7010 | 7010 | |
7011 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
7011 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
7012 | 7012 | } |
7013 | 7013 | |
7014 | 7014 | /** |
@@ -7032,7 +7032,7 @@ discard block |
||
7032 | 7032 | } |
7033 | 7033 | |
7034 | 7034 | if ($encoding === 'UTF-8') { |
7035 | - $max_length = (int) \min( |
|
7035 | + $max_length = (int)\min( |
|
7036 | 7036 | \mb_strlen($str1, $encoding), |
7037 | 7037 | \mb_strlen($str2, $encoding) |
7038 | 7038 | ); |
@@ -7046,7 +7046,7 @@ discard block |
||
7046 | 7046 | && |
7047 | 7047 | $char === \mb_substr($str2, -$i, 1) |
7048 | 7048 | ) { |
7049 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7049 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7050 | 7050 | } else { |
7051 | 7051 | break; |
7052 | 7052 | } |
@@ -7054,7 +7054,7 @@ discard block |
||
7054 | 7054 | } else { |
7055 | 7055 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7056 | 7056 | |
7057 | - $max_length = (int) \min( |
|
7057 | + $max_length = (int)\min( |
|
7058 | 7058 | self::strlen($str1, $encoding), |
7059 | 7059 | self::strlen($str2, $encoding) |
7060 | 7060 | ); |
@@ -7068,7 +7068,7 @@ discard block |
||
7068 | 7068 | && |
7069 | 7069 | $char === self::substr($str2, -$i, 1, $encoding) |
7070 | 7070 | ) { |
7071 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7071 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7072 | 7072 | } else { |
7073 | 7073 | break; |
7074 | 7074 | } |
@@ -7090,7 +7090,7 @@ discard block |
||
7090 | 7090 | */ |
7091 | 7091 | public static function str_matches_pattern(string $str, string $pattern): bool |
7092 | 7092 | { |
7093 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
7093 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
7094 | 7094 | } |
7095 | 7095 | |
7096 | 7096 | /** |
@@ -7109,7 +7109,7 @@ discard block |
||
7109 | 7109 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
7110 | 7110 | { |
7111 | 7111 | // init |
7112 | - $length = (int) self::strlen($str, $encoding); |
|
7112 | + $length = (int)self::strlen($str, $encoding); |
|
7113 | 7113 | |
7114 | 7114 | if ($offset >= 0) { |
7115 | 7115 | return $length > $offset; |
@@ -7138,7 +7138,7 @@ discard block |
||
7138 | 7138 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
7139 | 7139 | { |
7140 | 7140 | // init |
7141 | - $length = (int) self::strlen($str); |
|
7141 | + $length = (int)self::strlen($str); |
|
7142 | 7142 | |
7143 | 7143 | if ( |
7144 | 7144 | ($index >= 0 && $length <= $index) |
@@ -7180,7 +7180,7 @@ discard block |
||
7180 | 7180 | return $str; |
7181 | 7181 | } |
7182 | 7182 | |
7183 | - if ($pad_type !== (int) $pad_type) { |
|
7183 | + if ($pad_type !== (int)$pad_type) { |
|
7184 | 7184 | if ($pad_type === 'left') { |
7185 | 7185 | $pad_type = \STR_PAD_LEFT; |
7186 | 7186 | } elseif ($pad_type === 'right') { |
@@ -7189,23 +7189,23 @@ discard block |
||
7189 | 7189 | $pad_type = \STR_PAD_BOTH; |
7190 | 7190 | } else { |
7191 | 7191 | throw new \InvalidArgumentException( |
7192 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
7192 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
7193 | 7193 | ); |
7194 | 7194 | } |
7195 | 7195 | } |
7196 | 7196 | |
7197 | 7197 | if ($encoding === 'UTF-8') { |
7198 | - $str_length = (int) \mb_strlen($str); |
|
7198 | + $str_length = (int)\mb_strlen($str); |
|
7199 | 7199 | |
7200 | 7200 | if ($pad_length >= $str_length) { |
7201 | 7201 | switch ($pad_type) { |
7202 | 7202 | case \STR_PAD_LEFT: |
7203 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7203 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7204 | 7204 | |
7205 | 7205 | $diff = ($pad_length - $str_length); |
7206 | 7206 | |
7207 | - $pre = (string) \mb_substr( |
|
7208 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7207 | + $pre = (string)\mb_substr( |
|
7208 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7209 | 7209 | 0, |
7210 | 7210 | $diff |
7211 | 7211 | ); |
@@ -7216,16 +7216,16 @@ discard block |
||
7216 | 7216 | case \STR_PAD_BOTH: |
7217 | 7217 | $diff = ($pad_length - $str_length); |
7218 | 7218 | |
7219 | - $ps_length_left = (int) \floor($diff / 2); |
|
7219 | + $ps_length_left = (int)\floor($diff / 2); |
|
7220 | 7220 | |
7221 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7221 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7222 | 7222 | |
7223 | - $pre = (string) \mb_substr( |
|
7223 | + $pre = (string)\mb_substr( |
|
7224 | 7224 | \str_repeat($pad_string, $ps_length_left), |
7225 | 7225 | 0, |
7226 | 7226 | $ps_length_left |
7227 | 7227 | ); |
7228 | - $post = (string) \mb_substr( |
|
7228 | + $post = (string)\mb_substr( |
|
7229 | 7229 | \str_repeat($pad_string, $ps_length_right), |
7230 | 7230 | 0, |
7231 | 7231 | $ps_length_right |
@@ -7235,19 +7235,19 @@ discard block |
||
7235 | 7235 | |
7236 | 7236 | case \STR_PAD_RIGHT: |
7237 | 7237 | default: |
7238 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7238 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7239 | 7239 | |
7240 | 7240 | $diff = ($pad_length - $str_length); |
7241 | 7241 | |
7242 | - $post = (string) \mb_substr( |
|
7243 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7242 | + $post = (string)\mb_substr( |
|
7243 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7244 | 7244 | 0, |
7245 | 7245 | $diff |
7246 | 7246 | ); |
7247 | 7247 | $pre = ''; |
7248 | 7248 | } |
7249 | 7249 | |
7250 | - return $pre . $str . $post; |
|
7250 | + return $pre.$str.$post; |
|
7251 | 7251 | } |
7252 | 7252 | |
7253 | 7253 | return $str; |
@@ -7255,17 +7255,17 @@ discard block |
||
7255 | 7255 | |
7256 | 7256 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7257 | 7257 | |
7258 | - $str_length = (int) self::strlen($str, $encoding); |
|
7258 | + $str_length = (int)self::strlen($str, $encoding); |
|
7259 | 7259 | |
7260 | 7260 | if ($pad_length >= $str_length) { |
7261 | 7261 | switch ($pad_type) { |
7262 | 7262 | case \STR_PAD_LEFT: |
7263 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7263 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7264 | 7264 | |
7265 | 7265 | $diff = ($pad_length - $str_length); |
7266 | 7266 | |
7267 | - $pre = (string) self::substr( |
|
7268 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7267 | + $pre = (string)self::substr( |
|
7268 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7269 | 7269 | 0, |
7270 | 7270 | $diff, |
7271 | 7271 | $encoding |
@@ -7277,17 +7277,17 @@ discard block |
||
7277 | 7277 | case \STR_PAD_BOTH: |
7278 | 7278 | $diff = ($pad_length - $str_length); |
7279 | 7279 | |
7280 | - $ps_length_left = (int) \floor($diff / 2); |
|
7280 | + $ps_length_left = (int)\floor($diff / 2); |
|
7281 | 7281 | |
7282 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7282 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7283 | 7283 | |
7284 | - $pre = (string) self::substr( |
|
7284 | + $pre = (string)self::substr( |
|
7285 | 7285 | \str_repeat($pad_string, $ps_length_left), |
7286 | 7286 | 0, |
7287 | 7287 | $ps_length_left, |
7288 | 7288 | $encoding |
7289 | 7289 | ); |
7290 | - $post = (string) self::substr( |
|
7290 | + $post = (string)self::substr( |
|
7291 | 7291 | \str_repeat($pad_string, $ps_length_right), |
7292 | 7292 | 0, |
7293 | 7293 | $ps_length_right, |
@@ -7298,12 +7298,12 @@ discard block |
||
7298 | 7298 | |
7299 | 7299 | case \STR_PAD_RIGHT: |
7300 | 7300 | default: |
7301 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7301 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7302 | 7302 | |
7303 | 7303 | $diff = ($pad_length - $str_length); |
7304 | 7304 | |
7305 | - $post = (string) self::substr( |
|
7306 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7305 | + $post = (string)self::substr( |
|
7306 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7307 | 7307 | 0, |
7308 | 7308 | $diff, |
7309 | 7309 | $encoding |
@@ -7311,7 +7311,7 @@ discard block |
||
7311 | 7311 | $pre = ''; |
7312 | 7312 | } |
7313 | 7313 | |
7314 | - return $pre . $str . $post; |
|
7314 | + return $pre.$str.$post; |
|
7315 | 7315 | } |
7316 | 7316 | |
7317 | 7317 | return $str; |
@@ -7508,11 +7508,11 @@ discard block |
||
7508 | 7508 | } |
7509 | 7509 | |
7510 | 7510 | if ($search === '') { |
7511 | - return $str . $replacement; |
|
7511 | + return $str.$replacement; |
|
7512 | 7512 | } |
7513 | 7513 | |
7514 | 7514 | if (\strpos($str, $search) === 0) { |
7515 | - return $replacement . \substr($str, \strlen($search)); |
|
7515 | + return $replacement.\substr($str, \strlen($search)); |
|
7516 | 7516 | } |
7517 | 7517 | |
7518 | 7518 | return $str; |
@@ -7546,11 +7546,11 @@ discard block |
||
7546 | 7546 | } |
7547 | 7547 | |
7548 | 7548 | if ($search === '') { |
7549 | - return $str . $replacement; |
|
7549 | + return $str.$replacement; |
|
7550 | 7550 | } |
7551 | 7551 | |
7552 | 7552 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
7553 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
7553 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
7554 | 7554 | } |
7555 | 7555 | |
7556 | 7556 | return $str; |
@@ -7584,7 +7584,7 @@ discard block |
||
7584 | 7584 | $subject, |
7585 | 7585 | $replace, |
7586 | 7586 | $pos, |
7587 | - (int) self::strlen($search) |
|
7587 | + (int)self::strlen($search) |
|
7588 | 7588 | ); |
7589 | 7589 | } |
7590 | 7590 | |
@@ -7618,7 +7618,7 @@ discard block |
||
7618 | 7618 | $subject, |
7619 | 7619 | $replace, |
7620 | 7620 | $pos, |
7621 | - (int) self::strlen($search) |
|
7621 | + (int)self::strlen($search) |
|
7622 | 7622 | ); |
7623 | 7623 | } |
7624 | 7624 | |
@@ -7639,7 +7639,7 @@ discard block |
||
7639 | 7639 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7640 | 7640 | { |
7641 | 7641 | if ($encoding === 'UTF-8') { |
7642 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7642 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7643 | 7643 | /** @noinspection NonSecureShuffleUsageInspection */ |
7644 | 7644 | \shuffle($indexes); |
7645 | 7645 | |
@@ -7655,7 +7655,7 @@ discard block |
||
7655 | 7655 | } else { |
7656 | 7656 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7657 | 7657 | |
7658 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7658 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7659 | 7659 | /** @noinspection NonSecureShuffleUsageInspection */ |
7660 | 7660 | \shuffle($indexes); |
7661 | 7661 | |
@@ -7698,11 +7698,11 @@ discard block |
||
7698 | 7698 | ) { |
7699 | 7699 | if ($encoding === 'UTF-8') { |
7700 | 7700 | if ($end === null) { |
7701 | - $length = (int) \mb_strlen($str); |
|
7701 | + $length = (int)\mb_strlen($str); |
|
7702 | 7702 | } elseif ($end >= 0 && $end <= $start) { |
7703 | 7703 | return ''; |
7704 | 7704 | } elseif ($end < 0) { |
7705 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7705 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7706 | 7706 | } else { |
7707 | 7707 | $length = $end - $start; |
7708 | 7708 | } |
@@ -7713,11 +7713,11 @@ discard block |
||
7713 | 7713 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7714 | 7714 | |
7715 | 7715 | if ($end === null) { |
7716 | - $length = (int) self::strlen($str, $encoding); |
|
7716 | + $length = (int)self::strlen($str, $encoding); |
|
7717 | 7717 | } elseif ($end >= 0 && $end <= $start) { |
7718 | 7718 | return ''; |
7719 | 7719 | } elseif ($end < 0) { |
7720 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7720 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7721 | 7721 | } else { |
7722 | 7722 | $length = $end - $start; |
7723 | 7723 | } |
@@ -7752,7 +7752,7 @@ discard block |
||
7752 | 7752 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7753 | 7753 | } |
7754 | 7754 | |
7755 | - $str = (string) \preg_replace_callback( |
|
7755 | + $str = (string)\preg_replace_callback( |
|
7756 | 7756 | '/([\\p{N}|\\p{Lu}])/u', |
7757 | 7757 | /** |
7758 | 7758 | * @param string[] $matches |
@@ -7761,28 +7761,28 @@ discard block |
||
7761 | 7761 | * |
7762 | 7762 | * @return string |
7763 | 7763 | */ |
7764 | - static function (array $matches) use ($encoding): string { |
|
7764 | + static function(array $matches) use ($encoding): string { |
|
7765 | 7765 | $match = $matches[1]; |
7766 | - $match_int = (int) $match; |
|
7766 | + $match_int = (int)$match; |
|
7767 | 7767 | |
7768 | - if ((string) $match_int === $match) { |
|
7769 | - return '_' . $match . '_'; |
|
7768 | + if ((string)$match_int === $match) { |
|
7769 | + return '_'.$match.'_'; |
|
7770 | 7770 | } |
7771 | 7771 | |
7772 | 7772 | if ($encoding === 'UTF-8') { |
7773 | - return '_' . \mb_strtolower($match); |
|
7773 | + return '_'.\mb_strtolower($match); |
|
7774 | 7774 | } |
7775 | 7775 | |
7776 | - return '_' . self::strtolower($match, $encoding); |
|
7776 | + return '_'.self::strtolower($match, $encoding); |
|
7777 | 7777 | }, |
7778 | 7778 | $str |
7779 | 7779 | ); |
7780 | 7780 | |
7781 | - $str = (string) \preg_replace( |
|
7781 | + $str = (string)\preg_replace( |
|
7782 | 7782 | [ |
7783 | - '/\\s+/u', // convert spaces to "_" |
|
7783 | + '/\\s+/u', // convert spaces to "_" |
|
7784 | 7784 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7785 | - '/_+/', // remove double "_" |
|
7785 | + '/_+/', // remove double "_" |
|
7786 | 7786 | ], |
7787 | 7787 | [ |
7788 | 7788 | '_', |
@@ -7904,7 +7904,7 @@ discard block |
||
7904 | 7904 | } |
7905 | 7905 | |
7906 | 7906 | // init |
7907 | - $input = (string) $input; |
|
7907 | + $input = (string)$input; |
|
7908 | 7908 | |
7909 | 7909 | if ($input === '') { |
7910 | 7910 | return []; |
@@ -7961,7 +7961,7 @@ discard block |
||
7961 | 7961 | ($input[$i] & "\xE0") === "\xC0" |
7962 | 7962 | ) { |
7963 | 7963 | if (($input[$i + 1] & "\xC0") === "\x80") { |
7964 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
7964 | + $ret[] = $input[$i].$input[$i + 1]; |
|
7965 | 7965 | |
7966 | 7966 | ++$i; |
7967 | 7967 | } |
@@ -7975,7 +7975,7 @@ discard block |
||
7975 | 7975 | && |
7976 | 7976 | ($input[$i + 2] & "\xC0") === "\x80" |
7977 | 7977 | ) { |
7978 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
7978 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
7979 | 7979 | |
7980 | 7980 | $i += 2; |
7981 | 7981 | } |
@@ -7991,7 +7991,7 @@ discard block |
||
7991 | 7991 | && |
7992 | 7992 | ($input[$i + 3] & "\xC0") === "\x80" |
7993 | 7993 | ) { |
7994 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
7994 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
7995 | 7995 | |
7996 | 7996 | $i += 3; |
7997 | 7997 | } |
@@ -8003,7 +8003,7 @@ discard block |
||
8003 | 8003 | $ret = \array_chunk($ret, $length); |
8004 | 8004 | |
8005 | 8005 | return \array_map( |
8006 | - static function (array &$item): string { |
|
8006 | + static function(array &$item): string { |
|
8007 | 8007 | return \implode('', $item); |
8008 | 8008 | }, |
8009 | 8009 | $ret |
@@ -8069,7 +8069,7 @@ discard block |
||
8069 | 8069 | $limit = -1; |
8070 | 8070 | } |
8071 | 8071 | |
8072 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
8072 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
8073 | 8073 | |
8074 | 8074 | if ($array === false) { |
8075 | 8075 | return []; |
@@ -8159,9 +8159,9 @@ discard block |
||
8159 | 8159 | return ''; |
8160 | 8160 | } |
8161 | 8161 | |
8162 | - return (string) \mb_substr( |
|
8162 | + return (string)\mb_substr( |
|
8163 | 8163 | $str, |
8164 | - $offset + (int) \mb_strlen($separator) |
|
8164 | + $offset + (int)\mb_strlen($separator) |
|
8165 | 8165 | ); |
8166 | 8166 | } |
8167 | 8167 | |
@@ -8170,9 +8170,9 @@ discard block |
||
8170 | 8170 | return ''; |
8171 | 8171 | } |
8172 | 8172 | |
8173 | - return (string) \mb_substr( |
|
8173 | + return (string)\mb_substr( |
|
8174 | 8174 | $str, |
8175 | - $offset + (int) self::strlen($separator, $encoding), |
|
8175 | + $offset + (int)self::strlen($separator, $encoding), |
|
8176 | 8176 | null, |
8177 | 8177 | $encoding |
8178 | 8178 | ); |
@@ -8201,9 +8201,9 @@ discard block |
||
8201 | 8201 | return ''; |
8202 | 8202 | } |
8203 | 8203 | |
8204 | - return (string) \mb_substr( |
|
8204 | + return (string)\mb_substr( |
|
8205 | 8205 | $str, |
8206 | - $offset + (int) \mb_strlen($separator) |
|
8206 | + $offset + (int)\mb_strlen($separator) |
|
8207 | 8207 | ); |
8208 | 8208 | } |
8209 | 8209 | |
@@ -8212,9 +8212,9 @@ discard block |
||
8212 | 8212 | return ''; |
8213 | 8213 | } |
8214 | 8214 | |
8215 | - return (string) self::substr( |
|
8215 | + return (string)self::substr( |
|
8216 | 8216 | $str, |
8217 | - $offset + (int) self::strlen($separator, $encoding), |
|
8217 | + $offset + (int)self::strlen($separator, $encoding), |
|
8218 | 8218 | null, |
8219 | 8219 | $encoding |
8220 | 8220 | ); |
@@ -8246,7 +8246,7 @@ discard block |
||
8246 | 8246 | return ''; |
8247 | 8247 | } |
8248 | 8248 | |
8249 | - return (string) \mb_substr( |
|
8249 | + return (string)\mb_substr( |
|
8250 | 8250 | $str, |
8251 | 8251 | 0, |
8252 | 8252 | $offset |
@@ -8258,7 +8258,7 @@ discard block |
||
8258 | 8258 | return ''; |
8259 | 8259 | } |
8260 | 8260 | |
8261 | - return (string) self::substr( |
|
8261 | + return (string)self::substr( |
|
8262 | 8262 | $str, |
8263 | 8263 | 0, |
8264 | 8264 | $offset, |
@@ -8289,7 +8289,7 @@ discard block |
||
8289 | 8289 | return ''; |
8290 | 8290 | } |
8291 | 8291 | |
8292 | - return (string) \mb_substr( |
|
8292 | + return (string)\mb_substr( |
|
8293 | 8293 | $str, |
8294 | 8294 | 0, |
8295 | 8295 | $offset |
@@ -8303,7 +8303,7 @@ discard block |
||
8303 | 8303 | |
8304 | 8304 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8305 | 8305 | |
8306 | - return (string) self::substr( |
|
8306 | + return (string)self::substr( |
|
8307 | 8307 | $str, |
8308 | 8308 | 0, |
8309 | 8309 | $offset, |
@@ -8418,7 +8418,7 @@ discard block |
||
8418 | 8418 | */ |
8419 | 8419 | public static function str_surround(string $str, string $substring): string |
8420 | 8420 | { |
8421 | - return $substring . $str . $substring; |
|
8421 | + return $substring.$str.$substring; |
|
8422 | 8422 | } |
8423 | 8423 | |
8424 | 8424 | /** |
@@ -8482,9 +8482,9 @@ discard block |
||
8482 | 8482 | $word_define_chars = ''; |
8483 | 8483 | } |
8484 | 8484 | |
8485 | - $str = (string) \preg_replace_callback( |
|
8486 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
8487 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8485 | + $str = (string)\preg_replace_callback( |
|
8486 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
8487 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8488 | 8488 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
8489 | 8489 | return $match[0]; |
8490 | 8490 | } |
@@ -8584,16 +8584,16 @@ discard block |
||
8584 | 8584 | |
8585 | 8585 | // the main substitutions |
8586 | 8586 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive */ |
8587 | - $str = (string) \preg_replace_callback( |
|
8587 | + $str = (string)\preg_replace_callback( |
|
8588 | 8588 | '~\\b (_*) (?: # 1. Leading underscore and |
8589 | 8589 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
8590 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
8590 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
8591 | 8591 | | |
8592 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
8592 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
8593 | 8593 | | |
8594 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
8594 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
8595 | 8595 | | |
8596 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
8596 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
8597 | 8597 | ) (_*) \\b # 6. With trailing underscore |
8598 | 8598 | ~ux', |
8599 | 8599 | /** |
@@ -8603,7 +8603,7 @@ discard block |
||
8603 | 8603 | * |
8604 | 8604 | * @return string |
8605 | 8605 | */ |
8606 | - static function (array $matches) use ($encoding): string { |
|
8606 | + static function(array $matches) use ($encoding): string { |
|
8607 | 8607 | // preserve leading underscore |
8608 | 8608 | $str = $matches[1]; |
8609 | 8609 | if ($matches[2]) { |
@@ -8628,11 +8628,11 @@ discard block |
||
8628 | 8628 | ); |
8629 | 8629 | |
8630 | 8630 | // Exceptions for small words: capitalize at start of title... |
8631 | - $str = (string) \preg_replace_callback( |
|
8631 | + $str = (string)\preg_replace_callback( |
|
8632 | 8632 | '~( \\A [[:punct:]]* # start of title... |
8633 | 8633 | | [:.;?!][ ]+ # or of subsentence... |
8634 | 8634 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
8635 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
8635 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
8636 | 8636 | ~uxi', |
8637 | 8637 | /** |
8638 | 8638 | * @param string[] $matches |
@@ -8641,15 +8641,15 @@ discard block |
||
8641 | 8641 | * |
8642 | 8642 | * @return string |
8643 | 8643 | */ |
8644 | - static function (array $matches) use ($encoding): string { |
|
8645 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8644 | + static function(array $matches) use ($encoding): string { |
|
8645 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8646 | 8646 | }, |
8647 | 8647 | $str |
8648 | 8648 | ); |
8649 | 8649 | |
8650 | 8650 | // ...and end of title |
8651 | - $str = (string) \preg_replace_callback( |
|
8652 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
8651 | + $str = (string)\preg_replace_callback( |
|
8652 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
8653 | 8653 | (?= [[:punct:]]* \Z # ...at the end of the title... |
8654 | 8654 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
8655 | 8655 | ~uxi', |
@@ -8660,7 +8660,7 @@ discard block |
||
8660 | 8660 | * |
8661 | 8661 | * @return string |
8662 | 8662 | */ |
8663 | - static function (array $matches) use ($encoding): string { |
|
8663 | + static function(array $matches) use ($encoding): string { |
|
8664 | 8664 | return static::ucfirst($matches[1], $encoding); |
8665 | 8665 | }, |
8666 | 8666 | $str |
@@ -8668,10 +8668,10 @@ discard block |
||
8668 | 8668 | |
8669 | 8669 | // Exceptions for small words in hyphenated compound words. |
8670 | 8670 | // e.g. "in-flight" -> In-Flight |
8671 | - $str = (string) \preg_replace_callback( |
|
8671 | + $str = (string)\preg_replace_callback( |
|
8672 | 8672 | '~\\b |
8673 | 8673 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
8674 | - ( ' . $small_words_rx . ' ) |
|
8674 | + ( ' . $small_words_rx.' ) |
|
8675 | 8675 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
8676 | 8676 | ~uxi', |
8677 | 8677 | /** |
@@ -8681,18 +8681,18 @@ discard block |
||
8681 | 8681 | * |
8682 | 8682 | * @return string |
8683 | 8683 | */ |
8684 | - static function (array $matches) use ($encoding): string { |
|
8684 | + static function(array $matches) use ($encoding): string { |
|
8685 | 8685 | return static::ucfirst($matches[1], $encoding); |
8686 | 8686 | }, |
8687 | 8687 | $str |
8688 | 8688 | ); |
8689 | 8689 | |
8690 | 8690 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
8691 | - $str = (string) \preg_replace_callback( |
|
8691 | + $str = (string)\preg_replace_callback( |
|
8692 | 8692 | '~\\b |
8693 | 8693 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
8694 | 8694 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
8695 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
8695 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
8696 | 8696 | (?! - ) # Negative lookahead for another - |
8697 | 8697 | ~uxi', |
8698 | 8698 | /** |
@@ -8702,8 +8702,8 @@ discard block |
||
8702 | 8702 | * |
8703 | 8703 | * @return string |
8704 | 8704 | */ |
8705 | - static function (array $matches) use ($encoding): string { |
|
8706 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8705 | + static function(array $matches) use ($encoding): string { |
|
8706 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8707 | 8707 | }, |
8708 | 8708 | $str |
8709 | 8709 | ); |
@@ -8818,7 +8818,7 @@ discard block |
||
8818 | 8818 | ); |
8819 | 8819 | |
8820 | 8820 | foreach ($tmp_return as &$item) { |
8821 | - $item = (string) $item; |
|
8821 | + $item = (string)$item; |
|
8822 | 8822 | } |
8823 | 8823 | |
8824 | 8824 | return $tmp_return; |
@@ -8872,39 +8872,39 @@ discard block |
||
8872 | 8872 | } |
8873 | 8873 | |
8874 | 8874 | if ($encoding === 'UTF-8') { |
8875 | - if ($length >= (int) \mb_strlen($str)) { |
|
8875 | + if ($length >= (int)\mb_strlen($str)) { |
|
8876 | 8876 | return $str; |
8877 | 8877 | } |
8878 | 8878 | |
8879 | 8879 | if ($substring !== '') { |
8880 | - $length -= (int) \mb_strlen($substring); |
|
8880 | + $length -= (int)\mb_strlen($substring); |
|
8881 | 8881 | |
8882 | 8882 | /** @noinspection UnnecessaryCastingInspection */ |
8883 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8883 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8884 | 8884 | } |
8885 | 8885 | |
8886 | 8886 | /** @noinspection UnnecessaryCastingInspection */ |
8887 | - return (string) \mb_substr($str, 0, $length); |
|
8887 | + return (string)\mb_substr($str, 0, $length); |
|
8888 | 8888 | } |
8889 | 8889 | |
8890 | 8890 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8891 | 8891 | |
8892 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8892 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8893 | 8893 | return $str; |
8894 | 8894 | } |
8895 | 8895 | |
8896 | 8896 | if ($substring !== '') { |
8897 | - $length -= (int) self::strlen($substring, $encoding); |
|
8897 | + $length -= (int)self::strlen($substring, $encoding); |
|
8898 | 8898 | } |
8899 | 8899 | |
8900 | 8900 | return ( |
8901 | - (string) self::substr( |
|
8901 | + (string)self::substr( |
|
8902 | 8902 | $str, |
8903 | 8903 | 0, |
8904 | 8904 | $length, |
8905 | 8905 | $encoding |
8906 | 8906 | ) |
8907 | - ) . $substring; |
|
8907 | + ).$substring; |
|
8908 | 8908 | } |
8909 | 8909 | |
8910 | 8910 | /** |
@@ -8938,12 +8938,12 @@ discard block |
||
8938 | 8938 | } |
8939 | 8939 | |
8940 | 8940 | if ($encoding === 'UTF-8') { |
8941 | - if ($length >= (int) \mb_strlen($str)) { |
|
8941 | + if ($length >= (int)\mb_strlen($str)) { |
|
8942 | 8942 | return $str; |
8943 | 8943 | } |
8944 | 8944 | |
8945 | 8945 | // need to further trim the string so we can append the substring |
8946 | - $length -= (int) \mb_strlen($substring); |
|
8946 | + $length -= (int)\mb_strlen($substring); |
|
8947 | 8947 | if ($length <= 0) { |
8948 | 8948 | return $substring; |
8949 | 8949 | } |
@@ -8969,18 +8969,18 @@ discard block |
||
8969 | 8969 | !$ignore_do_not_split_words_for_one_word |
8970 | 8970 | ) |
8971 | 8971 | ) { |
8972 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
8972 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
8973 | 8973 | } |
8974 | 8974 | } |
8975 | 8975 | } else { |
8976 | 8976 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8977 | 8977 | |
8978 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8978 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8979 | 8979 | return $str; |
8980 | 8980 | } |
8981 | 8981 | |
8982 | 8982 | // need to further trim the string so we can append the substring |
8983 | - $length -= (int) self::strlen($substring, $encoding); |
|
8983 | + $length -= (int)self::strlen($substring, $encoding); |
|
8984 | 8984 | if ($length <= 0) { |
8985 | 8985 | return $substring; |
8986 | 8986 | } |
@@ -9006,12 +9006,12 @@ discard block |
||
9006 | 9006 | !$ignore_do_not_split_words_for_one_word |
9007 | 9007 | ) |
9008 | 9008 | ) { |
9009 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
9009 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
9010 | 9010 | } |
9011 | 9011 | } |
9012 | 9012 | } |
9013 | 9013 | |
9014 | - return $truncated . $substring; |
|
9014 | + return $truncated.$substring; |
|
9015 | 9015 | } |
9016 | 9016 | |
9017 | 9017 | /** |
@@ -9121,13 +9121,13 @@ discard block |
||
9121 | 9121 | } |
9122 | 9122 | } elseif ($format === 2) { |
9123 | 9123 | $number_of_words = []; |
9124 | - $offset = (int) self::strlen($str_parts[0]); |
|
9124 | + $offset = (int)self::strlen($str_parts[0]); |
|
9125 | 9125 | for ($i = 1; $i < $len; $i += 2) { |
9126 | 9126 | $number_of_words[$offset] = $str_parts[$i]; |
9127 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
9127 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
9128 | 9128 | } |
9129 | 9129 | } else { |
9130 | - $number_of_words = (int) (($len - 1) / 2); |
|
9130 | + $number_of_words = (int)(($len - 1) / 2); |
|
9131 | 9131 | } |
9132 | 9132 | |
9133 | 9133 | return $number_of_words; |
@@ -9256,21 +9256,21 @@ discard block |
||
9256 | 9256 | } |
9257 | 9257 | |
9258 | 9258 | if ($char_list === '') { |
9259 | - return (int) self::strlen($str, $encoding); |
|
9259 | + return (int)self::strlen($str, $encoding); |
|
9260 | 9260 | } |
9261 | 9261 | |
9262 | 9262 | if ($offset !== null || $length !== null) { |
9263 | 9263 | if ($encoding === 'UTF-8') { |
9264 | 9264 | if ($length === null) { |
9265 | 9265 | /** @noinspection UnnecessaryCastingInspection */ |
9266 | - $str_tmp = \mb_substr($str, (int) $offset); |
|
9266 | + $str_tmp = \mb_substr($str, (int)$offset); |
|
9267 | 9267 | } else { |
9268 | 9268 | /** @noinspection UnnecessaryCastingInspection */ |
9269 | - $str_tmp = \mb_substr($str, (int) $offset, $length); |
|
9269 | + $str_tmp = \mb_substr($str, (int)$offset, $length); |
|
9270 | 9270 | } |
9271 | 9271 | } else { |
9272 | 9272 | /** @noinspection UnnecessaryCastingInspection */ |
9273 | - $str_tmp = self::substr($str, (int) $offset, $length, $encoding); |
|
9273 | + $str_tmp = self::substr($str, (int)$offset, $length, $encoding); |
|
9274 | 9274 | } |
9275 | 9275 | |
9276 | 9276 | if ($str_tmp === false) { |
@@ -9286,7 +9286,7 @@ discard block |
||
9286 | 9286 | } |
9287 | 9287 | |
9288 | 9288 | $matches = []; |
9289 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
9289 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
9290 | 9290 | $return = self::strlen($matches[1], $encoding); |
9291 | 9291 | if ($return === false) { |
9292 | 9292 | return 0; |
@@ -9295,7 +9295,7 @@ discard block |
||
9295 | 9295 | return $return; |
9296 | 9296 | } |
9297 | 9297 | |
9298 | - return (int) self::strlen($str, $encoding); |
|
9298 | + return (int)self::strlen($str, $encoding); |
|
9299 | 9299 | } |
9300 | 9300 | |
9301 | 9301 | /** |
@@ -9350,7 +9350,7 @@ discard block |
||
9350 | 9350 | |
9351 | 9351 | $str = ''; |
9352 | 9352 | foreach ($array as $strPart) { |
9353 | - $str .= '&#' . (int) $strPart . ';'; |
|
9353 | + $str .= '&#'.(int)$strPart.';'; |
|
9354 | 9354 | } |
9355 | 9355 | |
9356 | 9356 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9439,7 +9439,7 @@ discard block |
||
9439 | 9439 | return ''; |
9440 | 9440 | } |
9441 | 9441 | |
9442 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
9442 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
9443 | 9443 | } |
9444 | 9444 | |
9445 | 9445 | /** |
@@ -9506,7 +9506,7 @@ discard block |
||
9506 | 9506 | // fallback for ascii only |
9507 | 9507 | // |
9508 | 9508 | |
9509 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9509 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9510 | 9510 | return \stripos($haystack, $needle, $offset); |
9511 | 9511 | } |
9512 | 9512 | |
@@ -9579,7 +9579,7 @@ discard block |
||
9579 | 9579 | /** |
9580 | 9580 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9581 | 9581 | */ |
9582 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9582 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9583 | 9583 | } |
9584 | 9584 | |
9585 | 9585 | if ( |
@@ -9593,11 +9593,11 @@ discard block |
||
9593 | 9593 | } |
9594 | 9594 | } |
9595 | 9595 | |
9596 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
9596 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
9597 | 9597 | return \stristr($haystack, $needle, $before_needle); |
9598 | 9598 | } |
9599 | 9599 | |
9600 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
9600 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
9601 | 9601 | |
9602 | 9602 | if (!isset($match[1])) { |
9603 | 9603 | return false; |
@@ -9607,7 +9607,7 @@ discard block |
||
9607 | 9607 | return $match[1]; |
9608 | 9608 | } |
9609 | 9609 | |
9610 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
9610 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
9611 | 9611 | } |
9612 | 9612 | |
9613 | 9613 | /** |
@@ -9684,7 +9684,7 @@ discard block |
||
9684 | 9684 | /** |
9685 | 9685 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9686 | 9686 | */ |
9687 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9687 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9688 | 9688 | } |
9689 | 9689 | |
9690 | 9690 | // |
@@ -9806,8 +9806,8 @@ discard block |
||
9806 | 9806 | } |
9807 | 9807 | |
9808 | 9808 | return \strnatcmp( |
9809 | - (string) self::strtonatfold($str1), |
|
9810 | - (string) self::strtonatfold($str2) |
|
9809 | + (string)self::strtonatfold($str1), |
|
9810 | + (string)self::strtonatfold($str2) |
|
9811 | 9811 | ); |
9812 | 9812 | } |
9813 | 9813 | |
@@ -9869,11 +9869,11 @@ discard block |
||
9869 | 9869 | } |
9870 | 9870 | |
9871 | 9871 | if ($encoding === 'UTF-8') { |
9872 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9873 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9872 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9873 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9874 | 9874 | } else { |
9875 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9876 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9875 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9876 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9877 | 9877 | } |
9878 | 9878 | |
9879 | 9879 | return self::strcmp($str1, $str2); |
@@ -9898,8 +9898,8 @@ discard block |
||
9898 | 9898 | return false; |
9899 | 9899 | } |
9900 | 9900 | |
9901 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9902 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9901 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9902 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9903 | 9903 | } |
9904 | 9904 | |
9905 | 9905 | return false; |
@@ -9934,10 +9934,10 @@ discard block |
||
9934 | 9934 | } |
9935 | 9935 | |
9936 | 9936 | // iconv and mbstring do not support integer $needle |
9937 | - if ((int) $needle === $needle) { |
|
9938 | - $needle = (string) self::chr($needle); |
|
9937 | + if ((int)$needle === $needle) { |
|
9938 | + $needle = (string)self::chr($needle); |
|
9939 | 9939 | } |
9940 | - $needle = (string) $needle; |
|
9940 | + $needle = (string)$needle; |
|
9941 | 9941 | |
9942 | 9942 | if ($needle === '') { |
9943 | 9943 | return false; |
@@ -9987,7 +9987,7 @@ discard block |
||
9987 | 9987 | /** |
9988 | 9988 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9989 | 9989 | */ |
9990 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9990 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9991 | 9991 | } |
9992 | 9992 | |
9993 | 9993 | // |
@@ -10028,7 +10028,7 @@ discard block |
||
10028 | 10028 | // fallback for ascii only |
10029 | 10029 | // |
10030 | 10030 | |
10031 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10031 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10032 | 10032 | return \strpos($haystack, $needle, $offset); |
10033 | 10033 | } |
10034 | 10034 | |
@@ -10040,7 +10040,7 @@ discard block |
||
10040 | 10040 | if ($haystack_tmp === false) { |
10041 | 10041 | $haystack_tmp = ''; |
10042 | 10042 | } |
10043 | - $haystack = (string) $haystack_tmp; |
|
10043 | + $haystack = (string)$haystack_tmp; |
|
10044 | 10044 | |
10045 | 10045 | if ($offset < 0) { |
10046 | 10046 | $offset = 0; |
@@ -10052,7 +10052,7 @@ discard block |
||
10052 | 10052 | } |
10053 | 10053 | |
10054 | 10054 | if ($pos) { |
10055 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10055 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10056 | 10056 | } |
10057 | 10057 | |
10058 | 10058 | return $offset + 0; |
@@ -10205,7 +10205,7 @@ discard block |
||
10205 | 10205 | /** |
10206 | 10206 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10207 | 10207 | */ |
10208 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10208 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10209 | 10209 | } |
10210 | 10210 | |
10211 | 10211 | // |
@@ -10217,7 +10217,7 @@ discard block |
||
10217 | 10217 | if ($needle_tmp === false) { |
10218 | 10218 | return false; |
10219 | 10219 | } |
10220 | - $needle = (string) $needle_tmp; |
|
10220 | + $needle = (string)$needle_tmp; |
|
10221 | 10221 | |
10222 | 10222 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
10223 | 10223 | if ($pos === false) { |
@@ -10239,7 +10239,7 @@ discard block |
||
10239 | 10239 | if ($needle_tmp === false) { |
10240 | 10240 | return false; |
10241 | 10241 | } |
10242 | - $needle = (string) $needle_tmp; |
|
10242 | + $needle = (string)$needle_tmp; |
|
10243 | 10243 | |
10244 | 10244 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
10245 | 10245 | if ($pos === false) { |
@@ -10278,7 +10278,7 @@ discard block |
||
10278 | 10278 | if ($encoding === 'UTF-8') { |
10279 | 10279 | if (self::$SUPPORT['intl'] === true) { |
10280 | 10280 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
10281 | - $i = (int) \grapheme_strlen($str); |
|
10281 | + $i = (int)\grapheme_strlen($str); |
|
10282 | 10282 | while ($i--) { |
10283 | 10283 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
10284 | 10284 | if ($reversed_tmp !== false) { |
@@ -10286,7 +10286,7 @@ discard block |
||
10286 | 10286 | } |
10287 | 10287 | } |
10288 | 10288 | } else { |
10289 | - $i = (int) \mb_strlen($str); |
|
10289 | + $i = (int)\mb_strlen($str); |
|
10290 | 10290 | while ($i--) { |
10291 | 10291 | $reversed_tmp = \mb_substr($str, $i, 1); |
10292 | 10292 | if ($reversed_tmp !== false) { |
@@ -10297,7 +10297,7 @@ discard block |
||
10297 | 10297 | } else { |
10298 | 10298 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10299 | 10299 | |
10300 | - $i = (int) self::strlen($str, $encoding); |
|
10300 | + $i = (int)self::strlen($str, $encoding); |
|
10301 | 10301 | while ($i--) { |
10302 | 10302 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
10303 | 10303 | if ($reversed_tmp !== false) { |
@@ -10374,7 +10374,7 @@ discard block |
||
10374 | 10374 | if ($needle_tmp === false) { |
10375 | 10375 | return false; |
10376 | 10376 | } |
10377 | - $needle = (string) $needle_tmp; |
|
10377 | + $needle = (string)$needle_tmp; |
|
10378 | 10378 | |
10379 | 10379 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
10380 | 10380 | if ($pos === false) { |
@@ -10415,10 +10415,10 @@ discard block |
||
10415 | 10415 | } |
10416 | 10416 | |
10417 | 10417 | // iconv and mbstring do not support integer $needle |
10418 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10419 | - $needle = (string) self::chr($needle); |
|
10418 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10419 | + $needle = (string)self::chr($needle); |
|
10420 | 10420 | } |
10421 | - $needle = (string) $needle; |
|
10421 | + $needle = (string)$needle; |
|
10422 | 10422 | |
10423 | 10423 | if ($needle === '') { |
10424 | 10424 | return false; |
@@ -10466,7 +10466,7 @@ discard block |
||
10466 | 10466 | /** |
10467 | 10467 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10468 | 10468 | */ |
10469 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10469 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10470 | 10470 | } |
10471 | 10471 | |
10472 | 10472 | // |
@@ -10490,7 +10490,7 @@ discard block |
||
10490 | 10490 | // fallback for ascii only |
10491 | 10491 | // |
10492 | 10492 | |
10493 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10493 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10494 | 10494 | return \strripos($haystack, $needle, $offset); |
10495 | 10495 | } |
10496 | 10496 | |
@@ -10571,10 +10571,10 @@ discard block |
||
10571 | 10571 | } |
10572 | 10572 | |
10573 | 10573 | // iconv and mbstring do not support integer $needle |
10574 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10575 | - $needle = (string) self::chr($needle); |
|
10574 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10575 | + $needle = (string)self::chr($needle); |
|
10576 | 10576 | } |
10577 | - $needle = (string) $needle; |
|
10577 | + $needle = (string)$needle; |
|
10578 | 10578 | |
10579 | 10579 | if ($needle === '') { |
10580 | 10580 | return false; |
@@ -10622,7 +10622,7 @@ discard block |
||
10622 | 10622 | /** |
10623 | 10623 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10624 | 10624 | */ |
10625 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10625 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10626 | 10626 | } |
10627 | 10627 | |
10628 | 10628 | // |
@@ -10646,7 +10646,7 @@ discard block |
||
10646 | 10646 | // fallback for ascii only |
10647 | 10647 | // |
10648 | 10648 | |
10649 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10649 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10650 | 10650 | return \strrpos($haystack, $needle, $offset); |
10651 | 10651 | } |
10652 | 10652 | |
@@ -10666,7 +10666,7 @@ discard block |
||
10666 | 10666 | if ($haystack_tmp === false) { |
10667 | 10667 | $haystack_tmp = ''; |
10668 | 10668 | } |
10669 | - $haystack = (string) $haystack_tmp; |
|
10669 | + $haystack = (string)$haystack_tmp; |
|
10670 | 10670 | } |
10671 | 10671 | |
10672 | 10672 | $pos = \strrpos($haystack, $needle); |
@@ -10680,7 +10680,7 @@ discard block |
||
10680 | 10680 | return false; |
10681 | 10681 | } |
10682 | 10682 | |
10683 | - return $offset + (int) self::strlen($str_tmp); |
|
10683 | + return $offset + (int)self::strlen($str_tmp); |
|
10684 | 10684 | } |
10685 | 10685 | |
10686 | 10686 | /** |
@@ -10746,12 +10746,12 @@ discard block |
||
10746 | 10746 | if ($offset || $length !== null) { |
10747 | 10747 | if ($encoding === 'UTF-8') { |
10748 | 10748 | if ($length === null) { |
10749 | - $str = (string) \mb_substr($str, $offset); |
|
10749 | + $str = (string)\mb_substr($str, $offset); |
|
10750 | 10750 | } else { |
10751 | - $str = (string) \mb_substr($str, $offset, $length); |
|
10751 | + $str = (string)\mb_substr($str, $offset, $length); |
|
10752 | 10752 | } |
10753 | 10753 | } else { |
10754 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
10754 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
10755 | 10755 | } |
10756 | 10756 | } |
10757 | 10757 | |
@@ -10761,7 +10761,7 @@ discard block |
||
10761 | 10761 | |
10762 | 10762 | $matches = []; |
10763 | 10763 | |
10764 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
10764 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
10765 | 10765 | } |
10766 | 10766 | |
10767 | 10767 | /** |
@@ -10835,7 +10835,7 @@ discard block |
||
10835 | 10835 | /** |
10836 | 10836 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10837 | 10837 | */ |
10838 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10838 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10839 | 10839 | } |
10840 | 10840 | |
10841 | 10841 | // |
@@ -10857,7 +10857,7 @@ discard block |
||
10857 | 10857 | // fallback for ascii only |
10858 | 10858 | // |
10859 | 10859 | |
10860 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10860 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10861 | 10861 | return \strstr($haystack, $needle, $before_needle); |
10862 | 10862 | } |
10863 | 10863 | |
@@ -10865,7 +10865,7 @@ discard block |
||
10865 | 10865 | // fallback via vanilla php |
10866 | 10866 | // |
10867 | 10867 | |
10868 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
10868 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
10869 | 10869 | |
10870 | 10870 | if (!isset($match[1])) { |
10871 | 10871 | return false; |
@@ -10875,7 +10875,7 @@ discard block |
||
10875 | 10875 | return $match[1]; |
10876 | 10876 | } |
10877 | 10877 | |
10878 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
10878 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
10879 | 10879 | } |
10880 | 10880 | |
10881 | 10881 | /** |
@@ -11001,7 +11001,7 @@ discard block |
||
11001 | 11001 | bool $try_to_keep_the_string_length = false |
11002 | 11002 | ): string { |
11003 | 11003 | // init |
11004 | - $str = (string) $str; |
|
11004 | + $str = (string)$str; |
|
11005 | 11005 | |
11006 | 11006 | if ($str === '') { |
11007 | 11007 | return ''; |
@@ -11030,25 +11030,25 @@ discard block |
||
11030 | 11030 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11031 | 11031 | } |
11032 | 11032 | |
11033 | - $language_code = $lang . '-Lower'; |
|
11033 | + $language_code = $lang.'-Lower'; |
|
11034 | 11034 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11035 | 11035 | /** |
11036 | 11036 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11037 | 11037 | */ |
11038 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11038 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11039 | 11039 | |
11040 | 11040 | $language_code = 'Any-Lower'; |
11041 | 11041 | } |
11042 | 11042 | |
11043 | 11043 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11044 | 11044 | /** @noinspection UnnecessaryCastingInspection */ |
11045 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11045 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11046 | 11046 | } |
11047 | 11047 | |
11048 | 11048 | /** |
11049 | 11049 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11050 | 11050 | */ |
11051 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
11051 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
11052 | 11052 | } |
11053 | 11053 | |
11054 | 11054 | // always fallback via symfony polyfill |
@@ -11081,7 +11081,7 @@ discard block |
||
11081 | 11081 | bool $try_to_keep_the_string_length = false |
11082 | 11082 | ): string { |
11083 | 11083 | // init |
11084 | - $str = (string) $str; |
|
11084 | + $str = (string)$str; |
|
11085 | 11085 | |
11086 | 11086 | if ($str === '') { |
11087 | 11087 | return ''; |
@@ -11110,25 +11110,25 @@ discard block |
||
11110 | 11110 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11111 | 11111 | } |
11112 | 11112 | |
11113 | - $language_code = $lang . '-Upper'; |
|
11113 | + $language_code = $lang.'-Upper'; |
|
11114 | 11114 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11115 | 11115 | /** |
11116 | 11116 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11117 | 11117 | */ |
11118 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
11118 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
11119 | 11119 | |
11120 | 11120 | $language_code = 'Any-Upper'; |
11121 | 11121 | } |
11122 | 11122 | |
11123 | 11123 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11124 | 11124 | /** @noinspection UnnecessaryCastingInspection */ |
11125 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11125 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11126 | 11126 | } |
11127 | 11127 | |
11128 | 11128 | /** |
11129 | 11129 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11130 | 11130 | */ |
11131 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
11131 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
11132 | 11132 | } |
11133 | 11133 | |
11134 | 11134 | // always fallback via symfony polyfill |
@@ -11197,7 +11197,7 @@ discard block |
||
11197 | 11197 | $from = \array_combine($from, $to); |
11198 | 11198 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
11199 | 11199 | if ($from === false) { |
11200 | - throw new \InvalidArgumentException('The number of elements for each array isn\'t equal or the arrays are empty: (from: ' . \print_r($from, true) . ' | to: ' . \print_r($to, true) . ')'); |
|
11200 | + throw new \InvalidArgumentException('The number of elements for each array isn\'t equal or the arrays are empty: (from: '.\print_r($from, true).' | to: '.\print_r($to, true).')'); |
|
11201 | 11201 | } |
11202 | 11202 | } |
11203 | 11203 | |
@@ -11259,9 +11259,9 @@ discard block |
||
11259 | 11259 | } |
11260 | 11260 | |
11261 | 11261 | $wide = 0; |
11262 | - $str = (string) \preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $str, -1, $wide); |
|
11262 | + $str = (string)\preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $str, -1, $wide); |
|
11263 | 11263 | |
11264 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
11264 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
11265 | 11265 | } |
11266 | 11266 | |
11267 | 11267 | /** |
@@ -11359,9 +11359,9 @@ discard block |
||
11359 | 11359 | } |
11360 | 11360 | |
11361 | 11361 | if ($length === null) { |
11362 | - $length = (int) $str_length; |
|
11362 | + $length = (int)$str_length; |
|
11363 | 11363 | } else { |
11364 | - $length = (int) $length; |
|
11364 | + $length = (int)$length; |
|
11365 | 11365 | } |
11366 | 11366 | |
11367 | 11367 | if ( |
@@ -11372,7 +11372,7 @@ discard block |
||
11372 | 11372 | /** |
11373 | 11373 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11374 | 11374 | */ |
11375 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11375 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11376 | 11376 | } |
11377 | 11377 | |
11378 | 11378 | // |
@@ -11462,16 +11462,16 @@ discard block |
||
11462 | 11462 | ) { |
11463 | 11463 | if ($encoding === 'UTF-8') { |
11464 | 11464 | if ($length === null) { |
11465 | - $str1 = (string) \mb_substr($str1, $offset); |
|
11465 | + $str1 = (string)\mb_substr($str1, $offset); |
|
11466 | 11466 | } else { |
11467 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
11467 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
11468 | 11468 | } |
11469 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
11469 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
11470 | 11470 | } else { |
11471 | 11471 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11472 | 11472 | |
11473 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
11474 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
11473 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
11474 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
11475 | 11475 | } |
11476 | 11476 | } |
11477 | 11477 | |
@@ -11536,13 +11536,13 @@ discard block |
||
11536 | 11536 | if ($length_tmp === false) { |
11537 | 11537 | return false; |
11538 | 11538 | } |
11539 | - $length = (int) $length_tmp; |
|
11539 | + $length = (int)$length_tmp; |
|
11540 | 11540 | } |
11541 | 11541 | |
11542 | 11542 | if ($encoding === 'UTF-8') { |
11543 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
11543 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
11544 | 11544 | } else { |
11545 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
11545 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
11546 | 11546 | } |
11547 | 11547 | } |
11548 | 11548 | |
@@ -11554,7 +11554,7 @@ discard block |
||
11554 | 11554 | /** |
11555 | 11555 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11556 | 11556 | */ |
11557 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11557 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11558 | 11558 | } |
11559 | 11559 | |
11560 | 11560 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -11565,7 +11565,7 @@ discard block |
||
11565 | 11565 | return \mb_substr_count($haystack, $needle, $encoding); |
11566 | 11566 | } |
11567 | 11567 | |
11568 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
11568 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
11569 | 11569 | |
11570 | 11570 | return \count($matches); |
11571 | 11571 | } |
@@ -11615,7 +11615,7 @@ discard block |
||
11615 | 11615 | if ($length_tmp === false) { |
11616 | 11616 | return false; |
11617 | 11617 | } |
11618 | - $length = (int) $length_tmp; |
|
11618 | + $length = (int)$length_tmp; |
|
11619 | 11619 | } |
11620 | 11620 | |
11621 | 11621 | if ( |
@@ -11637,7 +11637,7 @@ discard block |
||
11637 | 11637 | if ($haystack_tmp === false) { |
11638 | 11638 | $haystack_tmp = ''; |
11639 | 11639 | } |
11640 | - $haystack = (string) $haystack_tmp; |
|
11640 | + $haystack = (string)$haystack_tmp; |
|
11641 | 11641 | } |
11642 | 11642 | |
11643 | 11643 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -11678,10 +11678,10 @@ discard block |
||
11678 | 11678 | |
11679 | 11679 | if ($encoding === 'UTF-8') { |
11680 | 11680 | if ($case_sensitive) { |
11681 | - return (int) \mb_substr_count($str, $substring); |
|
11681 | + return (int)\mb_substr_count($str, $substring); |
|
11682 | 11682 | } |
11683 | 11683 | |
11684 | - return (int) \mb_substr_count( |
|
11684 | + return (int)\mb_substr_count( |
|
11685 | 11685 | \mb_strtoupper($str), |
11686 | 11686 | \mb_strtoupper($substring) |
11687 | 11687 | ); |
@@ -11690,10 +11690,10 @@ discard block |
||
11690 | 11690 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11691 | 11691 | |
11692 | 11692 | if ($case_sensitive) { |
11693 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
11693 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
11694 | 11694 | } |
11695 | 11695 | |
11696 | - return (int) \mb_substr_count( |
|
11696 | + return (int)\mb_substr_count( |
|
11697 | 11697 | self::strtocasefold($str, true, false, $encoding, null, false), |
11698 | 11698 | self::strtocasefold($substring, true, false, $encoding, null, false), |
11699 | 11699 | $encoding |
@@ -11722,7 +11722,7 @@ discard block |
||
11722 | 11722 | } |
11723 | 11723 | |
11724 | 11724 | if (self::str_istarts_with($haystack, $needle)) { |
11725 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
11725 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
11726 | 11726 | } |
11727 | 11727 | |
11728 | 11728 | return $haystack; |
@@ -11784,7 +11784,7 @@ discard block |
||
11784 | 11784 | } |
11785 | 11785 | |
11786 | 11786 | if (self::str_iends_with($haystack, $needle)) { |
11787 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
11787 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
11788 | 11788 | } |
11789 | 11789 | |
11790 | 11790 | return $haystack; |
@@ -11812,7 +11812,7 @@ discard block |
||
11812 | 11812 | } |
11813 | 11813 | |
11814 | 11814 | if (self::str_starts_with($haystack, $needle)) { |
11815 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
11815 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
11816 | 11816 | } |
11817 | 11817 | |
11818 | 11818 | return $haystack; |
@@ -11867,7 +11867,7 @@ discard block |
||
11867 | 11867 | if (\is_array($offset)) { |
11868 | 11868 | $offset = \array_slice($offset, 0, $num); |
11869 | 11869 | foreach ($offset as &$value_tmp) { |
11870 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
11870 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
11871 | 11871 | } |
11872 | 11872 | unset($value_tmp); |
11873 | 11873 | } else { |
@@ -11880,7 +11880,7 @@ discard block |
||
11880 | 11880 | } elseif (\is_array($length)) { |
11881 | 11881 | $length = \array_slice($length, 0, $num); |
11882 | 11882 | foreach ($length as &$value_tmp_V2) { |
11883 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11883 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11884 | 11884 | } |
11885 | 11885 | unset($value_tmp_V2); |
11886 | 11886 | } else { |
@@ -11900,8 +11900,8 @@ discard block |
||
11900 | 11900 | } |
11901 | 11901 | |
11902 | 11902 | // init |
11903 | - $str = (string) $str; |
|
11904 | - $replacement = (string) $replacement; |
|
11903 | + $str = (string)$str; |
|
11904 | + $replacement = (string)$replacement; |
|
11905 | 11905 | |
11906 | 11906 | if (\is_array($length)) { |
11907 | 11907 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -11916,16 +11916,16 @@ discard block |
||
11916 | 11916 | } |
11917 | 11917 | |
11918 | 11918 | if (self::$SUPPORT['mbstring'] === true) { |
11919 | - $string_length = (int) self::strlen($str, $encoding); |
|
11919 | + $string_length = (int)self::strlen($str, $encoding); |
|
11920 | 11920 | |
11921 | 11921 | if ($offset < 0) { |
11922 | - $offset = (int) \max(0, $string_length + $offset); |
|
11922 | + $offset = (int)\max(0, $string_length + $offset); |
|
11923 | 11923 | } elseif ($offset > $string_length) { |
11924 | 11924 | $offset = $string_length; |
11925 | 11925 | } |
11926 | 11926 | |
11927 | 11927 | if ($length !== null && $length < 0) { |
11928 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
11928 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
11929 | 11929 | } elseif ($length === null || $length > $string_length) { |
11930 | 11930 | $length = $string_length; |
11931 | 11931 | } |
@@ -11936,9 +11936,9 @@ discard block |
||
11936 | 11936 | } |
11937 | 11937 | |
11938 | 11938 | /** @noinspection AdditionOperationOnArraysInspection */ |
11939 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
11940 | - $replacement . |
|
11941 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11939 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
11940 | + $replacement. |
|
11941 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11942 | 11942 | } |
11943 | 11943 | |
11944 | 11944 | // |
@@ -11947,8 +11947,7 @@ discard block |
||
11947 | 11947 | |
11948 | 11948 | if (ASCII::is_ascii($str)) { |
11949 | 11949 | return ($length === null) ? |
11950 | - \substr_replace($str, $replacement, $offset) : |
|
11951 | - \substr_replace($str, $replacement, $offset, $length); |
|
11950 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
11952 | 11951 | } |
11953 | 11952 | |
11954 | 11953 | // |
@@ -11964,7 +11963,7 @@ discard block |
||
11964 | 11963 | // e.g.: non mbstring support + invalid chars |
11965 | 11964 | return ''; |
11966 | 11965 | } |
11967 | - $length = (int) $length_tmp; |
|
11966 | + $length = (int)$length_tmp; |
|
11968 | 11967 | } |
11969 | 11968 | |
11970 | 11969 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12002,14 +12001,14 @@ discard block |
||
12002 | 12001 | && |
12003 | 12002 | \substr($haystack, -\strlen($needle)) === $needle |
12004 | 12003 | ) { |
12005 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
12004 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
12006 | 12005 | } |
12007 | 12006 | |
12008 | 12007 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
12009 | - return (string) self::substr( |
|
12008 | + return (string)self::substr( |
|
12010 | 12009 | $haystack, |
12011 | 12010 | 0, |
12012 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
12011 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
12013 | 12012 | $encoding |
12014 | 12013 | ); |
12015 | 12014 | } |
@@ -12042,10 +12041,10 @@ discard block |
||
12042 | 12041 | } |
12043 | 12042 | |
12044 | 12043 | if ($encoding === 'UTF-8') { |
12045 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12044 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12046 | 12045 | } |
12047 | 12046 | |
12048 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12047 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12049 | 12048 | } |
12050 | 12049 | |
12051 | 12050 | /** |
@@ -12253,7 +12252,7 @@ discard block |
||
12253 | 12252 | public static function to_boolean($str): bool |
12254 | 12253 | { |
12255 | 12254 | // init |
12256 | - $str = (string) $str; |
|
12255 | + $str = (string)$str; |
|
12257 | 12256 | |
12258 | 12257 | if ($str === '') { |
12259 | 12258 | return false; |
@@ -12281,10 +12280,10 @@ discard block |
||
12281 | 12280 | } |
12282 | 12281 | |
12283 | 12282 | if (\is_numeric($str)) { |
12284 | - return ((float) $str + 0) > 0; |
|
12283 | + return ((float)$str + 0) > 0; |
|
12285 | 12284 | } |
12286 | 12285 | |
12287 | - return (bool) \trim($str); |
|
12286 | + return (bool)\trim($str); |
|
12288 | 12287 | } |
12289 | 12288 | |
12290 | 12289 | /** |
@@ -12330,7 +12329,7 @@ discard block |
||
12330 | 12329 | return $str; |
12331 | 12330 | } |
12332 | 12331 | |
12333 | - $str = (string) $str; |
|
12332 | + $str = (string)$str; |
|
12334 | 12333 | if ($str === '') { |
12335 | 12334 | return ''; |
12336 | 12335 | } |
@@ -12385,7 +12384,7 @@ discard block |
||
12385 | 12384 | return $str; |
12386 | 12385 | } |
12387 | 12386 | |
12388 | - $str = (string) $str; |
|
12387 | + $str = (string)$str; |
|
12389 | 12388 | if ($str === '') { |
12390 | 12389 | return $str; |
12391 | 12390 | } |
@@ -12403,7 +12402,7 @@ discard block |
||
12403 | 12402 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
12404 | 12403 | |
12405 | 12404 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12406 | - $buf .= $c1 . $c2; |
|
12405 | + $buf .= $c1.$c2; |
|
12407 | 12406 | ++$i; |
12408 | 12407 | } else { // not valid UTF8 - convert it |
12409 | 12408 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12414,7 +12413,7 @@ discard block |
||
12414 | 12413 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
12415 | 12414 | |
12416 | 12415 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12417 | - $buf .= $c1 . $c2 . $c3; |
|
12416 | + $buf .= $c1.$c2.$c3; |
|
12418 | 12417 | $i += 2; |
12419 | 12418 | } else { // not valid UTF8 - convert it |
12420 | 12419 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12426,7 +12425,7 @@ discard block |
||
12426 | 12425 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
12427 | 12426 | |
12428 | 12427 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
12429 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
12428 | + $buf .= $c1.$c2.$c3.$c4; |
|
12430 | 12429 | $i += 3; |
12431 | 12430 | } else { // not valid UTF8 - convert it |
12432 | 12431 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -12454,13 +12453,13 @@ discard block |
||
12454 | 12453 | * |
12455 | 12454 | * @return string |
12456 | 12455 | */ |
12457 | - static function (array $matches): string { |
|
12456 | + static function(array $matches): string { |
|
12458 | 12457 | if (isset($matches[3])) { |
12459 | - $cp = (int) \hexdec($matches[3]); |
|
12458 | + $cp = (int)\hexdec($matches[3]); |
|
12460 | 12459 | } else { |
12461 | 12460 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
12462 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
12463 | - + (int) \hexdec($matches[2]) |
|
12461 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
12462 | + + (int)\hexdec($matches[2]) |
|
12464 | 12463 | + 0x10000 |
12465 | 12464 | - (0xD800 << 10) |
12466 | 12465 | - 0xDC00; |
@@ -12471,12 +12470,12 @@ discard block |
||
12471 | 12470 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
12472 | 12471 | |
12473 | 12472 | if ($cp < 0x80) { |
12474 | - return (string) self::chr($cp); |
|
12473 | + return (string)self::chr($cp); |
|
12475 | 12474 | } |
12476 | 12475 | |
12477 | 12476 | if ($cp < 0xA0) { |
12478 | 12477 | /** @noinspection UnnecessaryCastingInspection */ |
12479 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
12478 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
12480 | 12479 | } |
12481 | 12480 | |
12482 | 12481 | return self::decimal_to_chr($cp); |
@@ -12509,7 +12508,7 @@ discard block |
||
12509 | 12508 | public static function to_int(string $str) |
12510 | 12509 | { |
12511 | 12510 | if (\is_numeric($str)) { |
12512 | - return (int) $str; |
|
12511 | + return (int)$str; |
|
12513 | 12512 | } |
12514 | 12513 | |
12515 | 12514 | return null; |
@@ -12540,7 +12539,7 @@ discard block |
||
12540 | 12539 | || |
12541 | 12540 | $input_type === 'double' |
12542 | 12541 | ) { |
12543 | - return (string) $input; |
|
12542 | + return (string)$input; |
|
12544 | 12543 | } |
12545 | 12544 | |
12546 | 12545 | if ( |
@@ -12548,7 +12547,7 @@ discard block |
||
12548 | 12547 | && |
12549 | 12548 | \method_exists($input, '__toString') |
12550 | 12549 | ) { |
12551 | - return (string) $input; |
|
12550 | + return (string)$input; |
|
12552 | 12551 | } |
12553 | 12552 | |
12554 | 12553 | return null; |
@@ -12586,7 +12585,7 @@ discard block |
||
12586 | 12585 | } |
12587 | 12586 | |
12588 | 12587 | /** @noinspection PhpComposerExtensionStubsInspection */ |
12589 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
12588 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
12590 | 12589 | } |
12591 | 12590 | |
12592 | 12591 | if ($chars) { |
@@ -12635,15 +12634,15 @@ discard block |
||
12635 | 12634 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
12636 | 12635 | |
12637 | 12636 | if ($encoding === 'UTF-8') { |
12638 | - $str_part_two = (string) \mb_substr($str, 1); |
|
12637 | + $str_part_two = (string)\mb_substr($str, 1); |
|
12639 | 12638 | |
12640 | 12639 | if ($use_mb_functions) { |
12641 | 12640 | $str_part_one = \mb_strtoupper( |
12642 | - (string) \mb_substr($str, 0, 1) |
|
12641 | + (string)\mb_substr($str, 0, 1) |
|
12643 | 12642 | ); |
12644 | 12643 | } else { |
12645 | 12644 | $str_part_one = self::strtoupper( |
12646 | - (string) \mb_substr($str, 0, 1), |
|
12645 | + (string)\mb_substr($str, 0, 1), |
|
12647 | 12646 | $encoding, |
12648 | 12647 | false, |
12649 | 12648 | $lang, |
@@ -12653,16 +12652,16 @@ discard block |
||
12653 | 12652 | } else { |
12654 | 12653 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12655 | 12654 | |
12656 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
12655 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
12657 | 12656 | |
12658 | 12657 | if ($use_mb_functions) { |
12659 | 12658 | $str_part_one = \mb_strtoupper( |
12660 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
12659 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
12661 | 12660 | $encoding |
12662 | 12661 | ); |
12663 | 12662 | } else { |
12664 | 12663 | $str_part_one = self::strtoupper( |
12665 | - (string) self::substr($str, 0, 1, $encoding), |
|
12664 | + (string)self::substr($str, 0, 1, $encoding), |
|
12666 | 12665 | $encoding, |
12667 | 12666 | false, |
12668 | 12667 | $lang, |
@@ -12671,7 +12670,7 @@ discard block |
||
12671 | 12670 | } |
12672 | 12671 | } |
12673 | 12672 | |
12674 | - return $str_part_one . $str_part_two; |
|
12673 | + return $str_part_one.$str_part_two; |
|
12675 | 12674 | } |
12676 | 12675 | |
12677 | 12676 | /** |
@@ -12730,7 +12729,7 @@ discard block |
||
12730 | 12729 | $str = self::clean($str); |
12731 | 12730 | } |
12732 | 12731 | |
12733 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
12732 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
12734 | 12733 | |
12735 | 12734 | if ( |
12736 | 12735 | $use_php_default_functions |
@@ -13143,7 +13142,7 @@ discard block |
||
13143 | 13142 | if ( |
13144 | 13143 | $keep_utf8_chars |
13145 | 13144 | && |
13146 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
13145 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
13147 | 13146 | ) { |
13148 | 13147 | return $str_backup; |
13149 | 13148 | } |
@@ -13230,17 +13229,17 @@ discard block |
||
13230 | 13229 | return ''; |
13231 | 13230 | } |
13232 | 13231 | |
13233 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
13232 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
13234 | 13233 | |
13235 | 13234 | if ( |
13236 | 13235 | !isset($matches[0]) |
13237 | 13236 | || |
13238 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
13237 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
13239 | 13238 | ) { |
13240 | 13239 | return $str; |
13241 | 13240 | } |
13242 | 13241 | |
13243 | - return \rtrim($matches[0]) . $str_add_on; |
|
13242 | + return \rtrim($matches[0]).$str_add_on; |
|
13244 | 13243 | } |
13245 | 13244 | |
13246 | 13245 | /** |
@@ -13329,7 +13328,7 @@ discard block |
||
13329 | 13328 | } |
13330 | 13329 | } |
13331 | 13330 | |
13332 | - return $str_return . \implode('', $chars); |
|
13331 | + return $str_return.\implode('', $chars); |
|
13333 | 13332 | } |
13334 | 13333 | |
13335 | 13334 | /** |
@@ -13383,7 +13382,7 @@ discard block |
||
13383 | 13382 | $final_break = ''; |
13384 | 13383 | } |
13385 | 13384 | |
13386 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
13385 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
13387 | 13386 | } |
13388 | 13387 | |
13389 | 13388 | /** |
@@ -13619,7 +13618,7 @@ discard block |
||
13619 | 13618 | /** @noinspection PhpIncludeInspection */ |
13620 | 13619 | /** @noinspection UsingInclusionReturnValueInspection */ |
13621 | 13620 | /** @psalm-suppress UnresolvableInclude */ |
13622 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
13621 | + return include __DIR__.'/data/'.$file.'.php'; |
|
13623 | 13622 | } |
13624 | 13623 | |
13625 | 13624 | /** |
@@ -13639,7 +13638,7 @@ discard block |
||
13639 | 13638 | */ |
13640 | 13639 | \uksort( |
13641 | 13640 | self::$EMOJI, |
13642 | - static function (string $a, string $b): int { |
|
13641 | + static function(string $a, string $b): int { |
|
13643 | 13642 | return \strlen($b) <=> \strlen($a); |
13644 | 13643 | } |
13645 | 13644 | ); |
@@ -13649,7 +13648,7 @@ discard block |
||
13649 | 13648 | |
13650 | 13649 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
13651 | 13650 | $tmp_key = \crc32($key); |
13652 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
13651 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
13653 | 13652 | } |
13654 | 13653 | |
13655 | 13654 | return true; |
@@ -13677,7 +13676,7 @@ discard block |
||
13677 | 13676 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
13678 | 13677 | return \defined('MB_OVERLOAD_STRING') |
13679 | 13678 | && |
13680 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
13679 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
13681 | 13680 | } |
13682 | 13681 | |
13683 | 13682 | /** |
@@ -13743,7 +13742,7 @@ discard block |
||
13743 | 13742 | */ |
13744 | 13743 | static $RX_CLASS_CACHE = []; |
13745 | 13744 | |
13746 | - $cache_key = $s . '_' . $class; |
|
13745 | + $cache_key = $s.'_'.$class; |
|
13747 | 13746 | |
13748 | 13747 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
13749 | 13748 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -13755,7 +13754,7 @@ discard block |
||
13755 | 13754 | /** @noinspection AlterInForeachInspection */ |
13756 | 13755 | foreach (self::str_split($s) as &$s) { |
13757 | 13756 | if ($s === '-') { |
13758 | - $class_array[0] = '-' . $class_array[0]; |
|
13757 | + $class_array[0] = '-'.$class_array[0]; |
|
13759 | 13758 | } elseif (!isset($s[2])) { |
13760 | 13759 | $class_array[0] .= \preg_quote($s, '/'); |
13761 | 13760 | } elseif (self::strlen($s) === 1) { |
@@ -13766,13 +13765,13 @@ discard block |
||
13766 | 13765 | } |
13767 | 13766 | |
13768 | 13767 | if ($class_array[0]) { |
13769 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
13768 | + $class_array[0] = '['.$class_array[0].']'; |
|
13770 | 13769 | } |
13771 | 13770 | |
13772 | 13771 | if (\count($class_array) === 1) { |
13773 | 13772 | $return = $class_array[0]; |
13774 | 13773 | } else { |
13775 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
13774 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
13776 | 13775 | } |
13777 | 13776 | |
13778 | 13777 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -13853,7 +13852,7 @@ discard block |
||
13853 | 13852 | |
13854 | 13853 | if ($delimiter === '-') { |
13855 | 13854 | /** @noinspection AlterInForeachInspection */ |
13856 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
13855 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
13857 | 13856 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
13858 | 13857 | $continue = true; |
13859 | 13858 | |
@@ -13863,7 +13862,7 @@ discard block |
||
13863 | 13862 | } |
13864 | 13863 | |
13865 | 13864 | /** @noinspection AlterInForeachInspection */ |
13866 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
13865 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
13867 | 13866 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
13868 | 13867 | $continue = true; |
13869 | 13868 | |
@@ -13933,8 +13932,8 @@ discard block |
||
13933 | 13932 | } else { |
13934 | 13933 | /** @noinspection OffsetOperationsInspection */ |
13935 | 13934 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
13936 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
13937 | - $buf .= $cc1 . $cc2; |
|
13935 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
13936 | + $buf .= $cc1.$cc2; |
|
13938 | 13937 | } |
13939 | 13938 | |
13940 | 13939 | return $buf; |
@@ -13953,7 +13952,7 @@ discard block |
||
13953 | 13952 | { |
13954 | 13953 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
13955 | 13954 | if (\preg_match($pattern, $str)) { |
13956 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
13955 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
13957 | 13956 | } |
13958 | 13957 | |
13959 | 13958 | return $str; |