@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | } |
264 | 264 | |
265 | 265 | if ($encoding === 'UTF-8') { |
266 | - return (string) \mb_substr($str, $pos, 1); |
|
266 | + return (string)\mb_substr($str, $pos, 1); |
|
267 | 267 | } |
268 | 268 | |
269 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
269 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | public static function add_bom_to_string(string $str): string |
287 | 287 | { |
288 | 288 | if (!self::string_has_bom($str)) { |
289 | - $str = self::bom() . $str; |
|
289 | + $str = self::bom().$str; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | return $str; |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | return ''; |
359 | 359 | } |
360 | 360 | |
361 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
361 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
362 | 362 | $end_position = \mb_strpos($str, $end, $substr_index); |
363 | 363 | if ( |
364 | 364 | $end_position === false |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | return ''; |
369 | 369 | } |
370 | 370 | |
371 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
371 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | return ''; |
379 | 379 | } |
380 | 380 | |
381 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
381 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
382 | 382 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
383 | 383 | if ( |
384 | 384 | $end_position === false |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | return ''; |
389 | 389 | } |
390 | 390 | |
391 | - return (string) self::substr( |
|
391 | + return (string)self::substr( |
|
392 | 392 | $str, |
393 | 393 | $substr_index, |
394 | 394 | $end_position - $substr_index, |
@@ -472,10 +472,10 @@ discard block |
||
472 | 472 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
473 | 473 | { |
474 | 474 | if ($encoding === 'UTF-8') { |
475 | - return (string) \mb_substr($str, $index, 1); |
|
475 | + return (string)\mb_substr($str, $index, 1); |
|
476 | 476 | } |
477 | 477 | |
478 | - return (string) self::substr($str, $index, 1, $encoding); |
|
478 | + return (string)self::substr($str, $index, 1, $encoding); |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | /** |
@@ -590,14 +590,14 @@ discard block |
||
590 | 590 | /** |
591 | 591 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
592 | 592 | */ |
593 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
593 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | if (!\is_int($code_point) || $code_point <= 0) { |
597 | 597 | return null; |
598 | 598 | } |
599 | 599 | |
600 | - $cache_key = $code_point . '_' . $encoding; |
|
600 | + $cache_key = $code_point.'_'.$encoding; |
|
601 | 601 | if (isset($CHAR_CACHE[$cache_key])) { |
602 | 602 | return $CHAR_CACHE[$cache_key]; |
603 | 603 | } |
@@ -642,27 +642,27 @@ discard block |
||
642 | 642 | self::$CHR = self::getData('chr'); |
643 | 643 | } |
644 | 644 | |
645 | - $code_point = (int) $code_point; |
|
645 | + $code_point = (int)$code_point; |
|
646 | 646 | if ($code_point <= 0x7FF) { |
647 | 647 | /** |
648 | 648 | * @psalm-suppress PossiblyNullArrayAccess |
649 | 649 | */ |
650 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
650 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
651 | 651 | self::$CHR[($code_point & 0x3F) + 0x80]; |
652 | 652 | } elseif ($code_point <= 0xFFFF) { |
653 | 653 | /** |
654 | 654 | * @psalm-suppress PossiblyNullArrayAccess |
655 | 655 | */ |
656 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
657 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
656 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
657 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
658 | 658 | self::$CHR[($code_point & 0x3F) + 0x80]; |
659 | 659 | } else { |
660 | 660 | /** |
661 | 661 | * @psalm-suppress PossiblyNullArrayAccess |
662 | 662 | */ |
663 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
664 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
665 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
663 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
664 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
665 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
666 | 666 | self::$CHR[($code_point & 0x3F) + 0x80]; |
667 | 667 | } |
668 | 668 | |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | |
720 | 720 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
721 | 721 | return \array_map( |
722 | - static function (string $data): int { |
|
722 | + static function(string $data): int { |
|
723 | 723 | // "mb_" is available if overload is used, so use it ... |
724 | 724 | return \mb_strlen($data, 'CP850'); // 8-BIT |
725 | 725 | }, |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | $char = ''; |
807 | 807 | } |
808 | 808 | |
809 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
809 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | /** |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
884 | 884 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
885 | 885 | /x'; |
886 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
886 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
887 | 887 | |
888 | 888 | if ($replace_diamond_question_mark) { |
889 | 889 | $str = self::replace_diamond_question_mark($str); |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | public static function cleanup($str): string |
923 | 923 | { |
924 | 924 | // init |
925 | - $str = (string) $str; |
|
925 | + $str = (string)$str; |
|
926 | 926 | |
927 | 927 | if ($str === '') { |
928 | 928 | return ''; |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | public static function collapse_whitespace(string $str): string |
1024 | 1024 | { |
1025 | 1025 | if (self::$SUPPORT['mbstring'] === true) { |
1026 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1026 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1127,9 +1127,9 @@ discard block |
||
1127 | 1127 | // - 0-9 (U+0061 - U+007A) |
1128 | 1128 | // - ISO 10646 characters U+00A1 and higher |
1129 | 1129 | // We strip out any character not in the above list. |
1130 | - $str = (string) \preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
1130 | + $str = (string)\preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
1131 | 1131 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
1132 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1132 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1133 | 1133 | |
1134 | 1134 | return \trim($str, '-'); |
1135 | 1135 | } |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | */ |
1146 | 1146 | public static function css_stripe_media_queries(string $str): string |
1147 | 1147 | { |
1148 | - return (string) \preg_replace( |
|
1148 | + return (string)\preg_replace( |
|
1149 | 1149 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
1150 | 1150 | '', |
1151 | 1151 | $str |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | { |
1187 | 1187 | // We cannot use html_entity_decode() here, as it will not return |
1188 | 1188 | // characters for many values < 160. |
1189 | - return mb_convert_encoding('&#' . $int . ';', 'UTF-8', 'HTML-ENTITIES'); |
|
1189 | + return mb_convert_encoding('&#'.$int.';', 'UTF-8', 'HTML-ENTITIES'); |
|
1190 | 1190 | } |
1191 | 1191 | |
1192 | 1192 | /** |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | $flagOffset = 0x1F1E6; |
1237 | 1237 | $asciiOffset = 0x41; |
1238 | 1238 | |
1239 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
1239 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
1240 | 1240 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
1241 | 1241 | } |
1242 | 1242 | |
@@ -1270,16 +1270,16 @@ discard block |
||
1270 | 1270 | } |
1271 | 1271 | |
1272 | 1272 | if ($use_reversible_string_mappings) { |
1273 | - return (string) \str_replace( |
|
1274 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1275 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1273 | + return (string)\str_replace( |
|
1274 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1275 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1276 | 1276 | $str |
1277 | 1277 | ); |
1278 | 1278 | } |
1279 | 1279 | |
1280 | - return (string) \str_replace( |
|
1281 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1282 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1280 | + return (string)\str_replace( |
|
1281 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1282 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1283 | 1283 | $str |
1284 | 1284 | ); |
1285 | 1285 | } |
@@ -1314,16 +1314,16 @@ discard block |
||
1314 | 1314 | } |
1315 | 1315 | |
1316 | 1316 | if ($use_reversible_string_mappings) { |
1317 | - return (string) \str_replace( |
|
1318 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1319 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1317 | + return (string)\str_replace( |
|
1318 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1319 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1320 | 1320 | $str |
1321 | 1321 | ); |
1322 | 1322 | } |
1323 | 1323 | |
1324 | - return (string) \str_replace( |
|
1325 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1326 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1324 | + return (string)\str_replace( |
|
1325 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1326 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1327 | 1327 | $str |
1328 | 1328 | ); |
1329 | 1329 | } |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | if ($to_encoding === 'JSON') { |
1390 | 1390 | $return = self::json_encode($str); |
1391 | 1391 | if ($return === false) { |
1392 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1392 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1393 | 1393 | } |
1394 | 1394 | |
1395 | 1395 | return $return; |
@@ -1478,7 +1478,7 @@ discard block |
||
1478 | 1478 | /** |
1479 | 1479 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
1480 | 1480 | */ |
1481 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1481 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1482 | 1482 | } |
1483 | 1483 | |
1484 | 1484 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1579,31 +1579,31 @@ discard block |
||
1579 | 1579 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1580 | 1580 | |
1581 | 1581 | if ($length === null) { |
1582 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
1582 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
1583 | 1583 | } |
1584 | 1584 | |
1585 | 1585 | if ($search === '') { |
1586 | 1586 | if ($encoding === 'UTF-8') { |
1587 | 1587 | if ($length > 0) { |
1588 | - $string_length = (int) \mb_strlen($str); |
|
1588 | + $string_length = (int)\mb_strlen($str); |
|
1589 | 1589 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1590 | 1590 | } else { |
1591 | 1591 | $end = 0; |
1592 | 1592 | } |
1593 | 1593 | |
1594 | - $pos = (int) \min( |
|
1594 | + $pos = (int)\min( |
|
1595 | 1595 | \mb_strpos($str, ' ', $end), |
1596 | 1596 | \mb_strpos($str, '.', $end) |
1597 | 1597 | ); |
1598 | 1598 | } else { |
1599 | 1599 | if ($length > 0) { |
1600 | - $string_length = (int) self::strlen($str, $encoding); |
|
1600 | + $string_length = (int)self::strlen($str, $encoding); |
|
1601 | 1601 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1602 | 1602 | } else { |
1603 | 1603 | $end = 0; |
1604 | 1604 | } |
1605 | 1605 | |
1606 | - $pos = (int) \min( |
|
1606 | + $pos = (int)\min( |
|
1607 | 1607 | self::strpos($str, ' ', $end, $encoding), |
1608 | 1608 | self::strpos($str, '.', $end, $encoding) |
1609 | 1609 | ); |
@@ -1620,18 +1620,18 @@ discard block |
||
1620 | 1620 | return ''; |
1621 | 1621 | } |
1622 | 1622 | |
1623 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1623 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1624 | 1624 | } |
1625 | 1625 | |
1626 | 1626 | return $str; |
1627 | 1627 | } |
1628 | 1628 | |
1629 | 1629 | if ($encoding === 'UTF-8') { |
1630 | - $word_position = (int) \mb_stripos($str, $search); |
|
1631 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1630 | + $word_position = (int)\mb_stripos($str, $search); |
|
1631 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1632 | 1632 | } else { |
1633 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1634 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1633 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1634 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1635 | 1635 | } |
1636 | 1636 | |
1637 | 1637 | $pos_start = 0; |
@@ -1643,12 +1643,12 @@ discard block |
||
1643 | 1643 | } |
1644 | 1644 | if ($half_text !== false) { |
1645 | 1645 | if ($encoding === 'UTF-8') { |
1646 | - $pos_start = (int) \max( |
|
1646 | + $pos_start = (int)\max( |
|
1647 | 1647 | \mb_strrpos($half_text, ' '), |
1648 | 1648 | \mb_strrpos($half_text, '.') |
1649 | 1649 | ); |
1650 | 1650 | } else { |
1651 | - $pos_start = (int) \max( |
|
1651 | + $pos_start = (int)\max( |
|
1652 | 1652 | self::strrpos($half_text, ' ', 0, $encoding), |
1653 | 1653 | self::strrpos($half_text, '.', 0, $encoding) |
1654 | 1654 | ); |
@@ -1658,19 +1658,19 @@ discard block |
||
1658 | 1658 | |
1659 | 1659 | if ($word_position && $half_side > 0) { |
1660 | 1660 | $offset = $pos_start + $length - 1; |
1661 | - $real_length = (int) self::strlen($str, $encoding); |
|
1661 | + $real_length = (int)self::strlen($str, $encoding); |
|
1662 | 1662 | |
1663 | 1663 | if ($offset > $real_length) { |
1664 | 1664 | $offset = $real_length; |
1665 | 1665 | } |
1666 | 1666 | |
1667 | 1667 | if ($encoding === 'UTF-8') { |
1668 | - $pos_end = (int) \min( |
|
1668 | + $pos_end = (int)\min( |
|
1669 | 1669 | \mb_strpos($str, ' ', $offset), |
1670 | 1670 | \mb_strpos($str, '.', $offset) |
1671 | 1671 | ) - $pos_start; |
1672 | 1672 | } else { |
1673 | - $pos_end = (int) \min( |
|
1673 | + $pos_end = (int)\min( |
|
1674 | 1674 | self::strpos($str, ' ', $offset, $encoding), |
1675 | 1675 | self::strpos($str, '.', $offset, $encoding) |
1676 | 1676 | ) - $pos_start; |
@@ -1678,12 +1678,12 @@ discard block |
||
1678 | 1678 | |
1679 | 1679 | if (!$pos_end || $pos_end <= 0) { |
1680 | 1680 | if ($encoding === 'UTF-8') { |
1681 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1681 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1682 | 1682 | } else { |
1683 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1683 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1684 | 1684 | } |
1685 | 1685 | if ($str_sub !== false) { |
1686 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1686 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1687 | 1687 | } else { |
1688 | 1688 | $extract = ''; |
1689 | 1689 | } |
@@ -1694,26 +1694,26 @@ discard block |
||
1694 | 1694 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1695 | 1695 | } |
1696 | 1696 | if ($str_sub !== false) { |
1697 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1697 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1698 | 1698 | } else { |
1699 | 1699 | $extract = ''; |
1700 | 1700 | } |
1701 | 1701 | } |
1702 | 1702 | } else { |
1703 | 1703 | $offset = $length - 1; |
1704 | - $true_length = (int) self::strlen($str, $encoding); |
|
1704 | + $true_length = (int)self::strlen($str, $encoding); |
|
1705 | 1705 | |
1706 | 1706 | if ($offset > $true_length) { |
1707 | 1707 | $offset = $true_length; |
1708 | 1708 | } |
1709 | 1709 | |
1710 | 1710 | if ($encoding === 'UTF-8') { |
1711 | - $pos_end = (int) \min( |
|
1711 | + $pos_end = (int)\min( |
|
1712 | 1712 | \mb_strpos($str, ' ', $offset), |
1713 | 1713 | \mb_strpos($str, '.', $offset) |
1714 | 1714 | ); |
1715 | 1715 | } else { |
1716 | - $pos_end = (int) \min( |
|
1716 | + $pos_end = (int)\min( |
|
1717 | 1717 | self::strpos($str, ' ', $offset, $encoding), |
1718 | 1718 | self::strpos($str, '.', $offset, $encoding) |
1719 | 1719 | ); |
@@ -1726,7 +1726,7 @@ discard block |
||
1726 | 1726 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1727 | 1727 | } |
1728 | 1728 | if ($str_sub !== false) { |
1729 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1729 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1730 | 1730 | } else { |
1731 | 1731 | $extract = ''; |
1732 | 1732 | } |
@@ -1862,7 +1862,7 @@ discard block |
||
1862 | 1862 | { |
1863 | 1863 | $file_content = \file_get_contents($file_path); |
1864 | 1864 | if ($file_content === false) { |
1865 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1865 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1866 | 1866 | } |
1867 | 1867 | |
1868 | 1868 | return self::string_has_bom($file_content); |
@@ -1930,7 +1930,7 @@ discard block |
||
1930 | 1930 | ) { |
1931 | 1931 | // Prevent leading combining chars |
1932 | 1932 | // for NFC-safe concatenations. |
1933 | - $var = $leading_combining . $var; |
|
1933 | + $var = $leading_combining.$var; |
|
1934 | 1934 | } |
1935 | 1935 | } |
1936 | 1936 | |
@@ -2251,10 +2251,10 @@ discard block |
||
2251 | 2251 | } |
2252 | 2252 | |
2253 | 2253 | if ($encoding === 'UTF-8') { |
2254 | - return (string) \mb_substr($str, 0, $n); |
|
2254 | + return (string)\mb_substr($str, 0, $n); |
|
2255 | 2255 | } |
2256 | 2256 | |
2257 | - return (string) self::substr($str, 0, $n, $encoding); |
|
2257 | + return (string)self::substr($str, 0, $n, $encoding); |
|
2258 | 2258 | } |
2259 | 2259 | |
2260 | 2260 | /** |
@@ -2272,7 +2272,7 @@ discard block |
||
2272 | 2272 | */ |
2273 | 2273 | public static function fits_inside(string $str, int $box_size): bool |
2274 | 2274 | { |
2275 | - return (int) self::strlen($str) <= $box_size; |
|
2275 | + return (int)self::strlen($str) <= $box_size; |
|
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | /** |
@@ -2357,7 +2357,7 @@ discard block |
||
2357 | 2357 | return $str; |
2358 | 2358 | } |
2359 | 2359 | |
2360 | - $str = (string) $str; |
|
2360 | + $str = (string)$str; |
|
2361 | 2361 | $last = ''; |
2362 | 2362 | while ($last !== $str) { |
2363 | 2363 | $last = $str; |
@@ -2560,7 +2560,7 @@ discard block |
||
2560 | 2560 | if ($str_info === false) { |
2561 | 2561 | return $fallback; |
2562 | 2562 | } |
2563 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2563 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2564 | 2564 | |
2565 | 2565 | // DEBUG |
2566 | 2566 | //var_dump($type_code); |
@@ -2618,7 +2618,7 @@ discard block |
||
2618 | 2618 | // |
2619 | 2619 | |
2620 | 2620 | if ($encoding === 'UTF-8') { |
2621 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2621 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2622 | 2622 | if ($max_length === 0) { |
2623 | 2623 | return ''; |
2624 | 2624 | } |
@@ -2638,7 +2638,7 @@ discard block |
||
2638 | 2638 | } else { |
2639 | 2639 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2640 | 2640 | |
2641 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2641 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2642 | 2642 | if ($max_length === 0) { |
2643 | 2643 | return ''; |
2644 | 2644 | } |
@@ -2674,16 +2674,16 @@ discard block |
||
2674 | 2674 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
2675 | 2675 | } |
2676 | 2676 | |
2677 | - $unique_helper = $rand_int . |
|
2678 | - \session_id() . |
|
2679 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2680 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2677 | + $unique_helper = $rand_int. |
|
2678 | + \session_id(). |
|
2679 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2680 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2681 | 2681 | $extra_entropy; |
2682 | 2682 | |
2683 | 2683 | $unique_string = \uniqid($unique_helper, true); |
2684 | 2684 | |
2685 | 2685 | if ($use_md5) { |
2686 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2686 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2687 | 2687 | } |
2688 | 2688 | |
2689 | 2689 | return $unique_string; |
@@ -2762,7 +2762,7 @@ discard block |
||
2762 | 2762 | public static function hex_to_chr(string $hexdec) |
2763 | 2763 | { |
2764 | 2764 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
2765 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
2765 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
2766 | 2766 | } |
2767 | 2767 | |
2768 | 2768 | /** |
@@ -2782,7 +2782,7 @@ discard block |
||
2782 | 2782 | public static function hex_to_int($hexdec) |
2783 | 2783 | { |
2784 | 2784 | // init |
2785 | - $hexdec = (string) $hexdec; |
|
2785 | + $hexdec = (string)$hexdec; |
|
2786 | 2786 | |
2787 | 2787 | if ($hexdec === '') { |
2788 | 2788 | return false; |
@@ -2860,7 +2860,7 @@ discard block |
||
2860 | 2860 | return \implode( |
2861 | 2861 | '', |
2862 | 2862 | \array_map( |
2863 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2863 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2864 | 2864 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2865 | 2865 | }, |
2866 | 2866 | self::str_split($str) |
@@ -2974,7 +2974,7 @@ discard block |
||
2974 | 2974 | /** |
2975 | 2975 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
2976 | 2976 | */ |
2977 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
2977 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
2978 | 2978 | } |
2979 | 2979 | |
2980 | 2980 | do { |
@@ -2983,7 +2983,7 @@ discard block |
||
2983 | 2983 | if (\strpos($str, '&') !== false) { |
2984 | 2984 | if (\strpos($str, '&#') !== false) { |
2985 | 2985 | // decode also numeric & UTF16 two byte entities |
2986 | - $str = (string) \preg_replace( |
|
2986 | + $str = (string)\preg_replace( |
|
2987 | 2987 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
2988 | 2988 | '$1;', |
2989 | 2989 | $str |
@@ -3033,7 +3033,7 @@ discard block |
||
3033 | 3033 | */ |
3034 | 3034 | public static function html_stripe_empty_tags(string $str): string |
3035 | 3035 | { |
3036 | - return (string) \preg_replace( |
|
3036 | + return (string)\preg_replace( |
|
3037 | 3037 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
3038 | 3038 | '', |
3039 | 3039 | $str |
@@ -3344,9 +3344,9 @@ discard block |
||
3344 | 3344 | { |
3345 | 3345 | $hex = \dechex($int); |
3346 | 3346 | |
3347 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
3347 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
3348 | 3348 | |
3349 | - return $prefix . $hex . ''; |
|
3349 | + return $prefix.$hex.''; |
|
3350 | 3350 | } |
3351 | 3351 | |
3352 | 3352 | /** |
@@ -3514,7 +3514,7 @@ discard block |
||
3514 | 3514 | */ |
3515 | 3515 | public static function is_binary($input, bool $strict = false): bool |
3516 | 3516 | { |
3517 | - $input = (string) $input; |
|
3517 | + $input = (string)$input; |
|
3518 | 3518 | if ($input === '') { |
3519 | 3519 | return false; |
3520 | 3520 | } |
@@ -3866,7 +3866,7 @@ discard block |
||
3866 | 3866 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
3867 | 3867 | { |
3868 | 3868 | // init |
3869 | - $str = (string) $str; |
|
3869 | + $str = (string)$str; |
|
3870 | 3870 | $str_chars = []; |
3871 | 3871 | |
3872 | 3872 | // fix for the "binary"-check |
@@ -3965,7 +3965,7 @@ discard block |
||
3965 | 3965 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
3966 | 3966 | { |
3967 | 3967 | // init |
3968 | - $str = (string) $str; |
|
3968 | + $str = (string)$str; |
|
3969 | 3969 | $str_chars = []; |
3970 | 3970 | |
3971 | 3971 | // fix for the "binary"-check |
@@ -4068,7 +4068,7 @@ discard block |
||
4068 | 4068 | return true; |
4069 | 4069 | } |
4070 | 4070 | |
4071 | - return self::is_utf8_string((string) $str, $strict); |
|
4071 | + return self::is_utf8_string((string)$str, $strict); |
|
4072 | 4072 | } |
4073 | 4073 | |
4074 | 4074 | /** |
@@ -4232,15 +4232,15 @@ discard block |
||
4232 | 4232 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
4233 | 4233 | |
4234 | 4234 | if ($encoding === 'UTF-8') { |
4235 | - $str_part_two = (string) \mb_substr($str, 1); |
|
4235 | + $str_part_two = (string)\mb_substr($str, 1); |
|
4236 | 4236 | |
4237 | 4237 | if ($use_mb_functions) { |
4238 | 4238 | $str_part_one = \mb_strtolower( |
4239 | - (string) \mb_substr($str, 0, 1) |
|
4239 | + (string)\mb_substr($str, 0, 1) |
|
4240 | 4240 | ); |
4241 | 4241 | } else { |
4242 | 4242 | $str_part_one = self::strtolower( |
4243 | - (string) \mb_substr($str, 0, 1), |
|
4243 | + (string)\mb_substr($str, 0, 1), |
|
4244 | 4244 | $encoding, |
4245 | 4245 | false, |
4246 | 4246 | $lang, |
@@ -4250,10 +4250,10 @@ discard block |
||
4250 | 4250 | } else { |
4251 | 4251 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4252 | 4252 | |
4253 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
4253 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
4254 | 4254 | |
4255 | 4255 | $str_part_one = self::strtolower( |
4256 | - (string) self::substr($str, 0, 1, $encoding), |
|
4256 | + (string)self::substr($str, 0, 1, $encoding), |
|
4257 | 4257 | $encoding, |
4258 | 4258 | false, |
4259 | 4259 | $lang, |
@@ -4261,7 +4261,7 @@ discard block |
||
4261 | 4261 | ); |
4262 | 4262 | } |
4263 | 4263 | |
4264 | - return $str_part_one . $str_part_two; |
|
4264 | + return $str_part_one.$str_part_two; |
|
4265 | 4265 | } |
4266 | 4266 | |
4267 | 4267 | /** |
@@ -4345,7 +4345,7 @@ discard block |
||
4345 | 4345 | $pattern = '^[\\s]+'; |
4346 | 4346 | } |
4347 | 4347 | |
4348 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4348 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4349 | 4349 | } |
4350 | 4350 | |
4351 | 4351 | if ($chars !== null) { |
@@ -4382,7 +4382,7 @@ discard block |
||
4382 | 4382 | |
4383 | 4383 | $codepoint_max = \max($codepoints); |
4384 | 4384 | |
4385 | - return self::chr((int) $codepoint_max); |
|
4385 | + return self::chr((int)$codepoint_max); |
|
4386 | 4386 | } |
4387 | 4387 | |
4388 | 4388 | /** |
@@ -4402,7 +4402,7 @@ discard block |
||
4402 | 4402 | { |
4403 | 4403 | $bytes = self::chr_size_list($str); |
4404 | 4404 | if ($bytes !== []) { |
4405 | - return (int) \max($bytes); |
|
4405 | + return (int)\max($bytes); |
|
4406 | 4406 | } |
4407 | 4407 | |
4408 | 4408 | return 0; |
@@ -4448,7 +4448,7 @@ discard block |
||
4448 | 4448 | |
4449 | 4449 | $codepoint_min = \min($codepoints); |
4450 | 4450 | |
4451 | - return self::chr((int) $codepoint_min); |
|
4451 | + return self::chr((int)$codepoint_min); |
|
4452 | 4452 | } |
4453 | 4453 | |
4454 | 4454 | /** |
@@ -4478,7 +4478,7 @@ discard block |
||
4478 | 4478 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4479 | 4479 | |
4480 | 4480 | // init |
4481 | - $encoding = (string) $encoding; |
|
4481 | + $encoding = (string)$encoding; |
|
4482 | 4482 | |
4483 | 4483 | if (!$encoding) { |
4484 | 4484 | return $fallback; |
@@ -4540,7 +4540,7 @@ discard block |
||
4540 | 4540 | |
4541 | 4541 | $encoding_original = $encoding; |
4542 | 4542 | $encoding = \strtoupper($encoding); |
4543 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4543 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4544 | 4544 | |
4545 | 4545 | $equivalences = [ |
4546 | 4546 | 'ISO8859' => 'ISO-8859-1', |
@@ -4707,13 +4707,13 @@ discard block |
||
4707 | 4707 | static $CHAR_CACHE = []; |
4708 | 4708 | |
4709 | 4709 | // init |
4710 | - $chr = (string) $chr; |
|
4710 | + $chr = (string)$chr; |
|
4711 | 4711 | |
4712 | 4712 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
4713 | 4713 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4714 | 4714 | } |
4715 | 4715 | |
4716 | - $cache_key = $chr . '_' . $encoding; |
|
4716 | + $cache_key = $chr.'_'.$encoding; |
|
4717 | 4717 | if (isset($CHAR_CACHE[$cache_key])) { |
4718 | 4718 | return $CHAR_CACHE[$cache_key]; |
4719 | 4719 | } |
@@ -4746,7 +4746,7 @@ discard block |
||
4746 | 4746 | // fallback via vanilla php |
4747 | 4747 | // |
4748 | 4748 | |
4749 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
4749 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
4750 | 4750 | /** @noinspection PhpSillyAssignmentInspection - hack for phpstan */ |
4751 | 4751 | /** @var int[] $chr - "unpack": only false if the format string contains errors */ |
4752 | 4752 | $chr = $chr; |
@@ -4823,7 +4823,7 @@ discard block |
||
4823 | 4823 | public static function pcre_utf8_support(): bool |
4824 | 4824 | { |
4825 | 4825 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
4826 | - return (bool) @\preg_match('//u', ''); |
|
4826 | + return (bool)@\preg_match('//u', ''); |
|
4827 | 4827 | } |
4828 | 4828 | |
4829 | 4829 | /** |
@@ -4864,14 +4864,14 @@ discard block |
||
4864 | 4864 | * @psalm-suppress DocblockTypeContradiction |
4865 | 4865 | */ |
4866 | 4866 | if (!\is_numeric($step)) { |
4867 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
4867 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
4868 | 4868 | } |
4869 | 4869 | |
4870 | 4870 | /** |
4871 | 4871 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
4872 | 4872 | */ |
4873 | 4873 | if ($step <= 0) { |
4874 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
4874 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
4875 | 4875 | } |
4876 | 4876 | } |
4877 | 4877 | |
@@ -4882,16 +4882,16 @@ discard block |
||
4882 | 4882 | $is_digit = false; |
4883 | 4883 | $is_xdigit = false; |
4884 | 4884 | |
4885 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
4885 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
4886 | 4886 | $is_digit = true; |
4887 | - $start = (int) $var1; |
|
4887 | + $start = (int)$var1; |
|
4888 | 4888 | } elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
4889 | 4889 | $is_xdigit = true; |
4890 | - $start = (int) self::hex_to_int((string) $var1); |
|
4890 | + $start = (int)self::hex_to_int((string)$var1); |
|
4891 | 4891 | } elseif (!$use_ctype && \is_numeric($var1)) { |
4892 | - $start = (int) $var1; |
|
4892 | + $start = (int)$var1; |
|
4893 | 4893 | } else { |
4894 | - $start = self::ord((string) $var1); |
|
4894 | + $start = self::ord((string)$var1); |
|
4895 | 4895 | } |
4896 | 4896 | |
4897 | 4897 | if (!$start) { |
@@ -4899,13 +4899,13 @@ discard block |
||
4899 | 4899 | } |
4900 | 4900 | |
4901 | 4901 | if ($is_digit) { |
4902 | - $end = (int) $var2; |
|
4902 | + $end = (int)$var2; |
|
4903 | 4903 | } elseif ($is_xdigit) { |
4904 | - $end = (int) self::hex_to_int((string) $var2); |
|
4904 | + $end = (int)self::hex_to_int((string)$var2); |
|
4905 | 4905 | } elseif (!$use_ctype && \is_numeric($var2)) { |
4906 | - $end = (int) $var2; |
|
4906 | + $end = (int)$var2; |
|
4907 | 4907 | } else { |
4908 | - $end = self::ord((string) $var2); |
|
4908 | + $end = self::ord((string)$var2); |
|
4909 | 4909 | } |
4910 | 4910 | |
4911 | 4911 | if (!$end) { |
@@ -4914,7 +4914,7 @@ discard block |
||
4914 | 4914 | |
4915 | 4915 | $array = []; |
4916 | 4916 | foreach (\range($start, $end, $step) as $i) { |
4917 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
4917 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
4918 | 4918 | } |
4919 | 4919 | |
4920 | 4920 | return $array; |
@@ -5010,8 +5010,8 @@ discard block |
||
5010 | 5010 | $delimiter = '/'; |
5011 | 5011 | } |
5012 | 5012 | |
5013 | - return (string) \preg_replace( |
|
5014 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
5013 | + return (string)\preg_replace( |
|
5014 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
5015 | 5015 | $replacement, |
5016 | 5016 | $str |
5017 | 5017 | ); |
@@ -5046,7 +5046,7 @@ discard block |
||
5046 | 5046 | |
5047 | 5047 | $str_length -= $bom_byte_length; |
5048 | 5048 | |
5049 | - $str = (string) $str_tmp; |
|
5049 | + $str = (string)$str_tmp; |
|
5050 | 5050 | } |
5051 | 5051 | } |
5052 | 5052 | |
@@ -5077,7 +5077,7 @@ discard block |
||
5077 | 5077 | */ |
5078 | 5078 | if (\is_array($what)) { |
5079 | 5079 | foreach ($what as $item) { |
5080 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
5080 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
5081 | 5081 | } |
5082 | 5082 | } |
5083 | 5083 | |
@@ -5115,7 +5115,7 @@ discard block |
||
5115 | 5115 | */ |
5116 | 5116 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
5117 | 5117 | { |
5118 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5118 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5119 | 5119 | } |
5120 | 5120 | |
5121 | 5121 | /** |
@@ -5179,17 +5179,17 @@ discard block |
||
5179 | 5179 | \strpos($str, $substring) === 0 |
5180 | 5180 | ) { |
5181 | 5181 | if ($encoding === 'UTF-8') { |
5182 | - return (string) \mb_substr( |
|
5182 | + return (string)\mb_substr( |
|
5183 | 5183 | $str, |
5184 | - (int) \mb_strlen($substring) |
|
5184 | + (int)\mb_strlen($substring) |
|
5185 | 5185 | ); |
5186 | 5186 | } |
5187 | 5187 | |
5188 | 5188 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5189 | 5189 | |
5190 | - return (string) self::substr( |
|
5190 | + return (string)self::substr( |
|
5191 | 5191 | $str, |
5192 | - (int) self::strlen($substring, $encoding), |
|
5192 | + (int)self::strlen($substring, $encoding), |
|
5193 | 5193 | null, |
5194 | 5194 | $encoding |
5195 | 5195 | ); |
@@ -5217,19 +5217,19 @@ discard block |
||
5217 | 5217 | ): string { |
5218 | 5218 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
5219 | 5219 | if ($encoding === 'UTF-8') { |
5220 | - return (string) \mb_substr( |
|
5220 | + return (string)\mb_substr( |
|
5221 | 5221 | $str, |
5222 | 5222 | 0, |
5223 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
5223 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
5224 | 5224 | ); |
5225 | 5225 | } |
5226 | 5226 | |
5227 | 5227 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5228 | 5228 | |
5229 | - return (string) self::substr( |
|
5229 | + return (string)self::substr( |
|
5230 | 5230 | $str, |
5231 | 5231 | 0, |
5232 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
5232 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
5233 | 5233 | $encoding |
5234 | 5234 | ); |
5235 | 5235 | } |
@@ -5332,7 +5332,7 @@ discard block |
||
5332 | 5332 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
5333 | 5333 | @\mb_substitute_character($replacement_char_helper); |
5334 | 5334 | // the polyfill maybe return false, so cast to string |
5335 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5335 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5336 | 5336 | \mb_substitute_character($save); |
5337 | 5337 | } |
5338 | 5338 | |
@@ -5377,7 +5377,7 @@ discard block |
||
5377 | 5377 | $pattern = '[\\s]+$'; |
5378 | 5378 | } |
5379 | 5379 | |
5380 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5380 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5381 | 5381 | } |
5382 | 5382 | |
5383 | 5383 | if ($chars !== null) { |
@@ -5406,7 +5406,7 @@ discard block |
||
5406 | 5406 | |
5407 | 5407 | $html .= '<pre>'; |
5408 | 5408 | foreach (self::$SUPPORT as $key => &$value) { |
5409 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5409 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
5410 | 5410 | } |
5411 | 5411 | $html .= '</pre>'; |
5412 | 5412 | |
@@ -5448,7 +5448,7 @@ discard block |
||
5448 | 5448 | return $char; |
5449 | 5449 | } |
5450 | 5450 | |
5451 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5451 | + return '&#'.self::ord($char, $encoding).';'; |
|
5452 | 5452 | } |
5453 | 5453 | |
5454 | 5454 | /** |
@@ -5511,11 +5511,11 @@ discard block |
||
5511 | 5511 | $lang, |
5512 | 5512 | $try_to_keep_the_string_length |
5513 | 5513 | ); |
5514 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5514 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5515 | 5515 | |
5516 | 5516 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5517 | 5517 | |
5518 | - $str = (string) \preg_replace_callback( |
|
5518 | + $str = (string)\preg_replace_callback( |
|
5519 | 5519 | '/[-_\\s]+(.)?/u', |
5520 | 5520 | /** |
5521 | 5521 | * @param array $match |
@@ -5524,7 +5524,7 @@ discard block |
||
5524 | 5524 | * |
5525 | 5525 | * @return string |
5526 | 5526 | */ |
5527 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5527 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5528 | 5528 | if (isset($match[1])) { |
5529 | 5529 | if ($use_mb_functions) { |
5530 | 5530 | if ($encoding === 'UTF-8') { |
@@ -5542,7 +5542,7 @@ discard block |
||
5542 | 5542 | $str |
5543 | 5543 | ); |
5544 | 5544 | |
5545 | - return (string) \preg_replace_callback( |
|
5545 | + return (string)\preg_replace_callback( |
|
5546 | 5546 | '/[\\p{N}]+(.)?/u', |
5547 | 5547 | /** |
5548 | 5548 | * @param array $match |
@@ -5551,7 +5551,7 @@ discard block |
||
5551 | 5551 | * |
5552 | 5552 | * @return string |
5553 | 5553 | */ |
5554 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5554 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5555 | 5555 | if ($use_mb_functions) { |
5556 | 5556 | if ($encoding === 'UTF-8') { |
5557 | 5557 | return \mb_strtoupper($match[0]); |
@@ -5746,7 +5746,7 @@ discard block |
||
5746 | 5746 | bool $try_to_keep_the_string_length = false |
5747 | 5747 | ): string { |
5748 | 5748 | if (self::$SUPPORT['mbstring'] === true) { |
5749 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5749 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
5750 | 5750 | |
5751 | 5751 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5752 | 5752 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5755,10 +5755,10 @@ discard block |
||
5755 | 5755 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5756 | 5756 | } |
5757 | 5757 | |
5758 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5758 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
5759 | 5759 | } |
5760 | 5760 | |
5761 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5761 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
5762 | 5762 | |
5763 | 5763 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5764 | 5764 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -5767,7 +5767,7 @@ discard block |
||
5767 | 5767 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
5768 | 5768 | } |
5769 | 5769 | |
5770 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5770 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
5771 | 5771 | } |
5772 | 5772 | |
5773 | 5773 | /** |
@@ -5791,7 +5791,7 @@ discard block |
||
5791 | 5791 | public static function str_detect_encoding($str) |
5792 | 5792 | { |
5793 | 5793 | // init |
5794 | - $str = (string) $str; |
|
5794 | + $str = (string)$str; |
|
5795 | 5795 | |
5796 | 5796 | // |
5797 | 5797 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5893,7 +5893,7 @@ discard block |
||
5893 | 5893 | foreach (self::$ENCODINGS as $encoding_tmp) { |
5894 | 5894 | // INFO: //IGNORE but still throw notice |
5895 | 5895 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5896 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
5896 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
5897 | 5897 | return $encoding_tmp; |
5898 | 5898 | } |
5899 | 5899 | } |
@@ -5983,7 +5983,7 @@ discard block |
||
5983 | 5983 | return $str; |
5984 | 5984 | } |
5985 | 5985 | |
5986 | - return $substring . $str; |
|
5986 | + return $substring.$str; |
|
5987 | 5987 | } |
5988 | 5988 | |
5989 | 5989 | /** |
@@ -6113,27 +6113,27 @@ discard block |
||
6113 | 6113 | string $encoding = 'UTF-8' |
6114 | 6114 | ): string { |
6115 | 6115 | if ($encoding === 'UTF-8') { |
6116 | - $len = (int) \mb_strlen($str); |
|
6116 | + $len = (int)\mb_strlen($str); |
|
6117 | 6117 | if ($index > $len) { |
6118 | 6118 | return $str; |
6119 | 6119 | } |
6120 | 6120 | |
6121 | 6121 | /** @noinspection UnnecessaryCastingInspection */ |
6122 | - return (string) \mb_substr($str, 0, $index) . |
|
6123 | - $substring . |
|
6124 | - (string) \mb_substr($str, $index, $len); |
|
6122 | + return (string)\mb_substr($str, 0, $index). |
|
6123 | + $substring. |
|
6124 | + (string)\mb_substr($str, $index, $len); |
|
6125 | 6125 | } |
6126 | 6126 | |
6127 | 6127 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6128 | 6128 | |
6129 | - $len = (int) self::strlen($str, $encoding); |
|
6129 | + $len = (int)self::strlen($str, $encoding); |
|
6130 | 6130 | if ($index > $len) { |
6131 | 6131 | return $str; |
6132 | 6132 | } |
6133 | 6133 | |
6134 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
6135 | - $substring . |
|
6136 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6134 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
6135 | + $substring. |
|
6136 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
6137 | 6137 | } |
6138 | 6138 | |
6139 | 6139 | /** |
@@ -6173,15 +6173,15 @@ discard block |
||
6173 | 6173 | */ |
6174 | 6174 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
6175 | 6175 | { |
6176 | - $search = (array) $search; |
|
6176 | + $search = (array)$search; |
|
6177 | 6177 | |
6178 | 6178 | /** @noinspection AlterInForeachInspection */ |
6179 | 6179 | foreach ($search as &$s) { |
6180 | - $s = (string) $s; |
|
6180 | + $s = (string)$s; |
|
6181 | 6181 | if ($s === '') { |
6182 | 6182 | $s = '/^(?<=.)$/'; |
6183 | 6183 | } else { |
6184 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
6184 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
6185 | 6185 | } |
6186 | 6186 | } |
6187 | 6187 | |
@@ -6229,12 +6229,12 @@ discard block |
||
6229 | 6229 | } |
6230 | 6230 | |
6231 | 6231 | if ($search === '') { |
6232 | - return $str . $replacement; |
|
6232 | + return $str.$replacement; |
|
6233 | 6233 | } |
6234 | 6234 | |
6235 | 6235 | $searchLength = \strlen($search); |
6236 | 6236 | if (\strncasecmp($str, $search, $searchLength) === 0) { |
6237 | - return $replacement . \substr($str, $searchLength); |
|
6237 | + return $replacement.\substr($str, $searchLength); |
|
6238 | 6238 | } |
6239 | 6239 | |
6240 | 6240 | return $str; |
@@ -6265,11 +6265,11 @@ discard block |
||
6265 | 6265 | } |
6266 | 6266 | |
6267 | 6267 | if ($search === '') { |
6268 | - return $str . $replacement; |
|
6268 | + return $str.$replacement; |
|
6269 | 6269 | } |
6270 | 6270 | |
6271 | 6271 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6272 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6272 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6273 | 6273 | } |
6274 | 6274 | |
6275 | 6275 | return $str; |
@@ -6361,15 +6361,15 @@ discard block |
||
6361 | 6361 | } |
6362 | 6362 | |
6363 | 6363 | if ($encoding === 'UTF-8') { |
6364 | - return (string) \mb_substr( |
|
6364 | + return (string)\mb_substr( |
|
6365 | 6365 | $str, |
6366 | - $offset + (int) \mb_strlen($separator) |
|
6366 | + $offset + (int)\mb_strlen($separator) |
|
6367 | 6367 | ); |
6368 | 6368 | } |
6369 | 6369 | |
6370 | - return (string) self::substr( |
|
6370 | + return (string)self::substr( |
|
6371 | 6371 | $str, |
6372 | - $offset + (int) self::strlen($separator, $encoding), |
|
6372 | + $offset + (int)self::strlen($separator, $encoding), |
|
6373 | 6373 | null, |
6374 | 6374 | $encoding |
6375 | 6375 | ); |
@@ -6401,15 +6401,15 @@ discard block |
||
6401 | 6401 | } |
6402 | 6402 | |
6403 | 6403 | if ($encoding === 'UTF-8') { |
6404 | - return (string) \mb_substr( |
|
6404 | + return (string)\mb_substr( |
|
6405 | 6405 | $str, |
6406 | - $offset + (int) self::strlen($separator) |
|
6406 | + $offset + (int)self::strlen($separator) |
|
6407 | 6407 | ); |
6408 | 6408 | } |
6409 | 6409 | |
6410 | - return (string) self::substr( |
|
6410 | + return (string)self::substr( |
|
6411 | 6411 | $str, |
6412 | - $offset + (int) self::strlen($separator, $encoding), |
|
6412 | + $offset + (int)self::strlen($separator, $encoding), |
|
6413 | 6413 | null, |
6414 | 6414 | $encoding |
6415 | 6415 | ); |
@@ -6441,10 +6441,10 @@ discard block |
||
6441 | 6441 | } |
6442 | 6442 | |
6443 | 6443 | if ($encoding === 'UTF-8') { |
6444 | - return (string) \mb_substr($str, 0, $offset); |
|
6444 | + return (string)\mb_substr($str, 0, $offset); |
|
6445 | 6445 | } |
6446 | 6446 | |
6447 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6447 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6448 | 6448 | } |
6449 | 6449 | |
6450 | 6450 | /** |
@@ -6473,7 +6473,7 @@ discard block |
||
6473 | 6473 | return ''; |
6474 | 6474 | } |
6475 | 6475 | |
6476 | - return (string) \mb_substr($str, 0, $offset); |
|
6476 | + return (string)\mb_substr($str, 0, $offset); |
|
6477 | 6477 | } |
6478 | 6478 | |
6479 | 6479 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -6481,7 +6481,7 @@ discard block |
||
6481 | 6481 | return ''; |
6482 | 6482 | } |
6483 | 6483 | |
6484 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
6484 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
6485 | 6485 | } |
6486 | 6486 | |
6487 | 6487 | /** |
@@ -6583,12 +6583,12 @@ discard block |
||
6583 | 6583 | } |
6584 | 6584 | |
6585 | 6585 | if ($encoding === 'UTF-8') { |
6586 | - return (string) \mb_substr($str, -$n); |
|
6586 | + return (string)\mb_substr($str, -$n); |
|
6587 | 6587 | } |
6588 | 6588 | |
6589 | 6589 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6590 | 6590 | |
6591 | - return (string) self::substr($str, -$n, null, $encoding); |
|
6591 | + return (string)self::substr($str, -$n, null, $encoding); |
|
6592 | 6592 | } |
6593 | 6593 | |
6594 | 6594 | /** |
@@ -6614,21 +6614,21 @@ discard block |
||
6614 | 6614 | } |
6615 | 6615 | |
6616 | 6616 | if ($encoding === 'UTF-8') { |
6617 | - if ((int) \mb_strlen($str) <= $length) { |
|
6617 | + if ((int)\mb_strlen($str) <= $length) { |
|
6618 | 6618 | return $str; |
6619 | 6619 | } |
6620 | 6620 | |
6621 | 6621 | /** @noinspection UnnecessaryCastingInspection */ |
6622 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
6622 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
6623 | 6623 | } |
6624 | 6624 | |
6625 | 6625 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6626 | 6626 | |
6627 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6627 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6628 | 6628 | return $str; |
6629 | 6629 | } |
6630 | 6630 | |
6631 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
6631 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
6632 | 6632 | } |
6633 | 6633 | |
6634 | 6634 | /** |
@@ -6656,12 +6656,12 @@ discard block |
||
6656 | 6656 | } |
6657 | 6657 | |
6658 | 6658 | if ($encoding === 'UTF-8') { |
6659 | - if ((int) \mb_strlen($str) <= $length) { |
|
6659 | + if ((int)\mb_strlen($str) <= $length) { |
|
6660 | 6660 | return $str; |
6661 | 6661 | } |
6662 | 6662 | |
6663 | 6663 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
6664 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6664 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6665 | 6665 | } |
6666 | 6666 | |
6667 | 6667 | $str = \mb_substr($str, 0, $length); |
@@ -6670,32 +6670,32 @@ discard block |
||
6670 | 6670 | $new_str = \implode(' ', $array); |
6671 | 6671 | |
6672 | 6672 | if ($new_str === '') { |
6673 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
6673 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
6674 | 6674 | } |
6675 | 6675 | } else { |
6676 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
6676 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
6677 | 6677 | return $str; |
6678 | 6678 | } |
6679 | 6679 | |
6680 | 6680 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
6681 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6681 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6682 | 6682 | } |
6683 | 6683 | |
6684 | 6684 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
6685 | 6685 | $str = self::substr($str, 0, $length, $encoding); |
6686 | 6686 | if ($str === false) { |
6687 | - return '' . $str_add_on; |
|
6687 | + return ''.$str_add_on; |
|
6688 | 6688 | } |
6689 | 6689 | |
6690 | 6690 | $array = \explode(' ', $str, -1); |
6691 | 6691 | $new_str = \implode(' ', $array); |
6692 | 6692 | |
6693 | 6693 | if ($new_str === '') { |
6694 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
6694 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
6695 | 6695 | } |
6696 | 6696 | } |
6697 | 6697 | |
6698 | - return $new_str . $str_add_on; |
|
6698 | + return $new_str.$str_add_on; |
|
6699 | 6699 | } |
6700 | 6700 | |
6701 | 6701 | /** |
@@ -6718,7 +6718,7 @@ discard block |
||
6718 | 6718 | $longest_common_prefix = ''; |
6719 | 6719 | |
6720 | 6720 | if ($encoding === 'UTF-8') { |
6721 | - $max_length = (int) \min( |
|
6721 | + $max_length = (int)\min( |
|
6722 | 6722 | \mb_strlen($str1), |
6723 | 6723 | \mb_strlen($str2) |
6724 | 6724 | ); |
@@ -6739,7 +6739,7 @@ discard block |
||
6739 | 6739 | } else { |
6740 | 6740 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6741 | 6741 | |
6742 | - $max_length = (int) \min( |
|
6742 | + $max_length = (int)\min( |
|
6743 | 6743 | self::strlen($str1, $encoding), |
6744 | 6744 | self::strlen($str2, $encoding) |
6745 | 6745 | ); |
@@ -6788,13 +6788,13 @@ discard block |
||
6788 | 6788 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
6789 | 6789 | |
6790 | 6790 | if ($encoding === 'UTF-8') { |
6791 | - $str_length = (int) \mb_strlen($str1); |
|
6792 | - $other_length = (int) \mb_strlen($str2); |
|
6791 | + $str_length = (int)\mb_strlen($str1); |
|
6792 | + $other_length = (int)\mb_strlen($str2); |
|
6793 | 6793 | } else { |
6794 | 6794 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6795 | 6795 | |
6796 | - $str_length = (int) self::strlen($str1, $encoding); |
|
6797 | - $other_length = (int) self::strlen($str2, $encoding); |
|
6796 | + $str_length = (int)self::strlen($str1, $encoding); |
|
6797 | + $other_length = (int)self::strlen($str2, $encoding); |
|
6798 | 6798 | } |
6799 | 6799 | |
6800 | 6800 | // Return if either string is empty |
@@ -6847,10 +6847,10 @@ discard block |
||
6847 | 6847 | } |
6848 | 6848 | |
6849 | 6849 | if ($encoding === 'UTF-8') { |
6850 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
6850 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
6851 | 6851 | } |
6852 | 6852 | |
6853 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
6853 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
6854 | 6854 | } |
6855 | 6855 | |
6856 | 6856 | /** |
@@ -6874,7 +6874,7 @@ discard block |
||
6874 | 6874 | } |
6875 | 6875 | |
6876 | 6876 | if ($encoding === 'UTF-8') { |
6877 | - $max_length = (int) \min( |
|
6877 | + $max_length = (int)\min( |
|
6878 | 6878 | \mb_strlen($str1, $encoding), |
6879 | 6879 | \mb_strlen($str2, $encoding) |
6880 | 6880 | ); |
@@ -6888,7 +6888,7 @@ discard block |
||
6888 | 6888 | && |
6889 | 6889 | $char === \mb_substr($str2, -$i, 1) |
6890 | 6890 | ) { |
6891 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6891 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6892 | 6892 | } else { |
6893 | 6893 | break; |
6894 | 6894 | } |
@@ -6896,7 +6896,7 @@ discard block |
||
6896 | 6896 | } else { |
6897 | 6897 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6898 | 6898 | |
6899 | - $max_length = (int) \min( |
|
6899 | + $max_length = (int)\min( |
|
6900 | 6900 | self::strlen($str1, $encoding), |
6901 | 6901 | self::strlen($str2, $encoding) |
6902 | 6902 | ); |
@@ -6910,7 +6910,7 @@ discard block |
||
6910 | 6910 | && |
6911 | 6911 | $char === self::substr($str2, -$i, 1, $encoding) |
6912 | 6912 | ) { |
6913 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
6913 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
6914 | 6914 | } else { |
6915 | 6915 | break; |
6916 | 6916 | } |
@@ -6933,7 +6933,7 @@ discard block |
||
6933 | 6933 | */ |
6934 | 6934 | public static function str_matches_pattern(string $str, string $pattern): bool |
6935 | 6935 | { |
6936 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
6936 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
6937 | 6937 | } |
6938 | 6938 | |
6939 | 6939 | /** |
@@ -6953,7 +6953,7 @@ discard block |
||
6953 | 6953 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
6954 | 6954 | { |
6955 | 6955 | // init |
6956 | - $length = (int) self::strlen($str, $encoding); |
|
6956 | + $length = (int)self::strlen($str, $encoding); |
|
6957 | 6957 | |
6958 | 6958 | if ($offset >= 0) { |
6959 | 6959 | return $length > $offset; |
@@ -6982,7 +6982,7 @@ discard block |
||
6982 | 6982 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
6983 | 6983 | { |
6984 | 6984 | // init |
6985 | - $length = (int) self::strlen($str); |
|
6985 | + $length = (int)self::strlen($str); |
|
6986 | 6986 | |
6987 | 6987 | if ( |
6988 | 6988 | ($index >= 0 && $length <= $index) |
@@ -7026,7 +7026,7 @@ discard block |
||
7026 | 7026 | return $str; |
7027 | 7027 | } |
7028 | 7028 | |
7029 | - if ($pad_type !== (int) $pad_type) { |
|
7029 | + if ($pad_type !== (int)$pad_type) { |
|
7030 | 7030 | if ($pad_type === 'left') { |
7031 | 7031 | $pad_type = \STR_PAD_LEFT; |
7032 | 7032 | } elseif ($pad_type === 'right') { |
@@ -7035,23 +7035,23 @@ discard block |
||
7035 | 7035 | $pad_type = \STR_PAD_BOTH; |
7036 | 7036 | } else { |
7037 | 7037 | throw new \InvalidArgumentException( |
7038 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
7038 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
7039 | 7039 | ); |
7040 | 7040 | } |
7041 | 7041 | } |
7042 | 7042 | |
7043 | 7043 | if ($encoding === 'UTF-8') { |
7044 | - $str_length = (int) \mb_strlen($str); |
|
7044 | + $str_length = (int)\mb_strlen($str); |
|
7045 | 7045 | |
7046 | 7046 | if ($pad_length >= $str_length) { |
7047 | 7047 | switch ($pad_type) { |
7048 | 7048 | case \STR_PAD_LEFT: |
7049 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7049 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7050 | 7050 | |
7051 | 7051 | $diff = ($pad_length - $str_length); |
7052 | 7052 | |
7053 | - $pre = (string) \mb_substr( |
|
7054 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7053 | + $pre = (string)\mb_substr( |
|
7054 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7055 | 7055 | 0, |
7056 | 7056 | $diff |
7057 | 7057 | ); |
@@ -7062,16 +7062,16 @@ discard block |
||
7062 | 7062 | case \STR_PAD_BOTH: |
7063 | 7063 | $diff = ($pad_length - $str_length); |
7064 | 7064 | |
7065 | - $ps_length_left = (int) \floor($diff / 2); |
|
7065 | + $ps_length_left = (int)\floor($diff / 2); |
|
7066 | 7066 | |
7067 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7067 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7068 | 7068 | |
7069 | - $pre = (string) \mb_substr( |
|
7069 | + $pre = (string)\mb_substr( |
|
7070 | 7070 | \str_repeat($pad_string, $ps_length_left), |
7071 | 7071 | 0, |
7072 | 7072 | $ps_length_left |
7073 | 7073 | ); |
7074 | - $post = (string) \mb_substr( |
|
7074 | + $post = (string)\mb_substr( |
|
7075 | 7075 | \str_repeat($pad_string, $ps_length_right), |
7076 | 7076 | 0, |
7077 | 7077 | $ps_length_right |
@@ -7081,19 +7081,19 @@ discard block |
||
7081 | 7081 | |
7082 | 7082 | case \STR_PAD_RIGHT: |
7083 | 7083 | default: |
7084 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7084 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7085 | 7085 | |
7086 | 7086 | $diff = ($pad_length - $str_length); |
7087 | 7087 | |
7088 | - $post = (string) \mb_substr( |
|
7089 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7088 | + $post = (string)\mb_substr( |
|
7089 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7090 | 7090 | 0, |
7091 | 7091 | $diff |
7092 | 7092 | ); |
7093 | 7093 | $pre = ''; |
7094 | 7094 | } |
7095 | 7095 | |
7096 | - return $pre . $str . $post; |
|
7096 | + return $pre.$str.$post; |
|
7097 | 7097 | } |
7098 | 7098 | |
7099 | 7099 | return $str; |
@@ -7101,17 +7101,17 @@ discard block |
||
7101 | 7101 | |
7102 | 7102 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7103 | 7103 | |
7104 | - $str_length = (int) self::strlen($str, $encoding); |
|
7104 | + $str_length = (int)self::strlen($str, $encoding); |
|
7105 | 7105 | |
7106 | 7106 | if ($pad_length >= $str_length) { |
7107 | 7107 | switch ($pad_type) { |
7108 | 7108 | case \STR_PAD_LEFT: |
7109 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7109 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7110 | 7110 | |
7111 | 7111 | $diff = ($pad_length - $str_length); |
7112 | 7112 | |
7113 | - $pre = (string) self::substr( |
|
7114 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7113 | + $pre = (string)self::substr( |
|
7114 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7115 | 7115 | 0, |
7116 | 7116 | $diff, |
7117 | 7117 | $encoding |
@@ -7123,17 +7123,17 @@ discard block |
||
7123 | 7123 | case \STR_PAD_BOTH: |
7124 | 7124 | $diff = ($pad_length - $str_length); |
7125 | 7125 | |
7126 | - $ps_length_left = (int) \floor($diff / 2); |
|
7126 | + $ps_length_left = (int)\floor($diff / 2); |
|
7127 | 7127 | |
7128 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7128 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7129 | 7129 | |
7130 | - $pre = (string) self::substr( |
|
7130 | + $pre = (string)self::substr( |
|
7131 | 7131 | \str_repeat($pad_string, $ps_length_left), |
7132 | 7132 | 0, |
7133 | 7133 | $ps_length_left, |
7134 | 7134 | $encoding |
7135 | 7135 | ); |
7136 | - $post = (string) self::substr( |
|
7136 | + $post = (string)self::substr( |
|
7137 | 7137 | \str_repeat($pad_string, $ps_length_right), |
7138 | 7138 | 0, |
7139 | 7139 | $ps_length_right, |
@@ -7144,12 +7144,12 @@ discard block |
||
7144 | 7144 | |
7145 | 7145 | case \STR_PAD_RIGHT: |
7146 | 7146 | default: |
7147 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7147 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7148 | 7148 | |
7149 | 7149 | $diff = ($pad_length - $str_length); |
7150 | 7150 | |
7151 | - $post = (string) self::substr( |
|
7152 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7151 | + $post = (string)self::substr( |
|
7152 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7153 | 7153 | 0, |
7154 | 7154 | $diff, |
7155 | 7155 | $encoding |
@@ -7157,7 +7157,7 @@ discard block |
||
7157 | 7157 | $pre = ''; |
7158 | 7158 | } |
7159 | 7159 | |
7160 | - return $pre . $str . $post; |
|
7160 | + return $pre.$str.$post; |
|
7161 | 7161 | } |
7162 | 7162 | |
7163 | 7163 | return $str; |
@@ -7368,12 +7368,12 @@ discard block |
||
7368 | 7368 | } |
7369 | 7369 | |
7370 | 7370 | if ($search === '') { |
7371 | - return $str . $replacement; |
|
7371 | + return $str.$replacement; |
|
7372 | 7372 | } |
7373 | 7373 | |
7374 | 7374 | $searchLength = \strlen($search); |
7375 | 7375 | if (\strncmp($str, $search, $searchLength) === 0) { |
7376 | - return $replacement . \substr($str, $searchLength); |
|
7376 | + return $replacement.\substr($str, $searchLength); |
|
7377 | 7377 | } |
7378 | 7378 | |
7379 | 7379 | return $str; |
@@ -7407,11 +7407,11 @@ discard block |
||
7407 | 7407 | } |
7408 | 7408 | |
7409 | 7409 | if ($search === '') { |
7410 | - return $str . $replacement; |
|
7410 | + return $str.$replacement; |
|
7411 | 7411 | } |
7412 | 7412 | |
7413 | 7413 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
7414 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
7414 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
7415 | 7415 | } |
7416 | 7416 | |
7417 | 7417 | return $str; |
@@ -7445,7 +7445,7 @@ discard block |
||
7445 | 7445 | $subject, |
7446 | 7446 | $replace, |
7447 | 7447 | $pos, |
7448 | - (int) self::strlen($search) |
|
7448 | + (int)self::strlen($search) |
|
7449 | 7449 | ); |
7450 | 7450 | } |
7451 | 7451 | |
@@ -7479,7 +7479,7 @@ discard block |
||
7479 | 7479 | $subject, |
7480 | 7480 | $replace, |
7481 | 7481 | $pos, |
7482 | - (int) self::strlen($search) |
|
7482 | + (int)self::strlen($search) |
|
7483 | 7483 | ); |
7484 | 7484 | } |
7485 | 7485 | |
@@ -7502,7 +7502,7 @@ discard block |
||
7502 | 7502 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
7503 | 7503 | { |
7504 | 7504 | if ($encoding === 'UTF-8') { |
7505 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
7505 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
7506 | 7506 | \shuffle($indexes); |
7507 | 7507 | |
7508 | 7508 | // init |
@@ -7517,7 +7517,7 @@ discard block |
||
7517 | 7517 | } else { |
7518 | 7518 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7519 | 7519 | |
7520 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
7520 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
7521 | 7521 | \shuffle($indexes); |
7522 | 7522 | |
7523 | 7523 | // init |
@@ -7559,11 +7559,11 @@ discard block |
||
7559 | 7559 | ) { |
7560 | 7560 | if ($encoding === 'UTF-8') { |
7561 | 7561 | if ($end === null) { |
7562 | - $length = (int) \mb_strlen($str); |
|
7562 | + $length = (int)\mb_strlen($str); |
|
7563 | 7563 | } elseif ($end >= 0 && $end <= $start) { |
7564 | 7564 | return ''; |
7565 | 7565 | } elseif ($end < 0) { |
7566 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
7566 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
7567 | 7567 | } else { |
7568 | 7568 | $length = $end - $start; |
7569 | 7569 | } |
@@ -7574,11 +7574,11 @@ discard block |
||
7574 | 7574 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7575 | 7575 | |
7576 | 7576 | if ($end === null) { |
7577 | - $length = (int) self::strlen($str, $encoding); |
|
7577 | + $length = (int)self::strlen($str, $encoding); |
|
7578 | 7578 | } elseif ($end >= 0 && $end <= $start) { |
7579 | 7579 | return ''; |
7580 | 7580 | } elseif ($end < 0) { |
7581 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
7581 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
7582 | 7582 | } else { |
7583 | 7583 | $length = $end - $start; |
7584 | 7584 | } |
@@ -7613,7 +7613,7 @@ discard block |
||
7613 | 7613 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7614 | 7614 | } |
7615 | 7615 | |
7616 | - $str = (string) \preg_replace_callback( |
|
7616 | + $str = (string)\preg_replace_callback( |
|
7617 | 7617 | '/([\\p{N}|\\p{Lu}])/u', |
7618 | 7618 | /** |
7619 | 7619 | * @param string[] $matches |
@@ -7622,28 +7622,28 @@ discard block |
||
7622 | 7622 | * |
7623 | 7623 | * @return string |
7624 | 7624 | */ |
7625 | - static function (array $matches) use ($encoding): string { |
|
7625 | + static function(array $matches) use ($encoding): string { |
|
7626 | 7626 | $match = $matches[1]; |
7627 | - $match_int = (int) $match; |
|
7627 | + $match_int = (int)$match; |
|
7628 | 7628 | |
7629 | - if ((string) $match_int === $match) { |
|
7630 | - return '_' . $match . '_'; |
|
7629 | + if ((string)$match_int === $match) { |
|
7630 | + return '_'.$match.'_'; |
|
7631 | 7631 | } |
7632 | 7632 | |
7633 | 7633 | if ($encoding === 'UTF-8') { |
7634 | - return '_' . \mb_strtolower($match); |
|
7634 | + return '_'.\mb_strtolower($match); |
|
7635 | 7635 | } |
7636 | 7636 | |
7637 | - return '_' . self::strtolower($match, $encoding); |
|
7637 | + return '_'.self::strtolower($match, $encoding); |
|
7638 | 7638 | }, |
7639 | 7639 | $str |
7640 | 7640 | ); |
7641 | 7641 | |
7642 | - $str = (string) \preg_replace( |
|
7642 | + $str = (string)\preg_replace( |
|
7643 | 7643 | [ |
7644 | - '/\\s+/u', // convert spaces to "_" |
|
7644 | + '/\\s+/u', // convert spaces to "_" |
|
7645 | 7645 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
7646 | - '/_+/', // remove double "_" |
|
7646 | + '/_+/', // remove double "_" |
|
7647 | 7647 | ], |
7648 | 7648 | [ |
7649 | 7649 | '_', |
@@ -7771,7 +7771,7 @@ discard block |
||
7771 | 7771 | } |
7772 | 7772 | |
7773 | 7773 | // init |
7774 | - $input = (string) $input; |
|
7774 | + $input = (string)$input; |
|
7775 | 7775 | |
7776 | 7776 | if ($input === '') { |
7777 | 7777 | return []; |
@@ -7827,7 +7827,7 @@ discard block |
||
7827 | 7827 | ($input[$i] & "\xE0") === "\xC0" |
7828 | 7828 | ) { |
7829 | 7829 | if (($input[$i + 1] & "\xC0") === "\x80") { |
7830 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
7830 | + $ret[] = $input[$i].$input[$i + 1]; |
|
7831 | 7831 | |
7832 | 7832 | ++$i; |
7833 | 7833 | } |
@@ -7841,7 +7841,7 @@ discard block |
||
7841 | 7841 | && |
7842 | 7842 | ($input[$i + 2] & "\xC0") === "\x80" |
7843 | 7843 | ) { |
7844 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
7844 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
7845 | 7845 | |
7846 | 7846 | $i += 2; |
7847 | 7847 | } |
@@ -7857,7 +7857,7 @@ discard block |
||
7857 | 7857 | && |
7858 | 7858 | ($input[$i + 3] & "\xC0") === "\x80" |
7859 | 7859 | ) { |
7860 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
7860 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
7861 | 7861 | |
7862 | 7862 | $i += 3; |
7863 | 7863 | } |
@@ -7867,7 +7867,7 @@ discard block |
||
7867 | 7867 | |
7868 | 7868 | if ($length > 1) { |
7869 | 7869 | return \array_map( |
7870 | - static function (array $item): string { |
|
7870 | + static function(array $item): string { |
|
7871 | 7871 | return \implode('', $item); |
7872 | 7872 | }, |
7873 | 7873 | \array_chunk($ret, $length) |
@@ -7939,7 +7939,7 @@ discard block |
||
7939 | 7939 | $limit = -1; |
7940 | 7940 | } |
7941 | 7941 | |
7942 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
7942 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
7943 | 7943 | if ($array === false) { |
7944 | 7944 | return []; |
7945 | 7945 | } |
@@ -8039,9 +8039,9 @@ discard block |
||
8039 | 8039 | return ''; |
8040 | 8040 | } |
8041 | 8041 | |
8042 | - return (string) \mb_substr( |
|
8042 | + return (string)\mb_substr( |
|
8043 | 8043 | $str, |
8044 | - $offset + (int) \mb_strlen($separator) |
|
8044 | + $offset + (int)\mb_strlen($separator) |
|
8045 | 8045 | ); |
8046 | 8046 | } |
8047 | 8047 | |
@@ -8050,9 +8050,9 @@ discard block |
||
8050 | 8050 | return ''; |
8051 | 8051 | } |
8052 | 8052 | |
8053 | - return (string) \mb_substr( |
|
8053 | + return (string)\mb_substr( |
|
8054 | 8054 | $str, |
8055 | - $offset + (int) self::strlen($separator, $encoding), |
|
8055 | + $offset + (int)self::strlen($separator, $encoding), |
|
8056 | 8056 | null, |
8057 | 8057 | $encoding |
8058 | 8058 | ); |
@@ -8084,9 +8084,9 @@ discard block |
||
8084 | 8084 | return ''; |
8085 | 8085 | } |
8086 | 8086 | |
8087 | - return (string) \mb_substr( |
|
8087 | + return (string)\mb_substr( |
|
8088 | 8088 | $str, |
8089 | - $offset + (int) \mb_strlen($separator) |
|
8089 | + $offset + (int)\mb_strlen($separator) |
|
8090 | 8090 | ); |
8091 | 8091 | } |
8092 | 8092 | |
@@ -8095,9 +8095,9 @@ discard block |
||
8095 | 8095 | return ''; |
8096 | 8096 | } |
8097 | 8097 | |
8098 | - return (string) self::substr( |
|
8098 | + return (string)self::substr( |
|
8099 | 8099 | $str, |
8100 | - $offset + (int) self::strlen($separator, $encoding), |
|
8100 | + $offset + (int)self::strlen($separator, $encoding), |
|
8101 | 8101 | null, |
8102 | 8102 | $encoding |
8103 | 8103 | ); |
@@ -8129,7 +8129,7 @@ discard block |
||
8129 | 8129 | return ''; |
8130 | 8130 | } |
8131 | 8131 | |
8132 | - return (string) \mb_substr( |
|
8132 | + return (string)\mb_substr( |
|
8133 | 8133 | $str, |
8134 | 8134 | 0, |
8135 | 8135 | $offset |
@@ -8141,7 +8141,7 @@ discard block |
||
8141 | 8141 | return ''; |
8142 | 8142 | } |
8143 | 8143 | |
8144 | - return (string) self::substr( |
|
8144 | + return (string)self::substr( |
|
8145 | 8145 | $str, |
8146 | 8146 | 0, |
8147 | 8147 | $offset, |
@@ -8172,7 +8172,7 @@ discard block |
||
8172 | 8172 | return ''; |
8173 | 8173 | } |
8174 | 8174 | |
8175 | - return (string) \mb_substr( |
|
8175 | + return (string)\mb_substr( |
|
8176 | 8176 | $str, |
8177 | 8177 | 0, |
8178 | 8178 | $offset |
@@ -8186,7 +8186,7 @@ discard block |
||
8186 | 8186 | |
8187 | 8187 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8188 | 8188 | |
8189 | - return (string) self::substr( |
|
8189 | + return (string)self::substr( |
|
8190 | 8190 | $str, |
8191 | 8191 | 0, |
8192 | 8192 | $offset, |
@@ -8301,7 +8301,7 @@ discard block |
||
8301 | 8301 | */ |
8302 | 8302 | public static function str_surround(string $str, string $substring): string |
8303 | 8303 | { |
8304 | - return $substring . $str . $substring; |
|
8304 | + return $substring.$str.$substring; |
|
8305 | 8305 | } |
8306 | 8306 | |
8307 | 8307 | /** |
@@ -8363,9 +8363,9 @@ discard block |
||
8363 | 8363 | $word_define_chars = ''; |
8364 | 8364 | } |
8365 | 8365 | |
8366 | - $str = (string) \preg_replace_callback( |
|
8367 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
8368 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8366 | + $str = (string)\preg_replace_callback( |
|
8367 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
8368 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8369 | 8369 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
8370 | 8370 | return $match[0]; |
8371 | 8371 | } |
@@ -8531,16 +8531,16 @@ discard block |
||
8531 | 8531 | } |
8532 | 8532 | |
8533 | 8533 | // the main substitutions |
8534 | - $str = (string) \preg_replace_callback( |
|
8534 | + $str = (string)\preg_replace_callback( |
|
8535 | 8535 | '~\\b (_*) (?: # 1. Leading underscore and |
8536 | 8536 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
8537 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
8537 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
8538 | 8538 | | |
8539 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
8539 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
8540 | 8540 | | |
8541 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
8541 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
8542 | 8542 | | |
8543 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
8543 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
8544 | 8544 | ) (_*) \\b # 6. With trailing underscore |
8545 | 8545 | ~ux', |
8546 | 8546 | /** |
@@ -8550,7 +8550,7 @@ discard block |
||
8550 | 8550 | * |
8551 | 8551 | * @return string |
8552 | 8552 | */ |
8553 | - static function (array $matches) use ($encoding): string { |
|
8553 | + static function(array $matches) use ($encoding): string { |
|
8554 | 8554 | // preserve leading underscore |
8555 | 8555 | $str = $matches[1]; |
8556 | 8556 | if ($matches[2]) { |
@@ -8575,11 +8575,11 @@ discard block |
||
8575 | 8575 | ); |
8576 | 8576 | |
8577 | 8577 | // Exceptions for small words: capitalize at start of title... |
8578 | - $str = (string) \preg_replace_callback( |
|
8578 | + $str = (string)\preg_replace_callback( |
|
8579 | 8579 | '~( \\A [[:punct:]]* # start of title... |
8580 | 8580 | | [:.;?!][ ]+ # or of subsentence... |
8581 | 8581 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
8582 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
8582 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
8583 | 8583 | ~uxi', |
8584 | 8584 | /** |
8585 | 8585 | * @param string[] $matches |
@@ -8588,15 +8588,15 @@ discard block |
||
8588 | 8588 | * |
8589 | 8589 | * @return string |
8590 | 8590 | */ |
8591 | - static function (array $matches) use ($encoding): string { |
|
8592 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8591 | + static function(array $matches) use ($encoding): string { |
|
8592 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8593 | 8593 | }, |
8594 | 8594 | $str |
8595 | 8595 | ); |
8596 | 8596 | |
8597 | 8597 | // ...and end of title |
8598 | - $str = (string) \preg_replace_callback( |
|
8599 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
8598 | + $str = (string)\preg_replace_callback( |
|
8599 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
8600 | 8600 | (?= [[:punct:]]* \Z # ...at the end of the title... |
8601 | 8601 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
8602 | 8602 | ~uxi', |
@@ -8607,7 +8607,7 @@ discard block |
||
8607 | 8607 | * |
8608 | 8608 | * @return string |
8609 | 8609 | */ |
8610 | - static function (array $matches) use ($encoding): string { |
|
8610 | + static function(array $matches) use ($encoding): string { |
|
8611 | 8611 | return static::ucfirst($matches[1], $encoding); |
8612 | 8612 | }, |
8613 | 8613 | $str |
@@ -8615,10 +8615,10 @@ discard block |
||
8615 | 8615 | |
8616 | 8616 | // Exceptions for small words in hyphenated compound words. |
8617 | 8617 | // e.g. "in-flight" -> In-Flight |
8618 | - $str = (string) \preg_replace_callback( |
|
8618 | + $str = (string)\preg_replace_callback( |
|
8619 | 8619 | '~\\b |
8620 | 8620 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
8621 | - ( ' . $small_words_rx . ' ) |
|
8621 | + ( ' . $small_words_rx.' ) |
|
8622 | 8622 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
8623 | 8623 | ~uxi', |
8624 | 8624 | /** |
@@ -8628,18 +8628,18 @@ discard block |
||
8628 | 8628 | * |
8629 | 8629 | * @return string |
8630 | 8630 | */ |
8631 | - static function (array $matches) use ($encoding): string { |
|
8631 | + static function(array $matches) use ($encoding): string { |
|
8632 | 8632 | return static::ucfirst($matches[1], $encoding); |
8633 | 8633 | }, |
8634 | 8634 | $str |
8635 | 8635 | ); |
8636 | 8636 | |
8637 | 8637 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
8638 | - $str = (string) \preg_replace_callback( |
|
8638 | + $str = (string)\preg_replace_callback( |
|
8639 | 8639 | '~\\b |
8640 | 8640 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
8641 | 8641 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
8642 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
8642 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
8643 | 8643 | (?! - ) # Negative lookahead for another - |
8644 | 8644 | ~uxi', |
8645 | 8645 | /** |
@@ -8649,8 +8649,8 @@ discard block |
||
8649 | 8649 | * |
8650 | 8650 | * @return string |
8651 | 8651 | */ |
8652 | - static function (array $matches) use ($encoding): string { |
|
8653 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
8652 | + static function(array $matches) use ($encoding): string { |
|
8653 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
8654 | 8654 | }, |
8655 | 8655 | $str |
8656 | 8656 | ); |
@@ -8768,7 +8768,7 @@ discard block |
||
8768 | 8768 | ); |
8769 | 8769 | |
8770 | 8770 | foreach ($tmp_return as &$item) { |
8771 | - $item = (string) $item; |
|
8771 | + $item = (string)$item; |
|
8772 | 8772 | } |
8773 | 8773 | |
8774 | 8774 | return $tmp_return; |
@@ -8800,38 +8800,38 @@ discard block |
||
8800 | 8800 | } |
8801 | 8801 | |
8802 | 8802 | if ($encoding === 'UTF-8') { |
8803 | - if ($length >= (int) \mb_strlen($str)) { |
|
8803 | + if ($length >= (int)\mb_strlen($str)) { |
|
8804 | 8804 | return $str; |
8805 | 8805 | } |
8806 | 8806 | |
8807 | 8807 | if ($substring !== '') { |
8808 | - $length -= (int) \mb_strlen($substring); |
|
8808 | + $length -= (int)\mb_strlen($substring); |
|
8809 | 8809 | |
8810 | 8810 | /** @noinspection UnnecessaryCastingInspection */ |
8811 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
8811 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
8812 | 8812 | } |
8813 | 8813 | |
8814 | - return (string) \mb_substr($str, 0, $length); |
|
8814 | + return (string)\mb_substr($str, 0, $length); |
|
8815 | 8815 | } |
8816 | 8816 | |
8817 | 8817 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8818 | 8818 | |
8819 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8819 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8820 | 8820 | return $str; |
8821 | 8821 | } |
8822 | 8822 | |
8823 | 8823 | if ($substring !== '') { |
8824 | - $length -= (int) self::strlen($substring, $encoding); |
|
8824 | + $length -= (int)self::strlen($substring, $encoding); |
|
8825 | 8825 | } |
8826 | 8826 | |
8827 | 8827 | return ( |
8828 | - (string) self::substr( |
|
8828 | + (string)self::substr( |
|
8829 | 8829 | $str, |
8830 | 8830 | 0, |
8831 | 8831 | $length, |
8832 | 8832 | $encoding |
8833 | 8833 | ) |
8834 | - ) . $substring; |
|
8834 | + ).$substring; |
|
8835 | 8835 | } |
8836 | 8836 | |
8837 | 8837 | /** |
@@ -8865,12 +8865,12 @@ discard block |
||
8865 | 8865 | } |
8866 | 8866 | |
8867 | 8867 | if ($encoding === 'UTF-8') { |
8868 | - if ($length >= (int) \mb_strlen($str)) { |
|
8868 | + if ($length >= (int)\mb_strlen($str)) { |
|
8869 | 8869 | return $str; |
8870 | 8870 | } |
8871 | 8871 | |
8872 | 8872 | // need to further trim the string so we can append the substring |
8873 | - $length -= (int) \mb_strlen($substring); |
|
8873 | + $length -= (int)\mb_strlen($substring); |
|
8874 | 8874 | if ($length <= 0) { |
8875 | 8875 | return $substring; |
8876 | 8876 | } |
@@ -8896,18 +8896,18 @@ discard block |
||
8896 | 8896 | !$ignore_do_not_split_words_for_one_word |
8897 | 8897 | ) |
8898 | 8898 | ) { |
8899 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
8899 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
8900 | 8900 | } |
8901 | 8901 | } |
8902 | 8902 | } else { |
8903 | 8903 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8904 | 8904 | |
8905 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
8905 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
8906 | 8906 | return $str; |
8907 | 8907 | } |
8908 | 8908 | |
8909 | 8909 | // need to further trim the string so we can append the substring |
8910 | - $length -= (int) self::strlen($substring, $encoding); |
|
8910 | + $length -= (int)self::strlen($substring, $encoding); |
|
8911 | 8911 | if ($length <= 0) { |
8912 | 8912 | return $substring; |
8913 | 8913 | } |
@@ -8933,12 +8933,12 @@ discard block |
||
8933 | 8933 | !$ignore_do_not_split_words_for_one_word |
8934 | 8934 | ) |
8935 | 8935 | ) { |
8936 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
8936 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
8937 | 8937 | } |
8938 | 8938 | } |
8939 | 8939 | } |
8940 | 8940 | |
8941 | - return $truncated . $substring; |
|
8941 | + return $truncated.$substring; |
|
8942 | 8942 | } |
8943 | 8943 | |
8944 | 8944 | /** |
@@ -9033,13 +9033,13 @@ discard block |
||
9033 | 9033 | } |
9034 | 9034 | } elseif ($format === 2) { |
9035 | 9035 | $number_of_words = []; |
9036 | - $offset = (int) self::strlen($str_parts[0]); |
|
9036 | + $offset = (int)self::strlen($str_parts[0]); |
|
9037 | 9037 | for ($i = 1; $i < $len; $i += 2) { |
9038 | 9038 | $number_of_words[$offset] = $str_parts[$i]; |
9039 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
9039 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
9040 | 9040 | } |
9041 | 9041 | } else { |
9042 | - $number_of_words = (int) (($len - 1) / 2); |
|
9042 | + $number_of_words = (int)(($len - 1) / 2); |
|
9043 | 9043 | } |
9044 | 9044 | |
9045 | 9045 | return $number_of_words; |
@@ -9142,7 +9142,7 @@ discard block |
||
9142 | 9142 | } |
9143 | 9143 | |
9144 | 9144 | if ($char_list === '') { |
9145 | - return (int) self::strlen($str, $encoding); |
|
9145 | + return (int)self::strlen($str, $encoding); |
|
9146 | 9146 | } |
9147 | 9147 | |
9148 | 9148 | if ($offset || $length !== null) { |
@@ -9168,7 +9168,7 @@ discard block |
||
9168 | 9168 | } |
9169 | 9169 | |
9170 | 9170 | $matches = []; |
9171 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
9171 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
9172 | 9172 | $return = self::strlen($matches[1], $encoding); |
9173 | 9173 | if ($return === false) { |
9174 | 9174 | return 0; |
@@ -9177,7 +9177,7 @@ discard block |
||
9177 | 9177 | return $return; |
9178 | 9178 | } |
9179 | 9179 | |
9180 | - return (int) self::strlen($str, $encoding); |
|
9180 | + return (int)self::strlen($str, $encoding); |
|
9181 | 9181 | } |
9182 | 9182 | |
9183 | 9183 | /** |
@@ -9208,7 +9208,7 @@ discard block |
||
9208 | 9208 | |
9209 | 9209 | $str = ''; |
9210 | 9210 | foreach ($intOrHex as $strPart) { |
9211 | - $str .= '&#' . (int) $strPart . ';'; |
|
9211 | + $str .= '&#'.(int)$strPart.';'; |
|
9212 | 9212 | } |
9213 | 9213 | |
9214 | 9214 | // We cannot use html_entity_decode() here, as it will not return |
@@ -9306,7 +9306,7 @@ discard block |
||
9306 | 9306 | return ''; |
9307 | 9307 | } |
9308 | 9308 | |
9309 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
9309 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
9310 | 9310 | } |
9311 | 9311 | |
9312 | 9312 | /** |
@@ -9385,7 +9385,7 @@ discard block |
||
9385 | 9385 | // fallback for ascii only |
9386 | 9386 | // |
9387 | 9387 | |
9388 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9388 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9389 | 9389 | return \stripos($haystack, $needle, $offset); |
9390 | 9390 | } |
9391 | 9391 | |
@@ -9474,7 +9474,7 @@ discard block |
||
9474 | 9474 | /** |
9475 | 9475 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9476 | 9476 | */ |
9477 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9477 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9478 | 9478 | } |
9479 | 9479 | |
9480 | 9480 | if ( |
@@ -9488,11 +9488,11 @@ discard block |
||
9488 | 9488 | } |
9489 | 9489 | } |
9490 | 9490 | |
9491 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
9491 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
9492 | 9492 | return \stristr($haystack, $needle, $before_needle); |
9493 | 9493 | } |
9494 | 9494 | |
9495 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
9495 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
9496 | 9496 | |
9497 | 9497 | if (!isset($match[1])) { |
9498 | 9498 | return false; |
@@ -9502,7 +9502,7 @@ discard block |
||
9502 | 9502 | return $match[1]; |
9503 | 9503 | } |
9504 | 9504 | |
9505 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
9505 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
9506 | 9506 | } |
9507 | 9507 | |
9508 | 9508 | /** |
@@ -9585,7 +9585,7 @@ discard block |
||
9585 | 9585 | /** |
9586 | 9586 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9587 | 9587 | */ |
9588 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9588 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9589 | 9589 | } |
9590 | 9590 | |
9591 | 9591 | // |
@@ -9723,8 +9723,8 @@ discard block |
||
9723 | 9723 | } |
9724 | 9724 | |
9725 | 9725 | return \strnatcmp( |
9726 | - (string) self::strtonatfold($str1), |
|
9727 | - (string) self::strtonatfold($str2) |
|
9726 | + (string)self::strtonatfold($str1), |
|
9727 | + (string)self::strtonatfold($str2) |
|
9728 | 9728 | ); |
9729 | 9729 | } |
9730 | 9730 | |
@@ -9794,11 +9794,11 @@ discard block |
||
9794 | 9794 | } |
9795 | 9795 | |
9796 | 9796 | if ($encoding === 'UTF-8') { |
9797 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
9798 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
9797 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
9798 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
9799 | 9799 | } else { |
9800 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
9801 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
9800 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
9801 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
9802 | 9802 | } |
9803 | 9803 | |
9804 | 9804 | return self::strcmp($str1, $str2); |
@@ -9825,8 +9825,8 @@ discard block |
||
9825 | 9825 | return false; |
9826 | 9826 | } |
9827 | 9827 | |
9828 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
9829 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
9828 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
9829 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
9830 | 9830 | } |
9831 | 9831 | |
9832 | 9832 | return false; |
@@ -9871,10 +9871,10 @@ discard block |
||
9871 | 9871 | } |
9872 | 9872 | |
9873 | 9873 | // iconv and mbstring do not support integer $needle |
9874 | - if ((int) $needle === $needle) { |
|
9875 | - $needle = (string) self::chr($needle); |
|
9874 | + if ((int)$needle === $needle) { |
|
9875 | + $needle = (string)self::chr($needle); |
|
9876 | 9876 | } |
9877 | - $needle = (string) $needle; |
|
9877 | + $needle = (string)$needle; |
|
9878 | 9878 | |
9879 | 9879 | if ($haystack === '') { |
9880 | 9880 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -9934,7 +9934,7 @@ discard block |
||
9934 | 9934 | /** |
9935 | 9935 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
9936 | 9936 | */ |
9937 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
9937 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
9938 | 9938 | } |
9939 | 9939 | |
9940 | 9940 | // |
@@ -9975,7 +9975,7 @@ discard block |
||
9975 | 9975 | // fallback for ascii only |
9976 | 9976 | // |
9977 | 9977 | |
9978 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9978 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9979 | 9979 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
9980 | 9980 | return @\strpos($haystack, $needle, $offset); |
9981 | 9981 | } |
@@ -9988,7 +9988,7 @@ discard block |
||
9988 | 9988 | if ($haystack_tmp === false) { |
9989 | 9989 | $haystack_tmp = ''; |
9990 | 9990 | } |
9991 | - $haystack = (string) $haystack_tmp; |
|
9991 | + $haystack = (string)$haystack_tmp; |
|
9992 | 9992 | |
9993 | 9993 | if ($offset < 0) { |
9994 | 9994 | $offset = 0; |
@@ -10000,7 +10000,7 @@ discard block |
||
10000 | 10000 | } |
10001 | 10001 | |
10002 | 10002 | if ($pos) { |
10003 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10003 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10004 | 10004 | } |
10005 | 10005 | |
10006 | 10006 | return $offset + 0; |
@@ -10155,7 +10155,7 @@ discard block |
||
10155 | 10155 | /** |
10156 | 10156 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10157 | 10157 | */ |
10158 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10158 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10159 | 10159 | } |
10160 | 10160 | |
10161 | 10161 | // |
@@ -10230,7 +10230,7 @@ discard block |
||
10230 | 10230 | if ($encoding === 'UTF-8') { |
10231 | 10231 | if (self::$SUPPORT['intl'] === true) { |
10232 | 10232 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
10233 | - $i = (int) \grapheme_strlen($str); |
|
10233 | + $i = (int)\grapheme_strlen($str); |
|
10234 | 10234 | while ($i--) { |
10235 | 10235 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
10236 | 10236 | if ($reversed_tmp !== false) { |
@@ -10238,7 +10238,7 @@ discard block |
||
10238 | 10238 | } |
10239 | 10239 | } |
10240 | 10240 | } else { |
10241 | - $i = (int) \mb_strlen($str); |
|
10241 | + $i = (int)\mb_strlen($str); |
|
10242 | 10242 | while ($i--) { |
10243 | 10243 | $reversed_tmp = \mb_substr($str, $i, 1); |
10244 | 10244 | if ($reversed_tmp !== false) { |
@@ -10249,7 +10249,7 @@ discard block |
||
10249 | 10249 | } else { |
10250 | 10250 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10251 | 10251 | |
10252 | - $i = (int) self::strlen($str, $encoding); |
|
10252 | + $i = (int)self::strlen($str, $encoding); |
|
10253 | 10253 | while ($i--) { |
10254 | 10254 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
10255 | 10255 | if ($reversed_tmp !== false) { |
@@ -10377,10 +10377,10 @@ discard block |
||
10377 | 10377 | } |
10378 | 10378 | |
10379 | 10379 | // iconv and mbstring do not support integer $needle |
10380 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10381 | - $needle = (string) self::chr($needle); |
|
10380 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10381 | + $needle = (string)self::chr($needle); |
|
10382 | 10382 | } |
10383 | - $needle = (string) $needle; |
|
10383 | + $needle = (string)$needle; |
|
10384 | 10384 | |
10385 | 10385 | if ($haystack === '') { |
10386 | 10386 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -10436,7 +10436,7 @@ discard block |
||
10436 | 10436 | /** |
10437 | 10437 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10438 | 10438 | */ |
10439 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10439 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10440 | 10440 | } |
10441 | 10441 | |
10442 | 10442 | // |
@@ -10460,7 +10460,7 @@ discard block |
||
10460 | 10460 | // fallback for ascii only |
10461 | 10461 | // |
10462 | 10462 | |
10463 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10463 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10464 | 10464 | return \strripos($haystack, $needle, $offset); |
10465 | 10465 | } |
10466 | 10466 | |
@@ -10549,10 +10549,10 @@ discard block |
||
10549 | 10549 | } |
10550 | 10550 | |
10551 | 10551 | // iconv and mbstring do not support integer $needle |
10552 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10553 | - $needle = (string) self::chr($needle); |
|
10552 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10553 | + $needle = (string)self::chr($needle); |
|
10554 | 10554 | } |
10555 | - $needle = (string) $needle; |
|
10555 | + $needle = (string)$needle; |
|
10556 | 10556 | |
10557 | 10557 | if ($haystack === '') { |
10558 | 10558 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -10608,7 +10608,7 @@ discard block |
||
10608 | 10608 | /** |
10609 | 10609 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10610 | 10610 | */ |
10611 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10611 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10612 | 10612 | } |
10613 | 10613 | |
10614 | 10614 | // |
@@ -10632,7 +10632,7 @@ discard block |
||
10632 | 10632 | // fallback for ascii only |
10633 | 10633 | // |
10634 | 10634 | |
10635 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10635 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10636 | 10636 | return \strrpos($haystack, $needle, $offset); |
10637 | 10637 | } |
10638 | 10638 | |
@@ -10652,7 +10652,7 @@ discard block |
||
10652 | 10652 | if ($haystack_tmp === false) { |
10653 | 10653 | $haystack_tmp = ''; |
10654 | 10654 | } |
10655 | - $haystack = (string) $haystack_tmp; |
|
10655 | + $haystack = (string)$haystack_tmp; |
|
10656 | 10656 | } |
10657 | 10657 | |
10658 | 10658 | $pos = \strrpos($haystack, $needle); |
@@ -10666,7 +10666,7 @@ discard block |
||
10666 | 10666 | return false; |
10667 | 10667 | } |
10668 | 10668 | |
10669 | - return $offset + (int) self::strlen($str_tmp); |
|
10669 | + return $offset + (int)self::strlen($str_tmp); |
|
10670 | 10670 | } |
10671 | 10671 | |
10672 | 10672 | /** |
@@ -10734,12 +10734,12 @@ discard block |
||
10734 | 10734 | if ($offset || $length !== null) { |
10735 | 10735 | if ($encoding === 'UTF-8') { |
10736 | 10736 | if ($length === null) { |
10737 | - $str = (string) \mb_substr($str, $offset); |
|
10737 | + $str = (string)\mb_substr($str, $offset); |
|
10738 | 10738 | } else { |
10739 | - $str = (string) \mb_substr($str, $offset, $length); |
|
10739 | + $str = (string)\mb_substr($str, $offset, $length); |
|
10740 | 10740 | } |
10741 | 10741 | } else { |
10742 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
10742 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
10743 | 10743 | } |
10744 | 10744 | } |
10745 | 10745 | |
@@ -10749,7 +10749,7 @@ discard block |
||
10749 | 10749 | |
10750 | 10750 | $matches = []; |
10751 | 10751 | |
10752 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
10752 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
10753 | 10753 | } |
10754 | 10754 | |
10755 | 10755 | /** |
@@ -10843,7 +10843,7 @@ discard block |
||
10843 | 10843 | /** |
10844 | 10844 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10845 | 10845 | */ |
10846 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10846 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10847 | 10847 | } |
10848 | 10848 | |
10849 | 10849 | // |
@@ -10865,7 +10865,7 @@ discard block |
||
10865 | 10865 | // fallback for ascii only |
10866 | 10866 | // |
10867 | 10867 | |
10868 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10868 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10869 | 10869 | return \strstr($haystack, $needle, $before_needle); |
10870 | 10870 | } |
10871 | 10871 | |
@@ -10873,7 +10873,7 @@ discard block |
||
10873 | 10873 | // fallback via vanilla php |
10874 | 10874 | // |
10875 | 10875 | |
10876 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
10876 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
10877 | 10877 | |
10878 | 10878 | if (!isset($match[1])) { |
10879 | 10879 | return false; |
@@ -10883,7 +10883,7 @@ discard block |
||
10883 | 10883 | return $match[1]; |
10884 | 10884 | } |
10885 | 10885 | |
10886 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
10886 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
10887 | 10887 | } |
10888 | 10888 | |
10889 | 10889 | /** |
@@ -11013,7 +11013,7 @@ discard block |
||
11013 | 11013 | bool $try_to_keep_the_string_length = false |
11014 | 11014 | ): string { |
11015 | 11015 | // init |
11016 | - $str = (string) $str; |
|
11016 | + $str = (string)$str; |
|
11017 | 11017 | |
11018 | 11018 | if ($str === '') { |
11019 | 11019 | return ''; |
@@ -11042,23 +11042,23 @@ discard block |
||
11042 | 11042 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11043 | 11043 | } |
11044 | 11044 | |
11045 | - $language_code = $lang . '-Lower'; |
|
11045 | + $language_code = $lang.'-Lower'; |
|
11046 | 11046 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11047 | 11047 | /** |
11048 | 11048 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11049 | 11049 | */ |
11050 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11050 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11051 | 11051 | |
11052 | 11052 | $language_code = 'Any-Lower'; |
11053 | 11053 | } |
11054 | 11054 | |
11055 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11055 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11056 | 11056 | } |
11057 | 11057 | |
11058 | 11058 | /** |
11059 | 11059 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11060 | 11060 | */ |
11061 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
11061 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
11062 | 11062 | } |
11063 | 11063 | |
11064 | 11064 | // always fallback via symfony polyfill |
@@ -11093,7 +11093,7 @@ discard block |
||
11093 | 11093 | bool $try_to_keep_the_string_length = false |
11094 | 11094 | ): string { |
11095 | 11095 | // init |
11096 | - $str = (string) $str; |
|
11096 | + $str = (string)$str; |
|
11097 | 11097 | |
11098 | 11098 | if ($str === '') { |
11099 | 11099 | return ''; |
@@ -11122,23 +11122,23 @@ discard block |
||
11122 | 11122 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11123 | 11123 | } |
11124 | 11124 | |
11125 | - $language_code = $lang . '-Upper'; |
|
11125 | + $language_code = $lang.'-Upper'; |
|
11126 | 11126 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11127 | 11127 | /** |
11128 | 11128 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11129 | 11129 | */ |
11130 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
11130 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
11131 | 11131 | |
11132 | 11132 | $language_code = 'Any-Upper'; |
11133 | 11133 | } |
11134 | 11134 | |
11135 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11135 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11136 | 11136 | } |
11137 | 11137 | |
11138 | 11138 | /** |
11139 | 11139 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11140 | 11140 | */ |
11141 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
11141 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
11142 | 11142 | } |
11143 | 11143 | |
11144 | 11144 | // always fallback via symfony polyfill |
@@ -11201,7 +11201,7 @@ discard block |
||
11201 | 11201 | |
11202 | 11202 | $from = \array_combine($from, $to); |
11203 | 11203 | if ($from === false) { |
11204 | - 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) . ')'); |
|
11204 | + 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).')'); |
|
11205 | 11205 | } |
11206 | 11206 | } |
11207 | 11207 | |
@@ -11267,9 +11267,9 @@ discard block |
||
11267 | 11267 | } |
11268 | 11268 | |
11269 | 11269 | $wide = 0; |
11270 | - $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); |
|
11270 | + $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); |
|
11271 | 11271 | |
11272 | - return ($wide << 1) + (int) self::strlen($str); |
|
11272 | + return ($wide << 1) + (int)self::strlen($str); |
|
11273 | 11273 | } |
11274 | 11274 | |
11275 | 11275 | /** |
@@ -11378,7 +11378,7 @@ discard block |
||
11378 | 11378 | /** |
11379 | 11379 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11380 | 11380 | */ |
11381 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11381 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11382 | 11382 | } |
11383 | 11383 | |
11384 | 11384 | // |
@@ -11473,16 +11473,16 @@ discard block |
||
11473 | 11473 | ) { |
11474 | 11474 | if ($encoding === 'UTF-8') { |
11475 | 11475 | if ($length === null) { |
11476 | - $str1 = (string) \mb_substr($str1, $offset); |
|
11476 | + $str1 = (string)\mb_substr($str1, $offset); |
|
11477 | 11477 | } else { |
11478 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
11478 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
11479 | 11479 | } |
11480 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
11480 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
11481 | 11481 | } else { |
11482 | 11482 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11483 | 11483 | |
11484 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
11485 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
11484 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
11485 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
11486 | 11486 | } |
11487 | 11487 | } |
11488 | 11488 | |
@@ -11561,9 +11561,9 @@ discard block |
||
11561 | 11561 | } |
11562 | 11562 | |
11563 | 11563 | if ($encoding === 'UTF-8') { |
11564 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
11564 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
11565 | 11565 | } else { |
11566 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
11566 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
11567 | 11567 | } |
11568 | 11568 | } |
11569 | 11569 | |
@@ -11575,7 +11575,7 @@ discard block |
||
11575 | 11575 | /** |
11576 | 11576 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11577 | 11577 | */ |
11578 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11578 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11579 | 11579 | } |
11580 | 11580 | |
11581 | 11581 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -11586,7 +11586,7 @@ discard block |
||
11586 | 11586 | return \mb_substr_count($haystack, $needle, $encoding); |
11587 | 11587 | } |
11588 | 11588 | |
11589 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
11589 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
11590 | 11590 | |
11591 | 11591 | return \count($matches); |
11592 | 11592 | } |
@@ -11658,7 +11658,7 @@ discard block |
||
11658 | 11658 | if ($haystack_tmp === false) { |
11659 | 11659 | $haystack_tmp = ''; |
11660 | 11660 | } |
11661 | - $haystack = (string) $haystack_tmp; |
|
11661 | + $haystack = (string)$haystack_tmp; |
|
11662 | 11662 | } |
11663 | 11663 | |
11664 | 11664 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -11699,10 +11699,10 @@ discard block |
||
11699 | 11699 | |
11700 | 11700 | if ($encoding === 'UTF-8') { |
11701 | 11701 | if ($case_sensitive) { |
11702 | - return (int) \mb_substr_count($str, $substring); |
|
11702 | + return (int)\mb_substr_count($str, $substring); |
|
11703 | 11703 | } |
11704 | 11704 | |
11705 | - return (int) \mb_substr_count( |
|
11705 | + return (int)\mb_substr_count( |
|
11706 | 11706 | \mb_strtoupper($str), |
11707 | 11707 | \mb_strtoupper($substring) |
11708 | 11708 | ); |
@@ -11711,10 +11711,10 @@ discard block |
||
11711 | 11711 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
11712 | 11712 | |
11713 | 11713 | if ($case_sensitive) { |
11714 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
11714 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
11715 | 11715 | } |
11716 | 11716 | |
11717 | - return (int) \mb_substr_count( |
|
11717 | + return (int)\mb_substr_count( |
|
11718 | 11718 | self::strtocasefold($str, true, false, $encoding, null, false), |
11719 | 11719 | self::strtocasefold($substring, true, false, $encoding, null, false), |
11720 | 11720 | $encoding |
@@ -11748,7 +11748,7 @@ discard block |
||
11748 | 11748 | } |
11749 | 11749 | |
11750 | 11750 | if (self::str_istarts_with($haystack, $needle)) { |
11751 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
11751 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
11752 | 11752 | } |
11753 | 11753 | |
11754 | 11754 | return $haystack; |
@@ -11815,7 +11815,7 @@ discard block |
||
11815 | 11815 | } |
11816 | 11816 | |
11817 | 11817 | if (self::str_iends_with($haystack, $needle)) { |
11818 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
11818 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
11819 | 11819 | } |
11820 | 11820 | |
11821 | 11821 | return $haystack; |
@@ -11848,7 +11848,7 @@ discard block |
||
11848 | 11848 | } |
11849 | 11849 | |
11850 | 11850 | if (self::str_starts_with($haystack, $needle)) { |
11851 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
11851 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
11852 | 11852 | } |
11853 | 11853 | |
11854 | 11854 | return $haystack; |
@@ -11909,7 +11909,7 @@ discard block |
||
11909 | 11909 | if (\is_array($offset)) { |
11910 | 11910 | $offset = \array_slice($offset, 0, $num); |
11911 | 11911 | foreach ($offset as &$value_tmp) { |
11912 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
11912 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
11913 | 11913 | } |
11914 | 11914 | unset($value_tmp); |
11915 | 11915 | } else { |
@@ -11922,7 +11922,7 @@ discard block |
||
11922 | 11922 | } elseif (\is_array($length)) { |
11923 | 11923 | $length = \array_slice($length, 0, $num); |
11924 | 11924 | foreach ($length as &$value_tmp_V2) { |
11925 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11925 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
11926 | 11926 | } |
11927 | 11927 | unset($value_tmp_V2); |
11928 | 11928 | } else { |
@@ -11943,8 +11943,8 @@ discard block |
||
11943 | 11943 | } |
11944 | 11944 | |
11945 | 11945 | // init |
11946 | - $str = (string) $str; |
|
11947 | - $replacement = (string) $replacement; |
|
11946 | + $str = (string)$str; |
|
11947 | + $replacement = (string)$replacement; |
|
11948 | 11948 | |
11949 | 11949 | if (\is_array($length)) { |
11950 | 11950 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -11959,16 +11959,16 @@ discard block |
||
11959 | 11959 | } |
11960 | 11960 | |
11961 | 11961 | if (self::$SUPPORT['mbstring'] === true) { |
11962 | - $string_length = (int) self::strlen($str, $encoding); |
|
11962 | + $string_length = (int)self::strlen($str, $encoding); |
|
11963 | 11963 | |
11964 | 11964 | if ($offset < 0) { |
11965 | - $offset = (int) \max(0, $string_length + $offset); |
|
11965 | + $offset = (int)\max(0, $string_length + $offset); |
|
11966 | 11966 | } elseif ($offset > $string_length) { |
11967 | 11967 | $offset = $string_length; |
11968 | 11968 | } |
11969 | 11969 | |
11970 | 11970 | if ($length !== null && $length < 0) { |
11971 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
11971 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
11972 | 11972 | } elseif ($length === null || $length > $string_length) { |
11973 | 11973 | $length = $string_length; |
11974 | 11974 | } |
@@ -11977,9 +11977,9 @@ discard block |
||
11977 | 11977 | $length = $string_length - $offset; |
11978 | 11978 | } |
11979 | 11979 | |
11980 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
11981 | - $replacement . |
|
11982 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11980 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
11981 | + $replacement. |
|
11982 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11983 | 11983 | } |
11984 | 11984 | |
11985 | 11985 | // |
@@ -11988,8 +11988,7 @@ discard block |
||
11988 | 11988 | |
11989 | 11989 | if (ASCII::is_ascii($str)) { |
11990 | 11990 | return ($length === null) ? |
11991 | - \substr_replace($str, $replacement, $offset) : |
|
11992 | - \substr_replace($str, $replacement, $offset, $length); |
|
11991 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
11993 | 11992 | } |
11994 | 11993 | |
11995 | 11994 | // |
@@ -12048,14 +12047,14 @@ discard block |
||
12048 | 12047 | && |
12049 | 12048 | \substr($haystack, -\strlen($needle)) === $needle |
12050 | 12049 | ) { |
12051 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
12050 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
12052 | 12051 | } |
12053 | 12052 | |
12054 | 12053 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
12055 | - return (string) self::substr( |
|
12054 | + return (string)self::substr( |
|
12056 | 12055 | $haystack, |
12057 | 12056 | 0, |
12058 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
12057 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
12059 | 12058 | $encoding |
12060 | 12059 | ); |
12061 | 12060 | } |
@@ -12090,10 +12089,10 @@ discard block |
||
12090 | 12089 | } |
12091 | 12090 | |
12092 | 12091 | if ($encoding === 'UTF-8') { |
12093 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12092 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12094 | 12093 | } |
12095 | 12094 | |
12096 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12095 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12097 | 12096 | } |
12098 | 12097 | |
12099 | 12098 | /** |
@@ -12232,7 +12231,7 @@ discard block |
||
12232 | 12231 | public static function to_boolean($str): bool |
12233 | 12232 | { |
12234 | 12233 | // init |
12235 | - $str = (string) $str; |
|
12234 | + $str = (string)$str; |
|
12236 | 12235 | |
12237 | 12236 | if ($str === '') { |
12238 | 12237 | return false; |
@@ -12260,10 +12259,10 @@ discard block |
||
12260 | 12259 | } |
12261 | 12260 | |
12262 | 12261 | if (\is_numeric($str)) { |
12263 | - return ((float) $str) > 0; |
|
12262 | + return ((float)$str) > 0; |
|
12264 | 12263 | } |
12265 | 12264 | |
12266 | - return (bool) \trim($str); |
|
12265 | + return (bool)\trim($str); |
|
12267 | 12266 | } |
12268 | 12267 | |
12269 | 12268 | /** |
@@ -12315,7 +12314,7 @@ discard block |
||
12315 | 12314 | return $str; |
12316 | 12315 | } |
12317 | 12316 | |
12318 | - $str = (string) $str; |
|
12317 | + $str = (string)$str; |
|
12319 | 12318 | if ($str === '') { |
12320 | 12319 | return ''; |
12321 | 12320 | } |
@@ -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; |
@@ -12544,12 +12543,12 @@ discard block |
||
12544 | 12543 | || |
12545 | 12544 | $input_type === 'double' |
12546 | 12545 | ) { |
12547 | - return (string) $input; |
|
12546 | + return (string)$input; |
|
12548 | 12547 | } |
12549 | 12548 | |
12550 | 12549 | /** @phpstan-ignore-next-line - "gettype": FP? */ |
12551 | 12550 | if ($input_type === 'object' && \method_exists($input, '__toString')) { |
12552 | - return (string) $input; |
|
12551 | + return (string)$input; |
|
12553 | 12552 | } |
12554 | 12553 | |
12555 | 12554 | return null; |
@@ -12588,7 +12587,7 @@ discard block |
||
12588 | 12587 | $pattern = '^[\\s]+|[\\s]+$'; |
12589 | 12588 | } |
12590 | 12589 | |
12591 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
12590 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
12592 | 12591 | } |
12593 | 12592 | |
12594 | 12593 | if ($chars !== null) { |
@@ -12639,15 +12638,15 @@ discard block |
||
12639 | 12638 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
12640 | 12639 | |
12641 | 12640 | if ($encoding === 'UTF-8') { |
12642 | - $str_part_two = (string) \mb_substr($str, 1); |
|
12641 | + $str_part_two = (string)\mb_substr($str, 1); |
|
12643 | 12642 | |
12644 | 12643 | if ($use_mb_functions) { |
12645 | 12644 | $str_part_one = \mb_strtoupper( |
12646 | - (string) \mb_substr($str, 0, 1) |
|
12645 | + (string)\mb_substr($str, 0, 1) |
|
12647 | 12646 | ); |
12648 | 12647 | } else { |
12649 | 12648 | $str_part_one = self::strtoupper( |
12650 | - (string) \mb_substr($str, 0, 1), |
|
12649 | + (string)\mb_substr($str, 0, 1), |
|
12651 | 12650 | $encoding, |
12652 | 12651 | false, |
12653 | 12652 | $lang, |
@@ -12657,16 +12656,16 @@ discard block |
||
12657 | 12656 | } else { |
12658 | 12657 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12659 | 12658 | |
12660 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
12659 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
12661 | 12660 | |
12662 | 12661 | if ($use_mb_functions) { |
12663 | 12662 | $str_part_one = \mb_strtoupper( |
12664 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
12663 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
12665 | 12664 | $encoding |
12666 | 12665 | ); |
12667 | 12666 | } else { |
12668 | 12667 | $str_part_one = self::strtoupper( |
12669 | - (string) self::substr($str, 0, 1, $encoding), |
|
12668 | + (string)self::substr($str, 0, 1, $encoding), |
|
12670 | 12669 | $encoding, |
12671 | 12670 | false, |
12672 | 12671 | $lang, |
@@ -12675,7 +12674,7 @@ discard block |
||
12675 | 12674 | } |
12676 | 12675 | } |
12677 | 12676 | |
12678 | - return $str_part_one . $str_part_two; |
|
12677 | + return $str_part_one.$str_part_two; |
|
12679 | 12678 | } |
12680 | 12679 | |
12681 | 12680 | /** |
@@ -12714,7 +12713,7 @@ discard block |
||
12714 | 12713 | $str = self::clean($str); |
12715 | 12714 | } |
12716 | 12715 | |
12717 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
12716 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
12718 | 12717 | |
12719 | 12718 | if ( |
12720 | 12719 | $use_php_default_functions |
@@ -12872,7 +12871,7 @@ discard block |
||
12872 | 12871 | if ( |
12873 | 12872 | $keep_utf8_chars |
12874 | 12873 | && |
12875 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
12874 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
12876 | 12875 | ) { |
12877 | 12876 | return $str_backup; |
12878 | 12877 | } |
@@ -12945,17 +12944,17 @@ discard block |
||
12945 | 12944 | return ''; |
12946 | 12945 | } |
12947 | 12946 | |
12948 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
12947 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
12949 | 12948 | |
12950 | 12949 | if ( |
12951 | 12950 | !isset($matches[0]) |
12952 | 12951 | || |
12953 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
12952 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
12954 | 12953 | ) { |
12955 | 12954 | return $str; |
12956 | 12955 | } |
12957 | 12956 | |
12958 | - return \rtrim($matches[0]) . $str_add_on; |
|
12957 | + return \rtrim($matches[0]).$str_add_on; |
|
12959 | 12958 | } |
12960 | 12959 | |
12961 | 12960 | /** |
@@ -13048,7 +13047,7 @@ discard block |
||
13048 | 13047 | } |
13049 | 13048 | } |
13050 | 13049 | |
13051 | - return $str_return . \implode('', $charsArray); |
|
13050 | + return $str_return.\implode('', $charsArray); |
|
13052 | 13051 | } |
13053 | 13052 | |
13054 | 13053 | /** |
@@ -13102,7 +13101,7 @@ discard block |
||
13102 | 13101 | $final_break = ''; |
13103 | 13102 | } |
13104 | 13103 | |
13105 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
13104 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
13106 | 13105 | } |
13107 | 13106 | |
13108 | 13107 | /** |
@@ -13343,7 +13342,7 @@ discard block |
||
13343 | 13342 | /** @noinspection PhpIncludeInspection */ |
13344 | 13343 | /** @noinspection UsingInclusionReturnValueInspection */ |
13345 | 13344 | /** @psalm-suppress UnresolvableInclude */ |
13346 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
13345 | + return include __DIR__.'/data/'.$file.'.php'; |
|
13347 | 13346 | } |
13348 | 13347 | |
13349 | 13348 | /** |
@@ -13365,7 +13364,7 @@ discard block |
||
13365 | 13364 | */ |
13366 | 13365 | \uksort( |
13367 | 13366 | self::$EMOJI, |
13368 | - static function (string $a, string $b): int { |
|
13367 | + static function(string $a, string $b): int { |
|
13369 | 13368 | return \strlen($b) <=> \strlen($a); |
13370 | 13369 | } |
13371 | 13370 | ); |
@@ -13375,7 +13374,7 @@ discard block |
||
13375 | 13374 | |
13376 | 13375 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
13377 | 13376 | $tmp_key = \crc32($key); |
13378 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
13377 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
13379 | 13378 | } |
13380 | 13379 | |
13381 | 13380 | return true; |
@@ -13402,7 +13401,7 @@ discard block |
||
13402 | 13401 | /** @noinspection DeprecatedIniOptionsInspection */ |
13403 | 13402 | return \defined('MB_OVERLOAD_STRING') |
13404 | 13403 | && |
13405 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
13404 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
13406 | 13405 | } |
13407 | 13406 | |
13408 | 13407 | /** |
@@ -13466,7 +13465,7 @@ discard block |
||
13466 | 13465 | */ |
13467 | 13466 | static $RX_CLASS_CACHE = []; |
13468 | 13467 | |
13469 | - $cache_key = $s . '_' . $class; |
|
13468 | + $cache_key = $s.'_'.$class; |
|
13470 | 13469 | |
13471 | 13470 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
13472 | 13471 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -13478,7 +13477,7 @@ discard block |
||
13478 | 13477 | /** @noinspection AlterInForeachInspection */ |
13479 | 13478 | foreach (self::str_split($s) as &$s) { |
13480 | 13479 | if ($s === '-') { |
13481 | - $class_array[0] = '-' . $class_array[0]; |
|
13480 | + $class_array[0] = '-'.$class_array[0]; |
|
13482 | 13481 | } elseif (!isset($s[2])) { |
13483 | 13482 | $class_array[0] .= \preg_quote($s, '/'); |
13484 | 13483 | } elseif (self::strlen($s) === 1) { |
@@ -13489,13 +13488,13 @@ discard block |
||
13489 | 13488 | } |
13490 | 13489 | |
13491 | 13490 | if ($class_array[0]) { |
13492 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
13491 | + $class_array[0] = '['.$class_array[0].']'; |
|
13493 | 13492 | } |
13494 | 13493 | |
13495 | 13494 | if (\count($class_array) === 1) { |
13496 | 13495 | $return = $class_array[0]; |
13497 | 13496 | } else { |
13498 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
13497 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
13499 | 13498 | } |
13500 | 13499 | |
13501 | 13500 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -13575,7 +13574,7 @@ discard block |
||
13575 | 13574 | $continue = false; |
13576 | 13575 | |
13577 | 13576 | if ($delimiter === '-') { |
13578 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
13577 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
13579 | 13578 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
13580 | 13579 | $continue = true; |
13581 | 13580 | |
@@ -13585,7 +13584,7 @@ discard block |
||
13585 | 13584 | unset($beginning); |
13586 | 13585 | } |
13587 | 13586 | |
13588 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
13587 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
13589 | 13588 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
13590 | 13589 | $continue = true; |
13591 | 13590 | |
@@ -13661,8 +13660,8 @@ discard block |
||
13661 | 13660 | } else { |
13662 | 13661 | /** @noinspection OffsetOperationsInspection */ |
13663 | 13662 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
13664 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
13665 | - $buf .= $cc1 . $cc2; |
|
13663 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
13664 | + $buf .= $cc1.$cc2; |
|
13666 | 13665 | } |
13667 | 13666 | |
13668 | 13667 | return $buf; |
@@ -13685,7 +13684,7 @@ discard block |
||
13685 | 13684 | |
13686 | 13685 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
13687 | 13686 | if (\preg_match($pattern, $str)) { |
13688 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
13687 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
13689 | 13688 | } |
13690 | 13689 | |
13691 | 13690 | return $str; |