@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | if ($encoding === 'UTF-8') { |
274 | - return (string) \mb_substr($str, $pos, 1); |
|
274 | + return (string)\mb_substr($str, $pos, 1); |
|
275 | 275 | } |
276 | 276 | |
277 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
277 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | public static function add_bom_to_string(string $str): string |
295 | 295 | { |
296 | 296 | if (!self::string_has_bom($str)) { |
297 | - $str = self::bom() . $str; |
|
297 | + $str = self::bom().$str; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | return $str; |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | $return = []; |
330 | 330 | foreach ($array as $key => &$value) { |
331 | 331 | $key = $case === \CASE_LOWER |
332 | - ? self::strtolower((string) $key, $encoding) |
|
333 | - : self::strtoupper((string) $key, $encoding); |
|
332 | + ? self::strtolower((string)$key, $encoding) |
|
333 | + : self::strtoupper((string)$key, $encoding); |
|
334 | 334 | |
335 | 335 | $return[$key] = $value; |
336 | 336 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | return ''; |
367 | 367 | } |
368 | 368 | |
369 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
369 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
370 | 370 | $end_position = \mb_strpos($str, $end, $substr_index); |
371 | 371 | if ( |
372 | 372 | $end_position === false |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | return ''; |
377 | 377 | } |
378 | 378 | |
379 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
379 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | return ''; |
387 | 387 | } |
388 | 388 | |
389 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
389 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
390 | 390 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
391 | 391 | if ( |
392 | 392 | $end_position === false |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | return ''; |
397 | 397 | } |
398 | 398 | |
399 | - return (string) self::substr( |
|
399 | + return (string)self::substr( |
|
400 | 400 | $str, |
401 | 401 | $substr_index, |
402 | 402 | $end_position - $substr_index, |
@@ -480,10 +480,10 @@ discard block |
||
480 | 480 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
481 | 481 | { |
482 | 482 | if ($encoding === 'UTF-8') { |
483 | - return (string) \mb_substr($str, $index, 1); |
|
483 | + return (string)\mb_substr($str, $index, 1); |
|
484 | 484 | } |
485 | 485 | |
486 | - return (string) self::substr($str, $index, 1, $encoding); |
|
486 | + return (string)self::substr($str, $index, 1, $encoding); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
@@ -601,14 +601,14 @@ discard block |
||
601 | 601 | /** |
602 | 602 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
603 | 603 | */ |
604 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
604 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | if (!\is_int($code_point) || $code_point <= 0) { |
608 | 608 | return null; |
609 | 609 | } |
610 | 610 | |
611 | - $cache_key = $code_point . '_' . $encoding; |
|
611 | + $cache_key = $code_point.'_'.$encoding; |
|
612 | 612 | if (isset($CHAR_CACHE[$cache_key])) { |
613 | 613 | return $CHAR_CACHE[$cache_key]; |
614 | 614 | } |
@@ -654,27 +654,27 @@ discard block |
||
654 | 654 | self::$CHR = self::getData('chr'); |
655 | 655 | } |
656 | 656 | |
657 | - $code_point = (int) $code_point; |
|
657 | + $code_point = (int)$code_point; |
|
658 | 658 | if ($code_point <= 0x7FF) { |
659 | 659 | /** |
660 | 660 | * @psalm-suppress PossiblyNullArrayAccess |
661 | 661 | */ |
662 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
662 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
663 | 663 | self::$CHR[($code_point & 0x3F) + 0x80]; |
664 | 664 | } elseif ($code_point <= 0xFFFF) { |
665 | 665 | /** |
666 | 666 | * @psalm-suppress PossiblyNullArrayAccess |
667 | 667 | */ |
668 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
669 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
668 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
669 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
670 | 670 | self::$CHR[($code_point & 0x3F) + 0x80]; |
671 | 671 | } else { |
672 | 672 | /** |
673 | 673 | * @psalm-suppress PossiblyNullArrayAccess |
674 | 674 | */ |
675 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
676 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
677 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
675 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
676 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
677 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
678 | 678 | self::$CHR[($code_point & 0x3F) + 0x80]; |
679 | 679 | } |
680 | 680 | |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | |
732 | 732 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
733 | 733 | return \array_map( |
734 | - static function (string $data): int { |
|
734 | + static function(string $data): int { |
|
735 | 735 | // "mb_" is available if overload is used, so use it ... |
736 | 736 | return \mb_strlen($data, 'CP850'); // 8-BIT |
737 | 737 | }, |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | $char = ''; |
819 | 819 | } |
820 | 820 | |
821 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
821 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | /** |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
916 | 916 | /x'; |
917 | 917 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
918 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
918 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
919 | 919 | |
920 | 920 | if ($replace_diamond_question_mark) { |
921 | 921 | $str = self::replace_diamond_question_mark($str); |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | public static function cleanup($str): string |
955 | 955 | { |
956 | 956 | // init |
957 | - $str = (string) $str; |
|
957 | + $str = (string)$str; |
|
958 | 958 | |
959 | 959 | if ($str === '') { |
960 | 960 | return ''; |
@@ -1056,7 +1056,7 @@ discard block |
||
1056 | 1056 | { |
1057 | 1057 | if (self::$SUPPORT['mbstring'] === true) { |
1058 | 1058 | /** @noinspection PhpComposerExtensionStubsInspection */ |
1059 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1059 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1161,9 +1161,9 @@ discard block |
||
1161 | 1161 | // - 0-9 (U+0061 - U+007A) |
1162 | 1162 | // - ISO 10646 characters U+00A1 and higher |
1163 | 1163 | // We strip out any character not in the above list. |
1164 | - $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); |
|
1164 | + $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); |
|
1165 | 1165 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
1166 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1166 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1167 | 1167 | |
1168 | 1168 | return \trim($str, '-'); |
1169 | 1169 | } |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | */ |
1180 | 1180 | public static function css_stripe_media_queries(string $str): string |
1181 | 1181 | { |
1182 | - return (string) \preg_replace( |
|
1182 | + return (string)\preg_replace( |
|
1183 | 1183 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
1184 | 1184 | '', |
1185 | 1185 | $str |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | */ |
1219 | 1219 | public static function decimal_to_chr($int): string |
1220 | 1220 | { |
1221 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
1221 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
1222 | 1222 | } |
1223 | 1223 | |
1224 | 1224 | /** |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | $flagOffset = 0x1F1E6; |
1269 | 1269 | $asciiOffset = 0x41; |
1270 | 1270 | |
1271 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
1271 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
1272 | 1272 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
1273 | 1273 | } |
1274 | 1274 | |
@@ -1299,16 +1299,16 @@ discard block |
||
1299 | 1299 | self::initEmojiData(); |
1300 | 1300 | |
1301 | 1301 | if ($use_reversible_string_mappings) { |
1302 | - return (string) \str_replace( |
|
1303 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1304 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1302 | + return (string)\str_replace( |
|
1303 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1304 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1305 | 1305 | $str |
1306 | 1306 | ); |
1307 | 1307 | } |
1308 | 1308 | |
1309 | - return (string) \str_replace( |
|
1310 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1311 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1309 | + return (string)\str_replace( |
|
1310 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1311 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1312 | 1312 | $str |
1313 | 1313 | ); |
1314 | 1314 | } |
@@ -1340,16 +1340,16 @@ discard block |
||
1340 | 1340 | self::initEmojiData(); |
1341 | 1341 | |
1342 | 1342 | if ($use_reversible_string_mappings) { |
1343 | - return (string) \str_replace( |
|
1344 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1345 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1343 | + return (string)\str_replace( |
|
1344 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1345 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1346 | 1346 | $str |
1347 | 1347 | ); |
1348 | 1348 | } |
1349 | 1349 | |
1350 | - return (string) \str_replace( |
|
1351 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1352 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1350 | + return (string)\str_replace( |
|
1351 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1352 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1353 | 1353 | $str |
1354 | 1354 | ); |
1355 | 1355 | } |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | if ($to_encoding === 'JSON') { |
1416 | 1416 | $return = self::json_encode($str); |
1417 | 1417 | if ($return === false) { |
1418 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1418 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1419 | 1419 | } |
1420 | 1420 | |
1421 | 1421 | return $return; |
@@ -1506,7 +1506,7 @@ discard block |
||
1506 | 1506 | /** |
1507 | 1507 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
1508 | 1508 | */ |
1509 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1509 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1608,31 +1608,31 @@ discard block |
||
1608 | 1608 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1609 | 1609 | |
1610 | 1610 | if ($length === null) { |
1611 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
1611 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
1612 | 1612 | } |
1613 | 1613 | |
1614 | 1614 | if ($search === '') { |
1615 | 1615 | if ($encoding === 'UTF-8') { |
1616 | 1616 | if ($length > 0) { |
1617 | - $string_length = (int) \mb_strlen($str); |
|
1617 | + $string_length = (int)\mb_strlen($str); |
|
1618 | 1618 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1619 | 1619 | } else { |
1620 | 1620 | $end = 0; |
1621 | 1621 | } |
1622 | 1622 | |
1623 | - $pos = (int) \min( |
|
1623 | + $pos = (int)\min( |
|
1624 | 1624 | \mb_strpos($str, ' ', $end), |
1625 | 1625 | \mb_strpos($str, '.', $end) |
1626 | 1626 | ); |
1627 | 1627 | } else { |
1628 | 1628 | if ($length > 0) { |
1629 | - $string_length = (int) self::strlen($str, $encoding); |
|
1629 | + $string_length = (int)self::strlen($str, $encoding); |
|
1630 | 1630 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1631 | 1631 | } else { |
1632 | 1632 | $end = 0; |
1633 | 1633 | } |
1634 | 1634 | |
1635 | - $pos = (int) \min( |
|
1635 | + $pos = (int)\min( |
|
1636 | 1636 | self::strpos($str, ' ', $end, $encoding), |
1637 | 1637 | self::strpos($str, '.', $end, $encoding) |
1638 | 1638 | ); |
@@ -1649,18 +1649,18 @@ discard block |
||
1649 | 1649 | return ''; |
1650 | 1650 | } |
1651 | 1651 | |
1652 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1652 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1653 | 1653 | } |
1654 | 1654 | |
1655 | 1655 | return $str; |
1656 | 1656 | } |
1657 | 1657 | |
1658 | 1658 | if ($encoding === 'UTF-8') { |
1659 | - $word_position = (int) \mb_stripos($str, $search); |
|
1660 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1659 | + $word_position = (int)\mb_stripos($str, $search); |
|
1660 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1661 | 1661 | } else { |
1662 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1663 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1662 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1663 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1664 | 1664 | } |
1665 | 1665 | |
1666 | 1666 | $pos_start = 0; |
@@ -1672,12 +1672,12 @@ discard block |
||
1672 | 1672 | } |
1673 | 1673 | if ($half_text !== false) { |
1674 | 1674 | if ($encoding === 'UTF-8') { |
1675 | - $pos_start = (int) \max( |
|
1675 | + $pos_start = (int)\max( |
|
1676 | 1676 | \mb_strrpos($half_text, ' '), |
1677 | 1677 | \mb_strrpos($half_text, '.') |
1678 | 1678 | ); |
1679 | 1679 | } else { |
1680 | - $pos_start = (int) \max( |
|
1680 | + $pos_start = (int)\max( |
|
1681 | 1681 | self::strrpos($half_text, ' ', 0, $encoding), |
1682 | 1682 | self::strrpos($half_text, '.', 0, $encoding) |
1683 | 1683 | ); |
@@ -1687,19 +1687,19 @@ discard block |
||
1687 | 1687 | |
1688 | 1688 | if ($word_position && $half_side > 0) { |
1689 | 1689 | $offset = $pos_start + $length - 1; |
1690 | - $real_length = (int) self::strlen($str, $encoding); |
|
1690 | + $real_length = (int)self::strlen($str, $encoding); |
|
1691 | 1691 | |
1692 | 1692 | if ($offset > $real_length) { |
1693 | 1693 | $offset = $real_length; |
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | if ($encoding === 'UTF-8') { |
1697 | - $pos_end = (int) \min( |
|
1697 | + $pos_end = (int)\min( |
|
1698 | 1698 | \mb_strpos($str, ' ', $offset), |
1699 | 1699 | \mb_strpos($str, '.', $offset) |
1700 | 1700 | ) - $pos_start; |
1701 | 1701 | } else { |
1702 | - $pos_end = (int) \min( |
|
1702 | + $pos_end = (int)\min( |
|
1703 | 1703 | self::strpos($str, ' ', $offset, $encoding), |
1704 | 1704 | self::strpos($str, '.', $offset, $encoding) |
1705 | 1705 | ) - $pos_start; |
@@ -1707,12 +1707,12 @@ discard block |
||
1707 | 1707 | |
1708 | 1708 | if (!$pos_end || $pos_end <= 0) { |
1709 | 1709 | if ($encoding === 'UTF-8') { |
1710 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1710 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1711 | 1711 | } else { |
1712 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1712 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1713 | 1713 | } |
1714 | 1714 | if ($str_sub !== false) { |
1715 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1715 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1716 | 1716 | } else { |
1717 | 1717 | $extract = ''; |
1718 | 1718 | } |
@@ -1723,26 +1723,26 @@ discard block |
||
1723 | 1723 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1724 | 1724 | } |
1725 | 1725 | if ($str_sub !== false) { |
1726 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1726 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1727 | 1727 | } else { |
1728 | 1728 | $extract = ''; |
1729 | 1729 | } |
1730 | 1730 | } |
1731 | 1731 | } else { |
1732 | 1732 | $offset = $length - 1; |
1733 | - $true_length = (int) self::strlen($str, $encoding); |
|
1733 | + $true_length = (int)self::strlen($str, $encoding); |
|
1734 | 1734 | |
1735 | 1735 | if ($offset > $true_length) { |
1736 | 1736 | $offset = $true_length; |
1737 | 1737 | } |
1738 | 1738 | |
1739 | 1739 | if ($encoding === 'UTF-8') { |
1740 | - $pos_end = (int) \min( |
|
1740 | + $pos_end = (int)\min( |
|
1741 | 1741 | \mb_strpos($str, ' ', $offset), |
1742 | 1742 | \mb_strpos($str, '.', $offset) |
1743 | 1743 | ); |
1744 | 1744 | } else { |
1745 | - $pos_end = (int) \min( |
|
1745 | + $pos_end = (int)\min( |
|
1746 | 1746 | self::strpos($str, ' ', $offset, $encoding), |
1747 | 1747 | self::strpos($str, '.', $offset, $encoding) |
1748 | 1748 | ); |
@@ -1755,7 +1755,7 @@ discard block |
||
1755 | 1755 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1756 | 1756 | } |
1757 | 1757 | if ($str_sub !== false) { |
1758 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1758 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1759 | 1759 | } else { |
1760 | 1760 | $extract = ''; |
1761 | 1761 | } |
@@ -1888,7 +1888,7 @@ discard block |
||
1888 | 1888 | { |
1889 | 1889 | $file_content = \file_get_contents($file_path); |
1890 | 1890 | if ($file_content === false) { |
1891 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1891 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1892 | 1892 | } |
1893 | 1893 | |
1894 | 1894 | return self::string_has_bom($file_content); |
@@ -1954,7 +1954,7 @@ discard block |
||
1954 | 1954 | ) { |
1955 | 1955 | // Prevent leading combining chars |
1956 | 1956 | // for NFC-safe concatenations. |
1957 | - $var = $leading_combining . $var; |
|
1957 | + $var = $leading_combining.$var; |
|
1958 | 1958 | } |
1959 | 1959 | } |
1960 | 1960 | |
@@ -2275,10 +2275,10 @@ discard block |
||
2275 | 2275 | } |
2276 | 2276 | |
2277 | 2277 | if ($encoding === 'UTF-8') { |
2278 | - return (string) \mb_substr($str, 0, $n); |
|
2278 | + return (string)\mb_substr($str, 0, $n); |
|
2279 | 2279 | } |
2280 | 2280 | |
2281 | - return (string) self::substr($str, 0, $n, $encoding); |
|
2281 | + return (string)self::substr($str, 0, $n, $encoding); |
|
2282 | 2282 | } |
2283 | 2283 | |
2284 | 2284 | /** |
@@ -2296,7 +2296,7 @@ discard block |
||
2296 | 2296 | */ |
2297 | 2297 | public static function fits_inside(string $str, int $box_size): bool |
2298 | 2298 | { |
2299 | - return (int) self::strlen($str) <= $box_size; |
|
2299 | + return (int)self::strlen($str) <= $box_size; |
|
2300 | 2300 | } |
2301 | 2301 | |
2302 | 2302 | /** |
@@ -2379,7 +2379,7 @@ discard block |
||
2379 | 2379 | return $str; |
2380 | 2380 | } |
2381 | 2381 | |
2382 | - $str = (string) $str; |
|
2382 | + $str = (string)$str; |
|
2383 | 2383 | $last = ''; |
2384 | 2384 | while ($last !== $str) { |
2385 | 2385 | $last = $str; |
@@ -2588,7 +2588,7 @@ discard block |
||
2588 | 2588 | return $fallback; |
2589 | 2589 | } |
2590 | 2590 | /** @noinspection OffsetOperationsInspection */ |
2591 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2591 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2592 | 2592 | |
2593 | 2593 | // DEBUG |
2594 | 2594 | //var_dump($type_code); |
@@ -2646,7 +2646,7 @@ discard block |
||
2646 | 2646 | // |
2647 | 2647 | |
2648 | 2648 | if ($encoding === 'UTF-8') { |
2649 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2649 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2650 | 2650 | if ($max_length === 0) { |
2651 | 2651 | return ''; |
2652 | 2652 | } |
@@ -2667,7 +2667,7 @@ discard block |
||
2667 | 2667 | } else { |
2668 | 2668 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2669 | 2669 | |
2670 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2670 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2671 | 2671 | if ($max_length === 0) { |
2672 | 2672 | return ''; |
2673 | 2673 | } |
@@ -2705,16 +2705,16 @@ discard block |
||
2705 | 2705 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
2706 | 2706 | } |
2707 | 2707 | |
2708 | - $unique_helper = $rand_int . |
|
2709 | - \session_id() . |
|
2710 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2711 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2708 | + $unique_helper = $rand_int. |
|
2709 | + \session_id(). |
|
2710 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2711 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2712 | 2712 | $extra_entropy; |
2713 | 2713 | |
2714 | 2714 | $unique_string = \uniqid($unique_helper, true); |
2715 | 2715 | |
2716 | 2716 | if ($use_md5) { |
2717 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2717 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2718 | 2718 | } |
2719 | 2719 | |
2720 | 2720 | return $unique_string; |
@@ -2813,7 +2813,7 @@ discard block |
||
2813 | 2813 | public static function hex_to_chr(string $hexdec) |
2814 | 2814 | { |
2815 | 2815 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
2816 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
2816 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
2817 | 2817 | } |
2818 | 2818 | |
2819 | 2819 | /** |
@@ -2833,7 +2833,7 @@ discard block |
||
2833 | 2833 | public static function hex_to_int($hexdec) |
2834 | 2834 | { |
2835 | 2835 | // init |
2836 | - $hexdec = (string) $hexdec; |
|
2836 | + $hexdec = (string)$hexdec; |
|
2837 | 2837 | |
2838 | 2838 | if ($hexdec === '') { |
2839 | 2839 | return false; |
@@ -2933,7 +2933,7 @@ discard block |
||
2933 | 2933 | return \implode( |
2934 | 2934 | '', |
2935 | 2935 | \array_map( |
2936 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2936 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2937 | 2937 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2938 | 2938 | }, |
2939 | 2939 | self::str_split($str) |
@@ -3048,7 +3048,7 @@ discard block |
||
3048 | 3048 | /** |
3049 | 3049 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
3050 | 3050 | */ |
3051 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
3051 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
3052 | 3052 | } |
3053 | 3053 | |
3054 | 3054 | do { |
@@ -3057,7 +3057,7 @@ discard block |
||
3057 | 3057 | if (\strpos($str, '&') !== false) { |
3058 | 3058 | if (\strpos($str, '&#') !== false) { |
3059 | 3059 | // decode also numeric & UTF16 two byte entities |
3060 | - $str = (string) \preg_replace( |
|
3060 | + $str = (string)\preg_replace( |
|
3061 | 3061 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
3062 | 3062 | '$1;', |
3063 | 3063 | $str |
@@ -3107,7 +3107,7 @@ discard block |
||
3107 | 3107 | */ |
3108 | 3108 | public static function html_stripe_empty_tags(string $str): string |
3109 | 3109 | { |
3110 | - return (string) \preg_replace( |
|
3110 | + return (string)\preg_replace( |
|
3111 | 3111 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
3112 | 3112 | '', |
3113 | 3113 | $str |
@@ -3437,9 +3437,9 @@ discard block |
||
3437 | 3437 | { |
3438 | 3438 | $hex = \dechex($int); |
3439 | 3439 | |
3440 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
3440 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
3441 | 3441 | |
3442 | - return $prefix . $hex . ''; |
|
3442 | + return $prefix.$hex.''; |
|
3443 | 3443 | } |
3444 | 3444 | |
3445 | 3445 | /** |
@@ -3767,7 +3767,7 @@ discard block |
||
3767 | 3767 | */ |
3768 | 3768 | public static function is_binary($input, bool $strict = false): bool |
3769 | 3769 | { |
3770 | - $input = (string) $input; |
|
3770 | + $input = (string)$input; |
|
3771 | 3771 | if ($input === '') { |
3772 | 3772 | return false; |
3773 | 3773 | } |
@@ -4127,7 +4127,7 @@ discard block |
||
4127 | 4127 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
4128 | 4128 | { |
4129 | 4129 | // init |
4130 | - $str = (string) $str; |
|
4130 | + $str = (string)$str; |
|
4131 | 4131 | $str_chars = []; |
4132 | 4132 | |
4133 | 4133 | if ( |
@@ -4221,7 +4221,7 @@ discard block |
||
4221 | 4221 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
4222 | 4222 | { |
4223 | 4223 | // init |
4224 | - $str = (string) $str; |
|
4224 | + $str = (string)$str; |
|
4225 | 4225 | $str_chars = []; |
4226 | 4226 | |
4227 | 4227 | if ( |
@@ -4319,7 +4319,7 @@ discard block |
||
4319 | 4319 | return true; |
4320 | 4320 | } |
4321 | 4321 | |
4322 | - return self::is_utf8_string((string) $str, $strict); |
|
4322 | + return self::is_utf8_string((string)$str, $strict); |
|
4323 | 4323 | } |
4324 | 4324 | |
4325 | 4325 | /** |
@@ -4477,15 +4477,15 @@ discard block |
||
4477 | 4477 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
4478 | 4478 | |
4479 | 4479 | if ($encoding === 'UTF-8') { |
4480 | - $str_part_two = (string) \mb_substr($str, 1); |
|
4480 | + $str_part_two = (string)\mb_substr($str, 1); |
|
4481 | 4481 | |
4482 | 4482 | if ($use_mb_functions) { |
4483 | 4483 | $str_part_one = \mb_strtolower( |
4484 | - (string) \mb_substr($str, 0, 1) |
|
4484 | + (string)\mb_substr($str, 0, 1) |
|
4485 | 4485 | ); |
4486 | 4486 | } else { |
4487 | 4487 | $str_part_one = self::strtolower( |
4488 | - (string) \mb_substr($str, 0, 1), |
|
4488 | + (string)\mb_substr($str, 0, 1), |
|
4489 | 4489 | $encoding, |
4490 | 4490 | false, |
4491 | 4491 | $lang, |
@@ -4495,10 +4495,10 @@ discard block |
||
4495 | 4495 | } else { |
4496 | 4496 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4497 | 4497 | |
4498 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
4498 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
4499 | 4499 | |
4500 | 4500 | $str_part_one = self::strtolower( |
4501 | - (string) self::substr($str, 0, 1, $encoding), |
|
4501 | + (string)self::substr($str, 0, 1, $encoding), |
|
4502 | 4502 | $encoding, |
4503 | 4503 | false, |
4504 | 4504 | $lang, |
@@ -4506,7 +4506,7 @@ discard block |
||
4506 | 4506 | ); |
4507 | 4507 | } |
4508 | 4508 | |
4509 | - return $str_part_one . $str_part_two; |
|
4509 | + return $str_part_one.$str_part_two; |
|
4510 | 4510 | } |
4511 | 4511 | |
4512 | 4512 | /** |
@@ -4655,7 +4655,7 @@ discard block |
||
4655 | 4655 | } |
4656 | 4656 | |
4657 | 4657 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4658 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4658 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4659 | 4659 | } |
4660 | 4660 | |
4661 | 4661 | if ($chars !== null) { |
@@ -4692,7 +4692,7 @@ discard block |
||
4692 | 4692 | |
4693 | 4693 | $codepoint_max = \max($codepoints); |
4694 | 4694 | |
4695 | - return self::chr((int) $codepoint_max); |
|
4695 | + return self::chr((int)$codepoint_max); |
|
4696 | 4696 | } |
4697 | 4697 | |
4698 | 4698 | /** |
@@ -4712,7 +4712,7 @@ discard block |
||
4712 | 4712 | { |
4713 | 4713 | $bytes = self::chr_size_list($str); |
4714 | 4714 | if ($bytes !== []) { |
4715 | - return (int) \max($bytes); |
|
4715 | + return (int)\max($bytes); |
|
4716 | 4716 | } |
4717 | 4717 | |
4718 | 4718 | return 0; |
@@ -4758,7 +4758,7 @@ discard block |
||
4758 | 4758 | |
4759 | 4759 | $codepoint_min = \min($codepoints); |
4760 | 4760 | |
4761 | - return self::chr((int) $codepoint_min); |
|
4761 | + return self::chr((int)$codepoint_min); |
|
4762 | 4762 | } |
4763 | 4763 | |
4764 | 4764 | /** |
@@ -4806,7 +4806,7 @@ discard block |
||
4806 | 4806 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4807 | 4807 | |
4808 | 4808 | // init |
4809 | - $encoding = (string) $encoding; |
|
4809 | + $encoding = (string)$encoding; |
|
4810 | 4810 | |
4811 | 4811 | if (!$encoding) { |
4812 | 4812 | return $fallback; |
@@ -4868,7 +4868,7 @@ discard block |
||
4868 | 4868 | |
4869 | 4869 | $encoding_original = $encoding; |
4870 | 4870 | $encoding = \strtoupper($encoding); |
4871 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4871 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4872 | 4872 | |
4873 | 4873 | $equivalences = [ |
4874 | 4874 | 'ISO8859' => 'ISO-8859-1', |
@@ -5032,13 +5032,13 @@ discard block |
||
5032 | 5032 | static $CHAR_CACHE = []; |
5033 | 5033 | |
5034 | 5034 | // init |
5035 | - $chr = (string) $chr; |
|
5035 | + $chr = (string)$chr; |
|
5036 | 5036 | |
5037 | 5037 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
5038 | 5038 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5039 | 5039 | } |
5040 | 5040 | |
5041 | - $cache_key = $chr . '_' . $encoding; |
|
5041 | + $cache_key = $chr.'_'.$encoding; |
|
5042 | 5042 | if (isset($CHAR_CACHE[$cache_key])) { |
5043 | 5043 | return $CHAR_CACHE[$cache_key]; |
5044 | 5044 | } |
@@ -5073,7 +5073,7 @@ discard block |
||
5073 | 5073 | // |
5074 | 5074 | |
5075 | 5075 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
5076 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
5076 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
5077 | 5077 | /** @noinspection OffsetOperationsInspection */ |
5078 | 5078 | $code = $chr ? $chr[1] : 0; |
5079 | 5079 | |
@@ -5081,21 +5081,21 @@ discard block |
||
5081 | 5081 | if ($code >= 0xF0 && isset($chr[4])) { |
5082 | 5082 | /** @noinspection UnnecessaryCastingInspection */ |
5083 | 5083 | /** @noinspection OffsetOperationsInspection */ |
5084 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
5084 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
5085 | 5085 | } |
5086 | 5086 | |
5087 | 5087 | /** @noinspection OffsetOperationsInspection */ |
5088 | 5088 | if ($code >= 0xE0 && isset($chr[3])) { |
5089 | 5089 | /** @noinspection UnnecessaryCastingInspection */ |
5090 | 5090 | /** @noinspection OffsetOperationsInspection */ |
5091 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
5091 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
5092 | 5092 | } |
5093 | 5093 | |
5094 | 5094 | /** @noinspection OffsetOperationsInspection */ |
5095 | 5095 | if ($code >= 0xC0 && isset($chr[2])) { |
5096 | 5096 | /** @noinspection UnnecessaryCastingInspection */ |
5097 | 5097 | /** @noinspection OffsetOperationsInspection */ |
5098 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
5098 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
5099 | 5099 | } |
5100 | 5100 | |
5101 | 5101 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -5157,7 +5157,7 @@ discard block |
||
5157 | 5157 | public static function pcre_utf8_support(): bool |
5158 | 5158 | { |
5159 | 5159 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5160 | - return (bool) @\preg_match('//u', ''); |
|
5160 | + return (bool)@\preg_match('//u', ''); |
|
5161 | 5161 | } |
5162 | 5162 | |
5163 | 5163 | /** |
@@ -5198,14 +5198,14 @@ discard block |
||
5198 | 5198 | * @psalm-suppress DocblockTypeContradiction |
5199 | 5199 | */ |
5200 | 5200 | if (!\is_numeric($step)) { |
5201 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
5201 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
5202 | 5202 | } |
5203 | 5203 | |
5204 | 5204 | /** |
5205 | 5205 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
5206 | 5206 | */ |
5207 | 5207 | if ($step <= 0) { |
5208 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
5208 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
5209 | 5209 | } |
5210 | 5210 | } |
5211 | 5211 | |
@@ -5217,16 +5217,16 @@ discard block |
||
5217 | 5217 | $is_xdigit = false; |
5218 | 5218 | |
5219 | 5219 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5220 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
5220 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
5221 | 5221 | $is_digit = true; |
5222 | - $start = (int) $var1; |
|
5222 | + $start = (int)$var1; |
|
5223 | 5223 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
5224 | 5224 | $is_xdigit = true; |
5225 | - $start = (int) self::hex_to_int((string) $var1); |
|
5225 | + $start = (int)self::hex_to_int((string)$var1); |
|
5226 | 5226 | } elseif (!$use_ctype && \is_numeric($var1)) { |
5227 | - $start = (int) $var1; |
|
5227 | + $start = (int)$var1; |
|
5228 | 5228 | } else { |
5229 | - $start = self::ord((string) $var1); |
|
5229 | + $start = self::ord((string)$var1); |
|
5230 | 5230 | } |
5231 | 5231 | |
5232 | 5232 | if (!$start) { |
@@ -5234,13 +5234,13 @@ discard block |
||
5234 | 5234 | } |
5235 | 5235 | |
5236 | 5236 | if ($is_digit) { |
5237 | - $end = (int) $var2; |
|
5237 | + $end = (int)$var2; |
|
5238 | 5238 | } elseif ($is_xdigit) { |
5239 | - $end = (int) self::hex_to_int((string) $var2); |
|
5239 | + $end = (int)self::hex_to_int((string)$var2); |
|
5240 | 5240 | } elseif (!$use_ctype && \is_numeric($var2)) { |
5241 | - $end = (int) $var2; |
|
5241 | + $end = (int)$var2; |
|
5242 | 5242 | } else { |
5243 | - $end = self::ord((string) $var2); |
|
5243 | + $end = self::ord((string)$var2); |
|
5244 | 5244 | } |
5245 | 5245 | |
5246 | 5246 | if (!$end) { |
@@ -5249,7 +5249,7 @@ discard block |
||
5249 | 5249 | |
5250 | 5250 | $array = []; |
5251 | 5251 | foreach (\range($start, $end, $step) as $i) { |
5252 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
5252 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
5253 | 5253 | } |
5254 | 5254 | |
5255 | 5255 | return $array; |
@@ -5361,8 +5361,8 @@ discard block |
||
5361 | 5361 | $delimiter = '/'; |
5362 | 5362 | } |
5363 | 5363 | |
5364 | - return (string) \preg_replace( |
|
5365 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
5364 | + return (string)\preg_replace( |
|
5365 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
5366 | 5366 | $replacement, |
5367 | 5367 | $str |
5368 | 5368 | ); |
@@ -5412,9 +5412,9 @@ discard block |
||
5412 | 5412 | return ''; |
5413 | 5413 | } |
5414 | 5414 | |
5415 | - $str_length -= (int) $bom_byte_length; |
|
5415 | + $str_length -= (int)$bom_byte_length; |
|
5416 | 5416 | |
5417 | - $str = (string) $str_tmp; |
|
5417 | + $str = (string)$str_tmp; |
|
5418 | 5418 | } |
5419 | 5419 | } |
5420 | 5420 | |
@@ -5445,7 +5445,7 @@ discard block |
||
5445 | 5445 | */ |
5446 | 5446 | if (\is_array($what)) { |
5447 | 5447 | foreach ($what as $item) { |
5448 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
5448 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
5449 | 5449 | } |
5450 | 5450 | } |
5451 | 5451 | |
@@ -5483,7 +5483,7 @@ discard block |
||
5483 | 5483 | */ |
5484 | 5484 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
5485 | 5485 | { |
5486 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5486 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5487 | 5487 | } |
5488 | 5488 | |
5489 | 5489 | /** |
@@ -5544,17 +5544,17 @@ discard block |
||
5544 | 5544 | \strpos($str, $substring) === 0 |
5545 | 5545 | ) { |
5546 | 5546 | if ($encoding === 'UTF-8') { |
5547 | - return (string) \mb_substr( |
|
5547 | + return (string)\mb_substr( |
|
5548 | 5548 | $str, |
5549 | - (int) \mb_strlen($substring) |
|
5549 | + (int)\mb_strlen($substring) |
|
5550 | 5550 | ); |
5551 | 5551 | } |
5552 | 5552 | |
5553 | 5553 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5554 | 5554 | |
5555 | - return (string) self::substr( |
|
5555 | + return (string)self::substr( |
|
5556 | 5556 | $str, |
5557 | - (int) self::strlen($substring, $encoding), |
|
5557 | + (int)self::strlen($substring, $encoding), |
|
5558 | 5558 | null, |
5559 | 5559 | $encoding |
5560 | 5560 | ); |
@@ -5582,19 +5582,19 @@ discard block |
||
5582 | 5582 | ): string { |
5583 | 5583 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
5584 | 5584 | if ($encoding === 'UTF-8') { |
5585 | - return (string) \mb_substr( |
|
5585 | + return (string)\mb_substr( |
|
5586 | 5586 | $str, |
5587 | 5587 | 0, |
5588 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
5588 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
5589 | 5589 | ); |
5590 | 5590 | } |
5591 | 5591 | |
5592 | 5592 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5593 | 5593 | |
5594 | - return (string) self::substr( |
|
5594 | + return (string)self::substr( |
|
5595 | 5595 | $str, |
5596 | 5596 | 0, |
5597 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
5597 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
5598 | 5598 | $encoding |
5599 | 5599 | ); |
5600 | 5600 | } |
@@ -5697,7 +5697,7 @@ discard block |
||
5697 | 5697 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
5698 | 5698 | @\mb_substitute_character($replacement_char_helper); |
5699 | 5699 | // the polyfill maybe return false, so cast to string |
5700 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5700 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5701 | 5701 | \mb_substitute_character($save); |
5702 | 5702 | } |
5703 | 5703 | |
@@ -5743,7 +5743,7 @@ discard block |
||
5743 | 5743 | } |
5744 | 5744 | |
5745 | 5745 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5746 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5746 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5747 | 5747 | } |
5748 | 5748 | |
5749 | 5749 | if ($chars !== null) { |
@@ -5773,7 +5773,7 @@ discard block |
||
5773 | 5773 | $html .= '<pre>'; |
5774 | 5774 | /** @noinspection AlterInForeachInspection */ |
5775 | 5775 | foreach (self::$SUPPORT as $key => &$value) { |
5776 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5776 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
5777 | 5777 | } |
5778 | 5778 | $html .= '</pre>'; |
5779 | 5779 | |
@@ -5815,7 +5815,7 @@ discard block |
||
5815 | 5815 | return $char; |
5816 | 5816 | } |
5817 | 5817 | |
5818 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5818 | + return '&#'.self::ord($char, $encoding).';'; |
|
5819 | 5819 | } |
5820 | 5820 | |
5821 | 5821 | /** |
@@ -5919,11 +5919,11 @@ discard block |
||
5919 | 5919 | $lang, |
5920 | 5920 | $try_to_keep_the_string_length |
5921 | 5921 | ); |
5922 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5922 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5923 | 5923 | |
5924 | 5924 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5925 | 5925 | |
5926 | - $str = (string) \preg_replace_callback( |
|
5926 | + $str = (string)\preg_replace_callback( |
|
5927 | 5927 | '/[-_\\s]+(.)?/u', |
5928 | 5928 | /** |
5929 | 5929 | * @param array $match |
@@ -5932,7 +5932,7 @@ discard block |
||
5932 | 5932 | * |
5933 | 5933 | * @return string |
5934 | 5934 | */ |
5935 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5935 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5936 | 5936 | if (isset($match[1])) { |
5937 | 5937 | if ($use_mb_functions) { |
5938 | 5938 | if ($encoding === 'UTF-8') { |
@@ -5950,7 +5950,7 @@ discard block |
||
5950 | 5950 | $str |
5951 | 5951 | ); |
5952 | 5952 | |
5953 | - return (string) \preg_replace_callback( |
|
5953 | + return (string)\preg_replace_callback( |
|
5954 | 5954 | '/[\\p{N}]+(.)?/u', |
5955 | 5955 | /** |
5956 | 5956 | * @param array $match |
@@ -5959,7 +5959,7 @@ discard block |
||
5959 | 5959 | * |
5960 | 5960 | * @return string |
5961 | 5961 | */ |
5962 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5962 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5963 | 5963 | if ($use_mb_functions) { |
5964 | 5964 | if ($encoding === 'UTF-8') { |
5965 | 5965 | return \mb_strtoupper($match[0]); |
@@ -6153,7 +6153,7 @@ discard block |
||
6153 | 6153 | ): string { |
6154 | 6154 | if (self::$SUPPORT['mbstring'] === true) { |
6155 | 6155 | /** @noinspection PhpComposerExtensionStubsInspection */ |
6156 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
6156 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
6157 | 6157 | |
6158 | 6158 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
6159 | 6159 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6163,10 +6163,10 @@ discard block |
||
6163 | 6163 | } |
6164 | 6164 | |
6165 | 6165 | /** @noinspection PhpComposerExtensionStubsInspection */ |
6166 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
6166 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
6167 | 6167 | } |
6168 | 6168 | |
6169 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
6169 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
6170 | 6170 | |
6171 | 6171 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
6172 | 6172 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6175,7 +6175,7 @@ discard block |
||
6175 | 6175 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
6176 | 6176 | } |
6177 | 6177 | |
6178 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
6178 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
6179 | 6179 | } |
6180 | 6180 | |
6181 | 6181 | /** |
@@ -6199,7 +6199,7 @@ discard block |
||
6199 | 6199 | public static function str_detect_encoding($str) |
6200 | 6200 | { |
6201 | 6201 | // init |
6202 | - $str = (string) $str; |
|
6202 | + $str = (string)$str; |
|
6203 | 6203 | |
6204 | 6204 | // |
6205 | 6205 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -6301,7 +6301,7 @@ discard block |
||
6301 | 6301 | foreach (self::$ENCODINGS as $encoding_tmp) { |
6302 | 6302 | // INFO: //IGNORE but still throw notice |
6303 | 6303 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
6304 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
6304 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
6305 | 6305 | return $encoding_tmp; |
6306 | 6306 | } |
6307 | 6307 | } |
@@ -6404,7 +6404,7 @@ discard block |
||
6404 | 6404 | return $str; |
6405 | 6405 | } |
6406 | 6406 | |
6407 | - return $substring . $str; |
|
6407 | + return $substring.$str; |
|
6408 | 6408 | } |
6409 | 6409 | |
6410 | 6410 | /** |
@@ -6700,27 +6700,27 @@ discard block |
||
6700 | 6700 | string $encoding = 'UTF-8' |
6701 | 6701 | ): string { |
6702 | 6702 | if ($encoding === 'UTF-8') { |
6703 | - $len = (int) \mb_strlen($str); |
|
6703 | + $len = (int)\mb_strlen($str); |
|
6704 | 6704 | if ($index > $len) { |
6705 | 6705 | return $str; |
6706 | 6706 | } |
6707 | 6707 | |
6708 | 6708 | /** @noinspection UnnecessaryCastingInspection */ |
6709 | - return (string) \mb_substr($str, 0, $index) . |
|
6710 | - $substring . |
|
6711 | - (string) \mb_substr($str, $index, $len); |
|
6709 | + return (string)\mb_substr($str, 0, $index). |
|
6710 | + $substring. |
|
6711 | + (string)\mb_substr($str, $index, $len); |
|
6712 | 6712 | } |
6713 | 6713 | |
6714 | 6714 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6715 | 6715 | |
6716 | - $len = (int) self::strlen($str, $encoding); |
|
6716 | + $len = (int)self::strlen($str, $encoding); |
|
6717 | 6717 | if ($index > $len) { |
6718 | 6718 | return $str; |
6719 | 6719 | } |
6720 | 6720 | |
6721 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
6722 | - $substring . |
|
6723 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6721 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
6722 | + $substring. |
|
6723 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
6724 | 6724 | } |
6725 | 6725 | |
6726 | 6726 | /** |
@@ -6760,15 +6760,15 @@ discard block |
||
6760 | 6760 | */ |
6761 | 6761 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
6762 | 6762 | { |
6763 | - $search = (array) $search; |
|
6763 | + $search = (array)$search; |
|
6764 | 6764 | |
6765 | 6765 | /** @noinspection AlterInForeachInspection */ |
6766 | 6766 | foreach ($search as &$s) { |
6767 | - $s = (string) $s; |
|
6767 | + $s = (string)$s; |
|
6768 | 6768 | if ($s === '') { |
6769 | 6769 | $s = '/^(?<=.)$/'; |
6770 | 6770 | } else { |
6771 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
6771 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
6772 | 6772 | } |
6773 | 6773 | } |
6774 | 6774 | |
@@ -6816,12 +6816,12 @@ discard block |
||
6816 | 6816 | } |
6817 | 6817 | |
6818 | 6818 | if ($search === '') { |
6819 | - return $str . $replacement; |
|
6819 | + return $str.$replacement; |
|
6820 | 6820 | } |
6821 | 6821 | |
6822 | 6822 | $searchLength = \strlen($search); |
6823 | 6823 | if (\strncasecmp($str, $search, $searchLength) === 0) { |
6824 | - return $replacement . \substr($str, $searchLength); |
|
6824 | + return $replacement.\substr($str, $searchLength); |
|
6825 | 6825 | } |
6826 | 6826 | |
6827 | 6827 | return $str; |
@@ -6852,11 +6852,11 @@ discard block |
||
6852 | 6852 | } |
6853 | 6853 | |
6854 | 6854 | if ($search === '') { |
6855 | - return $str . $replacement; |
|
6855 | + return $str.$replacement; |
|
6856 | 6856 | } |
6857 | 6857 | |
6858 | 6858 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6859 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6859 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6860 | 6860 | } |
6861 | 6861 | |
6862 | 6862 | return $str; |
@@ -6948,15 +6948,15 @@ discard block |
||
6948 | 6948 | } |
6949 | 6949 | |
6950 | 6950 | if ($encoding === 'UTF-8') { |
6951 | - return (string) \mb_substr( |
|
6951 | + return (string)\mb_substr( |
|
6952 | 6952 | $str, |
6953 | - $offset + (int) \mb_strlen($separator) |
|
6953 | + $offset + (int)\mb_strlen($separator) |
|
6954 | 6954 | ); |
6955 | 6955 | } |
6956 | 6956 | |
6957 | - return (string) self::substr( |
|
6957 | + return (string)self::substr( |
|
6958 | 6958 | $str, |
6959 | - $offset + (int) self::strlen($separator, $encoding), |
|
6959 | + $offset + (int)self::strlen($separator, $encoding), |
|
6960 | 6960 | null, |
6961 | 6961 | $encoding |
6962 | 6962 | ); |
@@ -6988,15 +6988,15 @@ discard block |
||
6988 | 6988 | } |
6989 | 6989 | |
6990 | 6990 | if ($encoding === 'UTF-8') { |
6991 | - return (string) \mb_substr( |
|
6991 | + return (string)\mb_substr( |
|
6992 | 6992 | $str, |
6993 | - $offset + (int) self::strlen($separator) |
|
6993 | + $offset + (int)self::strlen($separator) |
|
6994 | 6994 | ); |
6995 | 6995 | } |
6996 | 6996 | |
6997 | - return (string) self::substr( |
|
6997 | + return (string)self::substr( |
|
6998 | 6998 | $str, |
6999 | - $offset + (int) self::strlen($separator, $encoding), |
|
6999 | + $offset + (int)self::strlen($separator, $encoding), |
|
7000 | 7000 | null, |
7001 | 7001 | $encoding |
7002 | 7002 | ); |
@@ -7028,10 +7028,10 @@ discard block |
||
7028 | 7028 | } |
7029 | 7029 | |
7030 | 7030 | if ($encoding === 'UTF-8') { |
7031 | - return (string) \mb_substr($str, 0, $offset); |
|
7031 | + return (string)\mb_substr($str, 0, $offset); |
|
7032 | 7032 | } |
7033 | 7033 | |
7034 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
7034 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
7035 | 7035 | } |
7036 | 7036 | |
7037 | 7037 | /** |
@@ -7060,7 +7060,7 @@ discard block |
||
7060 | 7060 | return ''; |
7061 | 7061 | } |
7062 | 7062 | |
7063 | - return (string) \mb_substr($str, 0, $offset); |
|
7063 | + return (string)\mb_substr($str, 0, $offset); |
|
7064 | 7064 | } |
7065 | 7065 | |
7066 | 7066 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -7068,7 +7068,7 @@ discard block |
||
7068 | 7068 | return ''; |
7069 | 7069 | } |
7070 | 7070 | |
7071 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
7071 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
7072 | 7072 | } |
7073 | 7073 | |
7074 | 7074 | /** |
@@ -7170,12 +7170,12 @@ discard block |
||
7170 | 7170 | } |
7171 | 7171 | |
7172 | 7172 | if ($encoding === 'UTF-8') { |
7173 | - return (string) \mb_substr($str, -$n); |
|
7173 | + return (string)\mb_substr($str, -$n); |
|
7174 | 7174 | } |
7175 | 7175 | |
7176 | 7176 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7177 | 7177 | |
7178 | - return (string) self::substr($str, -$n, null, $encoding); |
|
7178 | + return (string)self::substr($str, -$n, null, $encoding); |
|
7179 | 7179 | } |
7180 | 7180 | |
7181 | 7181 | /** |
@@ -7201,21 +7201,21 @@ discard block |
||
7201 | 7201 | } |
7202 | 7202 | |
7203 | 7203 | if ($encoding === 'UTF-8') { |
7204 | - if ((int) \mb_strlen($str) <= $length) { |
|
7204 | + if ((int)\mb_strlen($str) <= $length) { |
|
7205 | 7205 | return $str; |
7206 | 7206 | } |
7207 | 7207 | |
7208 | 7208 | /** @noinspection UnnecessaryCastingInspection */ |
7209 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
7209 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
7210 | 7210 | } |
7211 | 7211 | |
7212 | 7212 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7213 | 7213 | |
7214 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
7214 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
7215 | 7215 | return $str; |
7216 | 7216 | } |
7217 | 7217 | |
7218 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
7218 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
7219 | 7219 | } |
7220 | 7220 | |
7221 | 7221 | /** |
@@ -7244,12 +7244,12 @@ discard block |
||
7244 | 7244 | |
7245 | 7245 | if ($encoding === 'UTF-8') { |
7246 | 7246 | /** @noinspection UnnecessaryCastingInspection */ |
7247 | - if ((int) \mb_strlen($str) <= $length) { |
|
7247 | + if ((int)\mb_strlen($str) <= $length) { |
|
7248 | 7248 | return $str; |
7249 | 7249 | } |
7250 | 7250 | |
7251 | 7251 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
7252 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
7252 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
7253 | 7253 | } |
7254 | 7254 | |
7255 | 7255 | $str = \mb_substr($str, 0, $length); |
@@ -7258,33 +7258,33 @@ discard block |
||
7258 | 7258 | $new_str = \implode(' ', $array); |
7259 | 7259 | |
7260 | 7260 | if ($new_str === '') { |
7261 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
7261 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
7262 | 7262 | } |
7263 | 7263 | } else { |
7264 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
7264 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
7265 | 7265 | return $str; |
7266 | 7266 | } |
7267 | 7267 | |
7268 | 7268 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
7269 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
7269 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
7270 | 7270 | } |
7271 | 7271 | |
7272 | 7272 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
7273 | 7273 | $str = self::substr($str, 0, $length, $encoding); |
7274 | 7274 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
7275 | 7275 | if ($str === false) { |
7276 | - return '' . $str_add_on; |
|
7276 | + return ''.$str_add_on; |
|
7277 | 7277 | } |
7278 | 7278 | |
7279 | 7279 | $array = \explode(' ', $str, -1); |
7280 | 7280 | $new_str = \implode(' ', $array); |
7281 | 7281 | |
7282 | 7282 | if ($new_str === '') { |
7283 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
7283 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
7284 | 7284 | } |
7285 | 7285 | } |
7286 | 7286 | |
7287 | - return $new_str . $str_add_on; |
|
7287 | + return $new_str.$str_add_on; |
|
7288 | 7288 | } |
7289 | 7289 | |
7290 | 7290 | /** |
@@ -7307,7 +7307,7 @@ discard block |
||
7307 | 7307 | $longest_common_prefix = ''; |
7308 | 7308 | |
7309 | 7309 | if ($encoding === 'UTF-8') { |
7310 | - $max_length = (int) \min( |
|
7310 | + $max_length = (int)\min( |
|
7311 | 7311 | \mb_strlen($str1), |
7312 | 7312 | \mb_strlen($str2) |
7313 | 7313 | ); |
@@ -7328,7 +7328,7 @@ discard block |
||
7328 | 7328 | } else { |
7329 | 7329 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7330 | 7330 | |
7331 | - $max_length = (int) \min( |
|
7331 | + $max_length = (int)\min( |
|
7332 | 7332 | self::strlen($str1, $encoding), |
7333 | 7333 | self::strlen($str2, $encoding) |
7334 | 7334 | ); |
@@ -7377,13 +7377,13 @@ discard block |
||
7377 | 7377 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
7378 | 7378 | |
7379 | 7379 | if ($encoding === 'UTF-8') { |
7380 | - $str_length = (int) \mb_strlen($str1); |
|
7381 | - $other_length = (int) \mb_strlen($str2); |
|
7380 | + $str_length = (int)\mb_strlen($str1); |
|
7381 | + $other_length = (int)\mb_strlen($str2); |
|
7382 | 7382 | } else { |
7383 | 7383 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7384 | 7384 | |
7385 | - $str_length = (int) self::strlen($str1, $encoding); |
|
7386 | - $other_length = (int) self::strlen($str2, $encoding); |
|
7385 | + $str_length = (int)self::strlen($str1, $encoding); |
|
7386 | + $other_length = (int)self::strlen($str2, $encoding); |
|
7387 | 7387 | } |
7388 | 7388 | |
7389 | 7389 | // Return if either string is empty |
@@ -7436,10 +7436,10 @@ discard block |
||
7436 | 7436 | } |
7437 | 7437 | |
7438 | 7438 | if ($encoding === 'UTF-8') { |
7439 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
7439 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
7440 | 7440 | } |
7441 | 7441 | |
7442 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
7442 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
7443 | 7443 | } |
7444 | 7444 | |
7445 | 7445 | /** |
@@ -7463,7 +7463,7 @@ discard block |
||
7463 | 7463 | } |
7464 | 7464 | |
7465 | 7465 | if ($encoding === 'UTF-8') { |
7466 | - $max_length = (int) \min( |
|
7466 | + $max_length = (int)\min( |
|
7467 | 7467 | \mb_strlen($str1, $encoding), |
7468 | 7468 | \mb_strlen($str2, $encoding) |
7469 | 7469 | ); |
@@ -7477,7 +7477,7 @@ discard block |
||
7477 | 7477 | && |
7478 | 7478 | $char === \mb_substr($str2, -$i, 1) |
7479 | 7479 | ) { |
7480 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7480 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7481 | 7481 | } else { |
7482 | 7482 | break; |
7483 | 7483 | } |
@@ -7485,7 +7485,7 @@ discard block |
||
7485 | 7485 | } else { |
7486 | 7486 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7487 | 7487 | |
7488 | - $max_length = (int) \min( |
|
7488 | + $max_length = (int)\min( |
|
7489 | 7489 | self::strlen($str1, $encoding), |
7490 | 7490 | self::strlen($str2, $encoding) |
7491 | 7491 | ); |
@@ -7499,7 +7499,7 @@ discard block |
||
7499 | 7499 | && |
7500 | 7500 | $char === self::substr($str2, -$i, 1, $encoding) |
7501 | 7501 | ) { |
7502 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7502 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7503 | 7503 | } else { |
7504 | 7504 | break; |
7505 | 7505 | } |
@@ -7522,7 +7522,7 @@ discard block |
||
7522 | 7522 | */ |
7523 | 7523 | public static function str_matches_pattern(string $str, string $pattern): bool |
7524 | 7524 | { |
7525 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
7525 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
7526 | 7526 | } |
7527 | 7527 | |
7528 | 7528 | /** |
@@ -7542,7 +7542,7 @@ discard block |
||
7542 | 7542 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
7543 | 7543 | { |
7544 | 7544 | // init |
7545 | - $length = (int) self::strlen($str, $encoding); |
|
7545 | + $length = (int)self::strlen($str, $encoding); |
|
7546 | 7546 | |
7547 | 7547 | if ($offset >= 0) { |
7548 | 7548 | return $length > $offset; |
@@ -7571,7 +7571,7 @@ discard block |
||
7571 | 7571 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
7572 | 7572 | { |
7573 | 7573 | // init |
7574 | - $length = (int) self::strlen($str); |
|
7574 | + $length = (int)self::strlen($str); |
|
7575 | 7575 | |
7576 | 7576 | if ( |
7577 | 7577 | ($index >= 0 && $length <= $index) |
@@ -7615,7 +7615,7 @@ discard block |
||
7615 | 7615 | return $str; |
7616 | 7616 | } |
7617 | 7617 | |
7618 | - if ($pad_type !== (int) $pad_type) { |
|
7618 | + if ($pad_type !== (int)$pad_type) { |
|
7619 | 7619 | if ($pad_type === 'left') { |
7620 | 7620 | $pad_type = \STR_PAD_LEFT; |
7621 | 7621 | } elseif ($pad_type === 'right') { |
@@ -7624,23 +7624,23 @@ discard block |
||
7624 | 7624 | $pad_type = \STR_PAD_BOTH; |
7625 | 7625 | } else { |
7626 | 7626 | throw new \InvalidArgumentException( |
7627 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
7627 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
7628 | 7628 | ); |
7629 | 7629 | } |
7630 | 7630 | } |
7631 | 7631 | |
7632 | 7632 | if ($encoding === 'UTF-8') { |
7633 | - $str_length = (int) \mb_strlen($str); |
|
7633 | + $str_length = (int)\mb_strlen($str); |
|
7634 | 7634 | |
7635 | 7635 | if ($pad_length >= $str_length) { |
7636 | 7636 | switch ($pad_type) { |
7637 | 7637 | case \STR_PAD_LEFT: |
7638 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7638 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7639 | 7639 | |
7640 | 7640 | $diff = ($pad_length - $str_length); |
7641 | 7641 | |
7642 | - $pre = (string) \mb_substr( |
|
7643 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7642 | + $pre = (string)\mb_substr( |
|
7643 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7644 | 7644 | 0, |
7645 | 7645 | $diff |
7646 | 7646 | ); |
@@ -7651,16 +7651,16 @@ discard block |
||
7651 | 7651 | case \STR_PAD_BOTH: |
7652 | 7652 | $diff = ($pad_length - $str_length); |
7653 | 7653 | |
7654 | - $ps_length_left = (int) \floor($diff / 2); |
|
7654 | + $ps_length_left = (int)\floor($diff / 2); |
|
7655 | 7655 | |
7656 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7656 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7657 | 7657 | |
7658 | - $pre = (string) \mb_substr( |
|
7658 | + $pre = (string)\mb_substr( |
|
7659 | 7659 | \str_repeat($pad_string, $ps_length_left), |
7660 | 7660 | 0, |
7661 | 7661 | $ps_length_left |
7662 | 7662 | ); |
7663 | - $post = (string) \mb_substr( |
|
7663 | + $post = (string)\mb_substr( |
|
7664 | 7664 | \str_repeat($pad_string, $ps_length_right), |
7665 | 7665 | 0, |
7666 | 7666 | $ps_length_right |
@@ -7670,19 +7670,19 @@ discard block |
||
7670 | 7670 | |
7671 | 7671 | case \STR_PAD_RIGHT: |
7672 | 7672 | default: |
7673 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7673 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7674 | 7674 | |
7675 | 7675 | $diff = ($pad_length - $str_length); |
7676 | 7676 | |
7677 | - $post = (string) \mb_substr( |
|
7678 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7677 | + $post = (string)\mb_substr( |
|
7678 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7679 | 7679 | 0, |
7680 | 7680 | $diff |
7681 | 7681 | ); |
7682 | 7682 | $pre = ''; |
7683 | 7683 | } |
7684 | 7684 | |
7685 | - return $pre . $str . $post; |
|
7685 | + return $pre.$str.$post; |
|
7686 | 7686 | } |
7687 | 7687 | |
7688 | 7688 | return $str; |
@@ -7690,17 +7690,17 @@ discard block |
||
7690 | 7690 | |
7691 | 7691 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7692 | 7692 | |
7693 | - $str_length = (int) self::strlen($str, $encoding); |
|
7693 | + $str_length = (int)self::strlen($str, $encoding); |
|
7694 | 7694 | |
7695 | 7695 | if ($pad_length >= $str_length) { |
7696 | 7696 | switch ($pad_type) { |
7697 | 7697 | case \STR_PAD_LEFT: |
7698 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7698 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7699 | 7699 | |
7700 | 7700 | $diff = ($pad_length - $str_length); |
7701 | 7701 | |
7702 | - $pre = (string) self::substr( |
|
7703 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7702 | + $pre = (string)self::substr( |
|
7703 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7704 | 7704 | 0, |
7705 | 7705 | $diff, |
7706 | 7706 | $encoding |
@@ -7712,17 +7712,17 @@ discard block |
||
7712 | 7712 | case \STR_PAD_BOTH: |
7713 | 7713 | $diff = ($pad_length - $str_length); |
7714 | 7714 | |
7715 | - $ps_length_left = (int) \floor($diff / 2); |
|
7715 | + $ps_length_left = (int)\floor($diff / 2); |
|
7716 | 7716 | |
7717 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7717 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7718 | 7718 | |
7719 | - $pre = (string) self::substr( |
|
7719 | + $pre = (string)self::substr( |
|
7720 | 7720 | \str_repeat($pad_string, $ps_length_left), |
7721 | 7721 | 0, |
7722 | 7722 | $ps_length_left, |
7723 | 7723 | $encoding |
7724 | 7724 | ); |
7725 | - $post = (string) self::substr( |
|
7725 | + $post = (string)self::substr( |
|
7726 | 7726 | \str_repeat($pad_string, $ps_length_right), |
7727 | 7727 | 0, |
7728 | 7728 | $ps_length_right, |
@@ -7733,12 +7733,12 @@ discard block |
||
7733 | 7733 | |
7734 | 7734 | case \STR_PAD_RIGHT: |
7735 | 7735 | default: |
7736 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7736 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7737 | 7737 | |
7738 | 7738 | $diff = ($pad_length - $str_length); |
7739 | 7739 | |
7740 | - $post = (string) self::substr( |
|
7741 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7740 | + $post = (string)self::substr( |
|
7741 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7742 | 7742 | 0, |
7743 | 7743 | $diff, |
7744 | 7744 | $encoding |
@@ -7746,7 +7746,7 @@ discard block |
||
7746 | 7746 | $pre = ''; |
7747 | 7747 | } |
7748 | 7748 | |
7749 | - return $pre . $str . $post; |
|
7749 | + return $pre.$str.$post; |
|
7750 | 7750 | } |
7751 | 7751 | |
7752 | 7752 | return $str; |
@@ -7957,12 +7957,12 @@ discard block |
||
7957 | 7957 | } |
7958 | 7958 | |
7959 | 7959 | if ($search === '') { |
7960 | - return $str . $replacement; |
|
7960 | + return $str.$replacement; |
|
7961 | 7961 | } |
7962 | 7962 | |
7963 | 7963 | $searchLength = \strlen($search); |
7964 | 7964 | if (\strncmp($str, $search, $searchLength) === 0) { |
7965 | - return $replacement . \substr($str, $searchLength); |
|
7965 | + return $replacement.\substr($str, $searchLength); |
|
7966 | 7966 | } |
7967 | 7967 | |
7968 | 7968 | return $str; |
@@ -7996,11 +7996,11 @@ discard block |
||
7996 | 7996 | } |
7997 | 7997 | |
7998 | 7998 | if ($search === '') { |
7999 | - return $str . $replacement; |
|
7999 | + return $str.$replacement; |
|
8000 | 8000 | } |
8001 | 8001 | |
8002 | 8002 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
8003 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
8003 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
8004 | 8004 | } |
8005 | 8005 | |
8006 | 8006 | return $str; |
@@ -8034,7 +8034,7 @@ discard block |
||
8034 | 8034 | $subject, |
8035 | 8035 | $replace, |
8036 | 8036 | $pos, |
8037 | - (int) self::strlen($search) |
|
8037 | + (int)self::strlen($search) |
|
8038 | 8038 | ); |
8039 | 8039 | } |
8040 | 8040 | |
@@ -8068,7 +8068,7 @@ discard block |
||
8068 | 8068 | $subject, |
8069 | 8069 | $replace, |
8070 | 8070 | $pos, |
8071 | - (int) self::strlen($search) |
|
8071 | + (int)self::strlen($search) |
|
8072 | 8072 | ); |
8073 | 8073 | } |
8074 | 8074 | |
@@ -8091,7 +8091,7 @@ discard block |
||
8091 | 8091 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
8092 | 8092 | { |
8093 | 8093 | if ($encoding === 'UTF-8') { |
8094 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
8094 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
8095 | 8095 | /** @noinspection NonSecureShuffleUsageInspection */ |
8096 | 8096 | \shuffle($indexes); |
8097 | 8097 | |
@@ -8107,7 +8107,7 @@ discard block |
||
8107 | 8107 | } else { |
8108 | 8108 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8109 | 8109 | |
8110 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
8110 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
8111 | 8111 | /** @noinspection NonSecureShuffleUsageInspection */ |
8112 | 8112 | \shuffle($indexes); |
8113 | 8113 | |
@@ -8150,11 +8150,11 @@ discard block |
||
8150 | 8150 | ) { |
8151 | 8151 | if ($encoding === 'UTF-8') { |
8152 | 8152 | if ($end === null) { |
8153 | - $length = (int) \mb_strlen($str); |
|
8153 | + $length = (int)\mb_strlen($str); |
|
8154 | 8154 | } elseif ($end >= 0 && $end <= $start) { |
8155 | 8155 | return ''; |
8156 | 8156 | } elseif ($end < 0) { |
8157 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
8157 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
8158 | 8158 | } else { |
8159 | 8159 | $length = $end - $start; |
8160 | 8160 | } |
@@ -8165,11 +8165,11 @@ discard block |
||
8165 | 8165 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8166 | 8166 | |
8167 | 8167 | if ($end === null) { |
8168 | - $length = (int) self::strlen($str, $encoding); |
|
8168 | + $length = (int)self::strlen($str, $encoding); |
|
8169 | 8169 | } elseif ($end >= 0 && $end <= $start) { |
8170 | 8170 | return ''; |
8171 | 8171 | } elseif ($end < 0) { |
8172 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
8172 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
8173 | 8173 | } else { |
8174 | 8174 | $length = $end - $start; |
8175 | 8175 | } |
@@ -8204,7 +8204,7 @@ discard block |
||
8204 | 8204 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8205 | 8205 | } |
8206 | 8206 | |
8207 | - $str = (string) \preg_replace_callback( |
|
8207 | + $str = (string)\preg_replace_callback( |
|
8208 | 8208 | '/([\\p{N}|\\p{Lu}])/u', |
8209 | 8209 | /** |
8210 | 8210 | * @param string[] $matches |
@@ -8213,28 +8213,28 @@ discard block |
||
8213 | 8213 | * |
8214 | 8214 | * @return string |
8215 | 8215 | */ |
8216 | - static function (array $matches) use ($encoding): string { |
|
8216 | + static function(array $matches) use ($encoding): string { |
|
8217 | 8217 | $match = $matches[1]; |
8218 | - $match_int = (int) $match; |
|
8218 | + $match_int = (int)$match; |
|
8219 | 8219 | |
8220 | - if ((string) $match_int === $match) { |
|
8221 | - return '_' . $match . '_'; |
|
8220 | + if ((string)$match_int === $match) { |
|
8221 | + return '_'.$match.'_'; |
|
8222 | 8222 | } |
8223 | 8223 | |
8224 | 8224 | if ($encoding === 'UTF-8') { |
8225 | - return '_' . \mb_strtolower($match); |
|
8225 | + return '_'.\mb_strtolower($match); |
|
8226 | 8226 | } |
8227 | 8227 | |
8228 | - return '_' . self::strtolower($match, $encoding); |
|
8228 | + return '_'.self::strtolower($match, $encoding); |
|
8229 | 8229 | }, |
8230 | 8230 | $str |
8231 | 8231 | ); |
8232 | 8232 | |
8233 | - $str = (string) \preg_replace( |
|
8233 | + $str = (string)\preg_replace( |
|
8234 | 8234 | [ |
8235 | - '/\\s+/u', // convert spaces to "_" |
|
8235 | + '/\\s+/u', // convert spaces to "_" |
|
8236 | 8236 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
8237 | - '/_+/', // remove double "_" |
|
8237 | + '/_+/', // remove double "_" |
|
8238 | 8238 | ], |
8239 | 8239 | [ |
8240 | 8240 | '_', |
@@ -8365,7 +8365,7 @@ discard block |
||
8365 | 8365 | } |
8366 | 8366 | |
8367 | 8367 | // init |
8368 | - $input = (string) $input; |
|
8368 | + $input = (string)$input; |
|
8369 | 8369 | |
8370 | 8370 | if ($input === '') { |
8371 | 8371 | return []; |
@@ -8422,7 +8422,7 @@ discard block |
||
8422 | 8422 | ($input[$i] & "\xE0") === "\xC0" |
8423 | 8423 | ) { |
8424 | 8424 | if (($input[$i + 1] & "\xC0") === "\x80") { |
8425 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
8425 | + $ret[] = $input[$i].$input[$i + 1]; |
|
8426 | 8426 | |
8427 | 8427 | ++$i; |
8428 | 8428 | } |
@@ -8436,7 +8436,7 @@ discard block |
||
8436 | 8436 | && |
8437 | 8437 | ($input[$i + 2] & "\xC0") === "\x80" |
8438 | 8438 | ) { |
8439 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
8439 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
8440 | 8440 | |
8441 | 8441 | $i += 2; |
8442 | 8442 | } |
@@ -8452,7 +8452,7 @@ discard block |
||
8452 | 8452 | && |
8453 | 8453 | ($input[$i + 3] & "\xC0") === "\x80" |
8454 | 8454 | ) { |
8455 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
8455 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
8456 | 8456 | |
8457 | 8457 | $i += 3; |
8458 | 8458 | } |
@@ -8464,7 +8464,7 @@ discard block |
||
8464 | 8464 | $ret = \array_chunk($ret, $length); |
8465 | 8465 | |
8466 | 8466 | return \array_map( |
8467 | - static function (array $item): string { |
|
8467 | + static function(array $item): string { |
|
8468 | 8468 | return \implode('', $item); |
8469 | 8469 | }, |
8470 | 8470 | $ret |
@@ -8530,7 +8530,7 @@ discard block |
||
8530 | 8530 | $limit = -1; |
8531 | 8531 | } |
8532 | 8532 | |
8533 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
8533 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
8534 | 8534 | |
8535 | 8535 | if ($array === false) { |
8536 | 8536 | return []; |
@@ -8626,9 +8626,9 @@ discard block |
||
8626 | 8626 | return ''; |
8627 | 8627 | } |
8628 | 8628 | |
8629 | - return (string) \mb_substr( |
|
8629 | + return (string)\mb_substr( |
|
8630 | 8630 | $str, |
8631 | - $offset + (int) \mb_strlen($separator) |
|
8631 | + $offset + (int)\mb_strlen($separator) |
|
8632 | 8632 | ); |
8633 | 8633 | } |
8634 | 8634 | |
@@ -8637,9 +8637,9 @@ discard block |
||
8637 | 8637 | return ''; |
8638 | 8638 | } |
8639 | 8639 | |
8640 | - return (string) \mb_substr( |
|
8640 | + return (string)\mb_substr( |
|
8641 | 8641 | $str, |
8642 | - $offset + (int) self::strlen($separator, $encoding), |
|
8642 | + $offset + (int)self::strlen($separator, $encoding), |
|
8643 | 8643 | null, |
8644 | 8644 | $encoding |
8645 | 8645 | ); |
@@ -8671,9 +8671,9 @@ discard block |
||
8671 | 8671 | return ''; |
8672 | 8672 | } |
8673 | 8673 | |
8674 | - return (string) \mb_substr( |
|
8674 | + return (string)\mb_substr( |
|
8675 | 8675 | $str, |
8676 | - $offset + (int) \mb_strlen($separator) |
|
8676 | + $offset + (int)\mb_strlen($separator) |
|
8677 | 8677 | ); |
8678 | 8678 | } |
8679 | 8679 | |
@@ -8682,9 +8682,9 @@ discard block |
||
8682 | 8682 | return ''; |
8683 | 8683 | } |
8684 | 8684 | |
8685 | - return (string) self::substr( |
|
8685 | + return (string)self::substr( |
|
8686 | 8686 | $str, |
8687 | - $offset + (int) self::strlen($separator, $encoding), |
|
8687 | + $offset + (int)self::strlen($separator, $encoding), |
|
8688 | 8688 | null, |
8689 | 8689 | $encoding |
8690 | 8690 | ); |
@@ -8716,7 +8716,7 @@ discard block |
||
8716 | 8716 | return ''; |
8717 | 8717 | } |
8718 | 8718 | |
8719 | - return (string) \mb_substr( |
|
8719 | + return (string)\mb_substr( |
|
8720 | 8720 | $str, |
8721 | 8721 | 0, |
8722 | 8722 | $offset |
@@ -8728,7 +8728,7 @@ discard block |
||
8728 | 8728 | return ''; |
8729 | 8729 | } |
8730 | 8730 | |
8731 | - return (string) self::substr( |
|
8731 | + return (string)self::substr( |
|
8732 | 8732 | $str, |
8733 | 8733 | 0, |
8734 | 8734 | $offset, |
@@ -8759,7 +8759,7 @@ discard block |
||
8759 | 8759 | return ''; |
8760 | 8760 | } |
8761 | 8761 | |
8762 | - return (string) \mb_substr( |
|
8762 | + return (string)\mb_substr( |
|
8763 | 8763 | $str, |
8764 | 8764 | 0, |
8765 | 8765 | $offset |
@@ -8773,7 +8773,7 @@ discard block |
||
8773 | 8773 | |
8774 | 8774 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8775 | 8775 | |
8776 | - return (string) self::substr( |
|
8776 | + return (string)self::substr( |
|
8777 | 8777 | $str, |
8778 | 8778 | 0, |
8779 | 8779 | $offset, |
@@ -8888,7 +8888,7 @@ discard block |
||
8888 | 8888 | */ |
8889 | 8889 | public static function str_surround(string $str, string $substring): string |
8890 | 8890 | { |
8891 | - return $substring . $str . $substring; |
|
8891 | + return $substring.$str.$substring; |
|
8892 | 8892 | } |
8893 | 8893 | |
8894 | 8894 | /** |
@@ -8952,9 +8952,9 @@ discard block |
||
8952 | 8952 | $word_define_chars = ''; |
8953 | 8953 | } |
8954 | 8954 | |
8955 | - $str = (string) \preg_replace_callback( |
|
8956 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
8957 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8955 | + $str = (string)\preg_replace_callback( |
|
8956 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
8957 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8958 | 8958 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
8959 | 8959 | return $match[0]; |
8960 | 8960 | } |
@@ -9121,16 +9121,16 @@ discard block |
||
9121 | 9121 | |
9122 | 9122 | // the main substitutions |
9123 | 9123 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
9124 | - $str = (string) \preg_replace_callback( |
|
9124 | + $str = (string)\preg_replace_callback( |
|
9125 | 9125 | '~\\b (_*) (?: # 1. Leading underscore and |
9126 | 9126 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
9127 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
9127 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
9128 | 9128 | | |
9129 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
9129 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
9130 | 9130 | | |
9131 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
9131 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
9132 | 9132 | | |
9133 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
9133 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
9134 | 9134 | ) (_*) \\b # 6. With trailing underscore |
9135 | 9135 | ~ux', |
9136 | 9136 | /** |
@@ -9140,7 +9140,7 @@ discard block |
||
9140 | 9140 | * |
9141 | 9141 | * @return string |
9142 | 9142 | */ |
9143 | - static function (array $matches) use ($encoding): string { |
|
9143 | + static function(array $matches) use ($encoding): string { |
|
9144 | 9144 | // preserve leading underscore |
9145 | 9145 | $str = $matches[1]; |
9146 | 9146 | if ($matches[2]) { |
@@ -9165,11 +9165,11 @@ discard block |
||
9165 | 9165 | ); |
9166 | 9166 | |
9167 | 9167 | // Exceptions for small words: capitalize at start of title... |
9168 | - $str = (string) \preg_replace_callback( |
|
9168 | + $str = (string)\preg_replace_callback( |
|
9169 | 9169 | '~( \\A [[:punct:]]* # start of title... |
9170 | 9170 | | [:.;?!][ ]+ # or of subsentence... |
9171 | 9171 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
9172 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
9172 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
9173 | 9173 | ~uxi', |
9174 | 9174 | /** |
9175 | 9175 | * @param string[] $matches |
@@ -9178,15 +9178,15 @@ discard block |
||
9178 | 9178 | * |
9179 | 9179 | * @return string |
9180 | 9180 | */ |
9181 | - static function (array $matches) use ($encoding): string { |
|
9182 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
9181 | + static function(array $matches) use ($encoding): string { |
|
9182 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
9183 | 9183 | }, |
9184 | 9184 | $str |
9185 | 9185 | ); |
9186 | 9186 | |
9187 | 9187 | // ...and end of title |
9188 | - $str = (string) \preg_replace_callback( |
|
9189 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
9188 | + $str = (string)\preg_replace_callback( |
|
9189 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
9190 | 9190 | (?= [[:punct:]]* \Z # ...at the end of the title... |
9191 | 9191 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
9192 | 9192 | ~uxi', |
@@ -9197,7 +9197,7 @@ discard block |
||
9197 | 9197 | * |
9198 | 9198 | * @return string |
9199 | 9199 | */ |
9200 | - static function (array $matches) use ($encoding): string { |
|
9200 | + static function(array $matches) use ($encoding): string { |
|
9201 | 9201 | return static::ucfirst($matches[1], $encoding); |
9202 | 9202 | }, |
9203 | 9203 | $str |
@@ -9205,10 +9205,10 @@ discard block |
||
9205 | 9205 | |
9206 | 9206 | // Exceptions for small words in hyphenated compound words. |
9207 | 9207 | // e.g. "in-flight" -> In-Flight |
9208 | - $str = (string) \preg_replace_callback( |
|
9208 | + $str = (string)\preg_replace_callback( |
|
9209 | 9209 | '~\\b |
9210 | 9210 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
9211 | - ( ' . $small_words_rx . ' ) |
|
9211 | + ( ' . $small_words_rx.' ) |
|
9212 | 9212 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
9213 | 9213 | ~uxi', |
9214 | 9214 | /** |
@@ -9218,18 +9218,18 @@ discard block |
||
9218 | 9218 | * |
9219 | 9219 | * @return string |
9220 | 9220 | */ |
9221 | - static function (array $matches) use ($encoding): string { |
|
9221 | + static function(array $matches) use ($encoding): string { |
|
9222 | 9222 | return static::ucfirst($matches[1], $encoding); |
9223 | 9223 | }, |
9224 | 9224 | $str |
9225 | 9225 | ); |
9226 | 9226 | |
9227 | 9227 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
9228 | - $str = (string) \preg_replace_callback( |
|
9228 | + $str = (string)\preg_replace_callback( |
|
9229 | 9229 | '~\\b |
9230 | 9230 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
9231 | 9231 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
9232 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
9232 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
9233 | 9233 | (?! - ) # Negative lookahead for another - |
9234 | 9234 | ~uxi', |
9235 | 9235 | /** |
@@ -9239,8 +9239,8 @@ discard block |
||
9239 | 9239 | * |
9240 | 9240 | * @return string |
9241 | 9241 | */ |
9242 | - static function (array $matches) use ($encoding): string { |
|
9243 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
9242 | + static function(array $matches) use ($encoding): string { |
|
9243 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
9244 | 9244 | }, |
9245 | 9245 | $str |
9246 | 9246 | ); |
@@ -9359,7 +9359,7 @@ discard block |
||
9359 | 9359 | ); |
9360 | 9360 | |
9361 | 9361 | foreach ($tmp_return as &$item) { |
9362 | - $item = (string) $item; |
|
9362 | + $item = (string)$item; |
|
9363 | 9363 | } |
9364 | 9364 | |
9365 | 9365 | return $tmp_return; |
@@ -9413,39 +9413,39 @@ discard block |
||
9413 | 9413 | } |
9414 | 9414 | |
9415 | 9415 | if ($encoding === 'UTF-8') { |
9416 | - if ($length >= (int) \mb_strlen($str)) { |
|
9416 | + if ($length >= (int)\mb_strlen($str)) { |
|
9417 | 9417 | return $str; |
9418 | 9418 | } |
9419 | 9419 | |
9420 | 9420 | if ($substring !== '') { |
9421 | - $length -= (int) \mb_strlen($substring); |
|
9421 | + $length -= (int)\mb_strlen($substring); |
|
9422 | 9422 | |
9423 | 9423 | /** @noinspection UnnecessaryCastingInspection */ |
9424 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
9424 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
9425 | 9425 | } |
9426 | 9426 | |
9427 | 9427 | /** @noinspection UnnecessaryCastingInspection */ |
9428 | - return (string) \mb_substr($str, 0, $length); |
|
9428 | + return (string)\mb_substr($str, 0, $length); |
|
9429 | 9429 | } |
9430 | 9430 | |
9431 | 9431 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9432 | 9432 | |
9433 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
9433 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
9434 | 9434 | return $str; |
9435 | 9435 | } |
9436 | 9436 | |
9437 | 9437 | if ($substring !== '') { |
9438 | - $length -= (int) self::strlen($substring, $encoding); |
|
9438 | + $length -= (int)self::strlen($substring, $encoding); |
|
9439 | 9439 | } |
9440 | 9440 | |
9441 | 9441 | return ( |
9442 | - (string) self::substr( |
|
9442 | + (string)self::substr( |
|
9443 | 9443 | $str, |
9444 | 9444 | 0, |
9445 | 9445 | $length, |
9446 | 9446 | $encoding |
9447 | 9447 | ) |
9448 | - ) . $substring; |
|
9448 | + ).$substring; |
|
9449 | 9449 | } |
9450 | 9450 | |
9451 | 9451 | /** |
@@ -9479,12 +9479,12 @@ discard block |
||
9479 | 9479 | } |
9480 | 9480 | |
9481 | 9481 | if ($encoding === 'UTF-8') { |
9482 | - if ($length >= (int) \mb_strlen($str)) { |
|
9482 | + if ($length >= (int)\mb_strlen($str)) { |
|
9483 | 9483 | return $str; |
9484 | 9484 | } |
9485 | 9485 | |
9486 | 9486 | // need to further trim the string so we can append the substring |
9487 | - $length -= (int) \mb_strlen($substring); |
|
9487 | + $length -= (int)\mb_strlen($substring); |
|
9488 | 9488 | if ($length <= 0) { |
9489 | 9489 | return $substring; |
9490 | 9490 | } |
@@ -9510,18 +9510,18 @@ discard block |
||
9510 | 9510 | !$ignore_do_not_split_words_for_one_word |
9511 | 9511 | ) |
9512 | 9512 | ) { |
9513 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
9513 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
9514 | 9514 | } |
9515 | 9515 | } |
9516 | 9516 | } else { |
9517 | 9517 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9518 | 9518 | |
9519 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
9519 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
9520 | 9520 | return $str; |
9521 | 9521 | } |
9522 | 9522 | |
9523 | 9523 | // need to further trim the string so we can append the substring |
9524 | - $length -= (int) self::strlen($substring, $encoding); |
|
9524 | + $length -= (int)self::strlen($substring, $encoding); |
|
9525 | 9525 | if ($length <= 0) { |
9526 | 9526 | return $substring; |
9527 | 9527 | } |
@@ -9547,12 +9547,12 @@ discard block |
||
9547 | 9547 | !$ignore_do_not_split_words_for_one_word |
9548 | 9548 | ) |
9549 | 9549 | ) { |
9550 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
9550 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
9551 | 9551 | } |
9552 | 9552 | } |
9553 | 9553 | } |
9554 | 9554 | |
9555 | - return $truncated . $substring; |
|
9555 | + return $truncated.$substring; |
|
9556 | 9556 | } |
9557 | 9557 | |
9558 | 9558 | /** |
@@ -9679,13 +9679,13 @@ discard block |
||
9679 | 9679 | } |
9680 | 9680 | } elseif ($format === 2) { |
9681 | 9681 | $number_of_words = []; |
9682 | - $offset = (int) self::strlen($str_parts[0]); |
|
9682 | + $offset = (int)self::strlen($str_parts[0]); |
|
9683 | 9683 | for ($i = 1; $i < $len; $i += 2) { |
9684 | 9684 | $number_of_words[$offset] = $str_parts[$i]; |
9685 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
9685 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
9686 | 9686 | } |
9687 | 9687 | } else { |
9688 | - $number_of_words = (int) (($len - 1) / 2); |
|
9688 | + $number_of_words = (int)(($len - 1) / 2); |
|
9689 | 9689 | } |
9690 | 9690 | |
9691 | 9691 | return $number_of_words; |
@@ -9818,7 +9818,7 @@ discard block |
||
9818 | 9818 | } |
9819 | 9819 | |
9820 | 9820 | if ($char_list === '') { |
9821 | - return (int) self::strlen($str, $encoding); |
|
9821 | + return (int)self::strlen($str, $encoding); |
|
9822 | 9822 | } |
9823 | 9823 | |
9824 | 9824 | if ($offset || $length !== null) { |
@@ -9845,7 +9845,7 @@ discard block |
||
9845 | 9845 | } |
9846 | 9846 | |
9847 | 9847 | $matches = []; |
9848 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
9848 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
9849 | 9849 | $return = self::strlen($matches[1], $encoding); |
9850 | 9850 | if ($return === false) { |
9851 | 9851 | return 0; |
@@ -9854,7 +9854,7 @@ discard block |
||
9854 | 9854 | return $return; |
9855 | 9855 | } |
9856 | 9856 | |
9857 | - return (int) self::strlen($str, $encoding); |
|
9857 | + return (int)self::strlen($str, $encoding); |
|
9858 | 9858 | } |
9859 | 9859 | |
9860 | 9860 | /** |
@@ -9917,7 +9917,7 @@ discard block |
||
9917 | 9917 | |
9918 | 9918 | $str = ''; |
9919 | 9919 | foreach ($intOrHex as $strPart) { |
9920 | - $str .= '&#' . (int) $strPart . ';'; |
|
9920 | + $str .= '&#'.(int)$strPart.';'; |
|
9921 | 9921 | } |
9922 | 9922 | |
9923 | 9923 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -10014,7 +10014,7 @@ discard block |
||
10014 | 10014 | return ''; |
10015 | 10015 | } |
10016 | 10016 | |
10017 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
10017 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
10018 | 10018 | } |
10019 | 10019 | |
10020 | 10020 | /** |
@@ -10093,7 +10093,7 @@ discard block |
||
10093 | 10093 | // fallback for ascii only |
10094 | 10094 | // |
10095 | 10095 | |
10096 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10096 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10097 | 10097 | return \stripos($haystack, $needle, $offset); |
10098 | 10098 | } |
10099 | 10099 | |
@@ -10182,7 +10182,7 @@ discard block |
||
10182 | 10182 | /** |
10183 | 10183 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10184 | 10184 | */ |
10185 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10185 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10186 | 10186 | } |
10187 | 10187 | |
10188 | 10188 | if ( |
@@ -10196,11 +10196,11 @@ discard block |
||
10196 | 10196 | } |
10197 | 10197 | } |
10198 | 10198 | |
10199 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
10199 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
10200 | 10200 | return \stristr($haystack, $needle, $before_needle); |
10201 | 10201 | } |
10202 | 10202 | |
10203 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
10203 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
10204 | 10204 | |
10205 | 10205 | if (!isset($match[1])) { |
10206 | 10206 | return false; |
@@ -10210,7 +10210,7 @@ discard block |
||
10210 | 10210 | return $match[1]; |
10211 | 10211 | } |
10212 | 10212 | |
10213 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
10213 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
10214 | 10214 | } |
10215 | 10215 | |
10216 | 10216 | /** |
@@ -10293,7 +10293,7 @@ discard block |
||
10293 | 10293 | /** |
10294 | 10294 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10295 | 10295 | */ |
10296 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10296 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10297 | 10297 | } |
10298 | 10298 | |
10299 | 10299 | // |
@@ -10431,8 +10431,8 @@ discard block |
||
10431 | 10431 | } |
10432 | 10432 | |
10433 | 10433 | return \strnatcmp( |
10434 | - (string) self::strtonatfold($str1), |
|
10435 | - (string) self::strtonatfold($str2) |
|
10434 | + (string)self::strtonatfold($str1), |
|
10435 | + (string)self::strtonatfold($str2) |
|
10436 | 10436 | ); |
10437 | 10437 | } |
10438 | 10438 | |
@@ -10502,11 +10502,11 @@ discard block |
||
10502 | 10502 | } |
10503 | 10503 | |
10504 | 10504 | if ($encoding === 'UTF-8') { |
10505 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
10506 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
10505 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
10506 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
10507 | 10507 | } else { |
10508 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
10509 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
10508 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
10509 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
10510 | 10510 | } |
10511 | 10511 | |
10512 | 10512 | return self::strcmp($str1, $str2); |
@@ -10533,8 +10533,8 @@ discard block |
||
10533 | 10533 | return false; |
10534 | 10534 | } |
10535 | 10535 | |
10536 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
10537 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
10536 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
10537 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
10538 | 10538 | } |
10539 | 10539 | |
10540 | 10540 | return false; |
@@ -10579,10 +10579,10 @@ discard block |
||
10579 | 10579 | } |
10580 | 10580 | |
10581 | 10581 | // iconv and mbstring do not support integer $needle |
10582 | - if ((int) $needle === $needle) { |
|
10583 | - $needle = (string) self::chr($needle); |
|
10582 | + if ((int)$needle === $needle) { |
|
10583 | + $needle = (string)self::chr($needle); |
|
10584 | 10584 | } |
10585 | - $needle = (string) $needle; |
|
10585 | + $needle = (string)$needle; |
|
10586 | 10586 | |
10587 | 10587 | if ($haystack === '') { |
10588 | 10588 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -10642,7 +10642,7 @@ discard block |
||
10642 | 10642 | /** |
10643 | 10643 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10644 | 10644 | */ |
10645 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10645 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10646 | 10646 | } |
10647 | 10647 | |
10648 | 10648 | // |
@@ -10683,7 +10683,7 @@ discard block |
||
10683 | 10683 | // fallback for ascii only |
10684 | 10684 | // |
10685 | 10685 | |
10686 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10686 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10687 | 10687 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
10688 | 10688 | return @\strpos($haystack, $needle, $offset); |
10689 | 10689 | } |
@@ -10696,7 +10696,7 @@ discard block |
||
10696 | 10696 | if ($haystack_tmp === false) { |
10697 | 10697 | $haystack_tmp = ''; |
10698 | 10698 | } |
10699 | - $haystack = (string) $haystack_tmp; |
|
10699 | + $haystack = (string)$haystack_tmp; |
|
10700 | 10700 | |
10701 | 10701 | if ($offset < 0) { |
10702 | 10702 | $offset = 0; |
@@ -10708,7 +10708,7 @@ discard block |
||
10708 | 10708 | } |
10709 | 10709 | |
10710 | 10710 | if ($pos) { |
10711 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10711 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10712 | 10712 | } |
10713 | 10713 | |
10714 | 10714 | return $offset + 0; |
@@ -10863,7 +10863,7 @@ discard block |
||
10863 | 10863 | /** |
10864 | 10864 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10865 | 10865 | */ |
10866 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10866 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10867 | 10867 | } |
10868 | 10868 | |
10869 | 10869 | // |
@@ -10875,7 +10875,7 @@ discard block |
||
10875 | 10875 | if ($needle_tmp === false) { |
10876 | 10876 | return false; |
10877 | 10877 | } |
10878 | - $needle = (string) $needle_tmp; |
|
10878 | + $needle = (string)$needle_tmp; |
|
10879 | 10879 | |
10880 | 10880 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
10881 | 10881 | if ($pos === false) { |
@@ -10897,7 +10897,7 @@ discard block |
||
10897 | 10897 | if ($needle_tmp === false) { |
10898 | 10898 | return false; |
10899 | 10899 | } |
10900 | - $needle = (string) $needle_tmp; |
|
10900 | + $needle = (string)$needle_tmp; |
|
10901 | 10901 | |
10902 | 10902 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
10903 | 10903 | if ($pos === false) { |
@@ -10938,7 +10938,7 @@ discard block |
||
10938 | 10938 | if ($encoding === 'UTF-8') { |
10939 | 10939 | if (self::$SUPPORT['intl'] === true) { |
10940 | 10940 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
10941 | - $i = (int) \grapheme_strlen($str); |
|
10941 | + $i = (int)\grapheme_strlen($str); |
|
10942 | 10942 | while ($i--) { |
10943 | 10943 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
10944 | 10944 | if ($reversed_tmp !== false) { |
@@ -10946,7 +10946,7 @@ discard block |
||
10946 | 10946 | } |
10947 | 10947 | } |
10948 | 10948 | } else { |
10949 | - $i = (int) \mb_strlen($str); |
|
10949 | + $i = (int)\mb_strlen($str); |
|
10950 | 10950 | while ($i--) { |
10951 | 10951 | $reversed_tmp = \mb_substr($str, $i, 1); |
10952 | 10952 | if ($reversed_tmp !== false) { |
@@ -10957,7 +10957,7 @@ discard block |
||
10957 | 10957 | } else { |
10958 | 10958 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10959 | 10959 | |
10960 | - $i = (int) self::strlen($str, $encoding); |
|
10960 | + $i = (int)self::strlen($str, $encoding); |
|
10961 | 10961 | while ($i--) { |
10962 | 10962 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
10963 | 10963 | if ($reversed_tmp !== false) { |
@@ -11036,7 +11036,7 @@ discard block |
||
11036 | 11036 | if ($needle_tmp === false) { |
11037 | 11037 | return false; |
11038 | 11038 | } |
11039 | - $needle = (string) $needle_tmp; |
|
11039 | + $needle = (string)$needle_tmp; |
|
11040 | 11040 | |
11041 | 11041 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
11042 | 11042 | if ($pos === false) { |
@@ -11085,10 +11085,10 @@ discard block |
||
11085 | 11085 | } |
11086 | 11086 | |
11087 | 11087 | // iconv and mbstring do not support integer $needle |
11088 | - if ((int) $needle === $needle && $needle >= 0) { |
|
11089 | - $needle = (string) self::chr($needle); |
|
11088 | + if ((int)$needle === $needle && $needle >= 0) { |
|
11089 | + $needle = (string)self::chr($needle); |
|
11090 | 11090 | } |
11091 | - $needle = (string) $needle; |
|
11091 | + $needle = (string)$needle; |
|
11092 | 11092 | |
11093 | 11093 | if ($haystack === '') { |
11094 | 11094 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -11144,7 +11144,7 @@ discard block |
||
11144 | 11144 | /** |
11145 | 11145 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11146 | 11146 | */ |
11147 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11147 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11148 | 11148 | } |
11149 | 11149 | |
11150 | 11150 | // |
@@ -11168,7 +11168,7 @@ discard block |
||
11168 | 11168 | // fallback for ascii only |
11169 | 11169 | // |
11170 | 11170 | |
11171 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11171 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11172 | 11172 | return \strripos($haystack, $needle, $offset); |
11173 | 11173 | } |
11174 | 11174 | |
@@ -11257,10 +11257,10 @@ discard block |
||
11257 | 11257 | } |
11258 | 11258 | |
11259 | 11259 | // iconv and mbstring do not support integer $needle |
11260 | - if ((int) $needle === $needle && $needle >= 0) { |
|
11261 | - $needle = (string) self::chr($needle); |
|
11260 | + if ((int)$needle === $needle && $needle >= 0) { |
|
11261 | + $needle = (string)self::chr($needle); |
|
11262 | 11262 | } |
11263 | - $needle = (string) $needle; |
|
11263 | + $needle = (string)$needle; |
|
11264 | 11264 | |
11265 | 11265 | if ($haystack === '') { |
11266 | 11266 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -11316,7 +11316,7 @@ discard block |
||
11316 | 11316 | /** |
11317 | 11317 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11318 | 11318 | */ |
11319 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11319 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11320 | 11320 | } |
11321 | 11321 | |
11322 | 11322 | // |
@@ -11340,7 +11340,7 @@ discard block |
||
11340 | 11340 | // fallback for ascii only |
11341 | 11341 | // |
11342 | 11342 | |
11343 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11343 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11344 | 11344 | return \strrpos($haystack, $needle, $offset); |
11345 | 11345 | } |
11346 | 11346 | |
@@ -11360,7 +11360,7 @@ discard block |
||
11360 | 11360 | if ($haystack_tmp === false) { |
11361 | 11361 | $haystack_tmp = ''; |
11362 | 11362 | } |
11363 | - $haystack = (string) $haystack_tmp; |
|
11363 | + $haystack = (string)$haystack_tmp; |
|
11364 | 11364 | } |
11365 | 11365 | |
11366 | 11366 | $pos = \strrpos($haystack, $needle); |
@@ -11374,7 +11374,7 @@ discard block |
||
11374 | 11374 | return false; |
11375 | 11375 | } |
11376 | 11376 | |
11377 | - return $offset + (int) self::strlen($str_tmp); |
|
11377 | + return $offset + (int)self::strlen($str_tmp); |
|
11378 | 11378 | } |
11379 | 11379 | |
11380 | 11380 | /** |
@@ -11442,12 +11442,12 @@ discard block |
||
11442 | 11442 | if ($offset || $length !== null) { |
11443 | 11443 | if ($encoding === 'UTF-8') { |
11444 | 11444 | if ($length === null) { |
11445 | - $str = (string) \mb_substr($str, $offset); |
|
11445 | + $str = (string)\mb_substr($str, $offset); |
|
11446 | 11446 | } else { |
11447 | - $str = (string) \mb_substr($str, $offset, $length); |
|
11447 | + $str = (string)\mb_substr($str, $offset, $length); |
|
11448 | 11448 | } |
11449 | 11449 | } else { |
11450 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
11450 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
11451 | 11451 | } |
11452 | 11452 | } |
11453 | 11453 | |
@@ -11457,7 +11457,7 @@ discard block |
||
11457 | 11457 | |
11458 | 11458 | $matches = []; |
11459 | 11459 | |
11460 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
11460 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
11461 | 11461 | } |
11462 | 11462 | |
11463 | 11463 | /** |
@@ -11551,7 +11551,7 @@ discard block |
||
11551 | 11551 | /** |
11552 | 11552 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11553 | 11553 | */ |
11554 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11554 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11555 | 11555 | } |
11556 | 11556 | |
11557 | 11557 | // |
@@ -11573,7 +11573,7 @@ discard block |
||
11573 | 11573 | // fallback for ascii only |
11574 | 11574 | // |
11575 | 11575 | |
11576 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11576 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11577 | 11577 | return \strstr($haystack, $needle, $before_needle); |
11578 | 11578 | } |
11579 | 11579 | |
@@ -11581,7 +11581,7 @@ discard block |
||
11581 | 11581 | // fallback via vanilla php |
11582 | 11582 | // |
11583 | 11583 | |
11584 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
11584 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
11585 | 11585 | |
11586 | 11586 | if (!isset($match[1])) { |
11587 | 11587 | return false; |
@@ -11591,7 +11591,7 @@ discard block |
||
11591 | 11591 | return $match[1]; |
11592 | 11592 | } |
11593 | 11593 | |
11594 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
11594 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
11595 | 11595 | } |
11596 | 11596 | |
11597 | 11597 | /** |
@@ -11721,7 +11721,7 @@ discard block |
||
11721 | 11721 | bool $try_to_keep_the_string_length = false |
11722 | 11722 | ): string { |
11723 | 11723 | // init |
11724 | - $str = (string) $str; |
|
11724 | + $str = (string)$str; |
|
11725 | 11725 | |
11726 | 11726 | if ($str === '') { |
11727 | 11727 | return ''; |
@@ -11750,25 +11750,25 @@ discard block |
||
11750 | 11750 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11751 | 11751 | } |
11752 | 11752 | |
11753 | - $language_code = $lang . '-Lower'; |
|
11753 | + $language_code = $lang.'-Lower'; |
|
11754 | 11754 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11755 | 11755 | /** |
11756 | 11756 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11757 | 11757 | */ |
11758 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11758 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11759 | 11759 | |
11760 | 11760 | $language_code = 'Any-Lower'; |
11761 | 11761 | } |
11762 | 11762 | |
11763 | 11763 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11764 | 11764 | /** @noinspection UnnecessaryCastingInspection */ |
11765 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11765 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11766 | 11766 | } |
11767 | 11767 | |
11768 | 11768 | /** |
11769 | 11769 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11770 | 11770 | */ |
11771 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
11771 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
11772 | 11772 | } |
11773 | 11773 | |
11774 | 11774 | // always fallback via symfony polyfill |
@@ -11803,7 +11803,7 @@ discard block |
||
11803 | 11803 | bool $try_to_keep_the_string_length = false |
11804 | 11804 | ): string { |
11805 | 11805 | // init |
11806 | - $str = (string) $str; |
|
11806 | + $str = (string)$str; |
|
11807 | 11807 | |
11808 | 11808 | if ($str === '') { |
11809 | 11809 | return ''; |
@@ -11832,25 +11832,25 @@ discard block |
||
11832 | 11832 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11833 | 11833 | } |
11834 | 11834 | |
11835 | - $language_code = $lang . '-Upper'; |
|
11835 | + $language_code = $lang.'-Upper'; |
|
11836 | 11836 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11837 | 11837 | /** |
11838 | 11838 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11839 | 11839 | */ |
11840 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
11840 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
11841 | 11841 | |
11842 | 11842 | $language_code = 'Any-Upper'; |
11843 | 11843 | } |
11844 | 11844 | |
11845 | 11845 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11846 | 11846 | /** @noinspection UnnecessaryCastingInspection */ |
11847 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11847 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11848 | 11848 | } |
11849 | 11849 | |
11850 | 11850 | /** |
11851 | 11851 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11852 | 11852 | */ |
11853 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
11853 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
11854 | 11854 | } |
11855 | 11855 | |
11856 | 11856 | // always fallback via symfony polyfill |
@@ -11914,7 +11914,7 @@ discard block |
||
11914 | 11914 | $from = \array_combine($from, $to); |
11915 | 11915 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
11916 | 11916 | if ($from === false) { |
11917 | - 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) . ')'); |
|
11917 | + 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).')'); |
|
11918 | 11918 | } |
11919 | 11919 | } |
11920 | 11920 | |
@@ -11980,9 +11980,9 @@ discard block |
||
11980 | 11980 | } |
11981 | 11981 | |
11982 | 11982 | $wide = 0; |
11983 | - $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); |
|
11983 | + $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); |
|
11984 | 11984 | |
11985 | - return ($wide << 1) + (int) self::strlen($str); |
|
11985 | + return ($wide << 1) + (int)self::strlen($str); |
|
11986 | 11986 | } |
11987 | 11987 | |
11988 | 11988 | /** |
@@ -12081,7 +12081,7 @@ discard block |
||
12081 | 12081 | return ''; |
12082 | 12082 | } |
12083 | 12083 | |
12084 | - $length = $length ?? (int) $str_length; |
|
12084 | + $length = $length ?? (int)$str_length; |
|
12085 | 12085 | |
12086 | 12086 | if ( |
12087 | 12087 | $encoding !== 'UTF-8' |
@@ -12091,7 +12091,7 @@ discard block |
||
12091 | 12091 | /** |
12092 | 12092 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
12093 | 12093 | */ |
12094 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
12094 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
12095 | 12095 | } |
12096 | 12096 | |
12097 | 12097 | // |
@@ -12187,16 +12187,16 @@ discard block |
||
12187 | 12187 | ) { |
12188 | 12188 | if ($encoding === 'UTF-8') { |
12189 | 12189 | if ($length === null) { |
12190 | - $str1 = (string) \mb_substr($str1, $offset); |
|
12190 | + $str1 = (string)\mb_substr($str1, $offset); |
|
12191 | 12191 | } else { |
12192 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
12192 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
12193 | 12193 | } |
12194 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
12194 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
12195 | 12195 | } else { |
12196 | 12196 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12197 | 12197 | |
12198 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
12199 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
12198 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
12199 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
12200 | 12200 | } |
12201 | 12201 | } |
12202 | 12202 | |
@@ -12271,13 +12271,13 @@ discard block |
||
12271 | 12271 | if ($length_tmp === false) { |
12272 | 12272 | return false; |
12273 | 12273 | } |
12274 | - $length = (int) $length_tmp; |
|
12274 | + $length = (int)$length_tmp; |
|
12275 | 12275 | } |
12276 | 12276 | |
12277 | 12277 | if ($encoding === 'UTF-8') { |
12278 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
12278 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
12279 | 12279 | } else { |
12280 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
12280 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
12281 | 12281 | } |
12282 | 12282 | } |
12283 | 12283 | |
@@ -12289,7 +12289,7 @@ discard block |
||
12289 | 12289 | /** |
12290 | 12290 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
12291 | 12291 | */ |
12292 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
12292 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
12293 | 12293 | } |
12294 | 12294 | |
12295 | 12295 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -12300,7 +12300,7 @@ discard block |
||
12300 | 12300 | return \mb_substr_count($haystack, $needle, $encoding); |
12301 | 12301 | } |
12302 | 12302 | |
12303 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
12303 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
12304 | 12304 | |
12305 | 12305 | return \count($matches); |
12306 | 12306 | } |
@@ -12350,7 +12350,7 @@ discard block |
||
12350 | 12350 | if ($length_tmp === false) { |
12351 | 12351 | return false; |
12352 | 12352 | } |
12353 | - $length = (int) $length_tmp; |
|
12353 | + $length = (int)$length_tmp; |
|
12354 | 12354 | } |
12355 | 12355 | |
12356 | 12356 | if ( |
@@ -12372,7 +12372,7 @@ discard block |
||
12372 | 12372 | if ($haystack_tmp === false) { |
12373 | 12373 | $haystack_tmp = ''; |
12374 | 12374 | } |
12375 | - $haystack = (string) $haystack_tmp; |
|
12375 | + $haystack = (string)$haystack_tmp; |
|
12376 | 12376 | } |
12377 | 12377 | |
12378 | 12378 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -12413,10 +12413,10 @@ discard block |
||
12413 | 12413 | |
12414 | 12414 | if ($encoding === 'UTF-8') { |
12415 | 12415 | if ($case_sensitive) { |
12416 | - return (int) \mb_substr_count($str, $substring); |
|
12416 | + return (int)\mb_substr_count($str, $substring); |
|
12417 | 12417 | } |
12418 | 12418 | |
12419 | - return (int) \mb_substr_count( |
|
12419 | + return (int)\mb_substr_count( |
|
12420 | 12420 | \mb_strtoupper($str), |
12421 | 12421 | \mb_strtoupper($substring) |
12422 | 12422 | ); |
@@ -12425,10 +12425,10 @@ discard block |
||
12425 | 12425 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12426 | 12426 | |
12427 | 12427 | if ($case_sensitive) { |
12428 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
12428 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
12429 | 12429 | } |
12430 | 12430 | |
12431 | - return (int) \mb_substr_count( |
|
12431 | + return (int)\mb_substr_count( |
|
12432 | 12432 | self::strtocasefold($str, true, false, $encoding, null, false), |
12433 | 12433 | self::strtocasefold($substring, true, false, $encoding, null, false), |
12434 | 12434 | $encoding |
@@ -12462,7 +12462,7 @@ discard block |
||
12462 | 12462 | } |
12463 | 12463 | |
12464 | 12464 | if (self::str_istarts_with($haystack, $needle)) { |
12465 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
12465 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
12466 | 12466 | } |
12467 | 12467 | |
12468 | 12468 | return $haystack; |
@@ -12529,7 +12529,7 @@ discard block |
||
12529 | 12529 | } |
12530 | 12530 | |
12531 | 12531 | if (self::str_iends_with($haystack, $needle)) { |
12532 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
12532 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
12533 | 12533 | } |
12534 | 12534 | |
12535 | 12535 | return $haystack; |
@@ -12562,7 +12562,7 @@ discard block |
||
12562 | 12562 | } |
12563 | 12563 | |
12564 | 12564 | if (self::str_starts_with($haystack, $needle)) { |
12565 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
12565 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
12566 | 12566 | } |
12567 | 12567 | |
12568 | 12568 | return $haystack; |
@@ -12619,7 +12619,7 @@ discard block |
||
12619 | 12619 | if (\is_array($offset)) { |
12620 | 12620 | $offset = \array_slice($offset, 0, $num); |
12621 | 12621 | foreach ($offset as &$value_tmp) { |
12622 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
12622 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
12623 | 12623 | } |
12624 | 12624 | unset($value_tmp); |
12625 | 12625 | } else { |
@@ -12632,7 +12632,7 @@ discard block |
||
12632 | 12632 | } elseif (\is_array($length)) { |
12633 | 12633 | $length = \array_slice($length, 0, $num); |
12634 | 12634 | foreach ($length as &$value_tmp_V2) { |
12635 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
12635 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
12636 | 12636 | } |
12637 | 12637 | unset($value_tmp_V2); |
12638 | 12638 | } else { |
@@ -12652,8 +12652,8 @@ discard block |
||
12652 | 12652 | } |
12653 | 12653 | |
12654 | 12654 | // init |
12655 | - $str = (string) $str; |
|
12656 | - $replacement = (string) $replacement; |
|
12655 | + $str = (string)$str; |
|
12656 | + $replacement = (string)$replacement; |
|
12657 | 12657 | |
12658 | 12658 | if (\is_array($length)) { |
12659 | 12659 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -12668,16 +12668,16 @@ discard block |
||
12668 | 12668 | } |
12669 | 12669 | |
12670 | 12670 | if (self::$SUPPORT['mbstring'] === true) { |
12671 | - $string_length = (int) self::strlen($str, $encoding); |
|
12671 | + $string_length = (int)self::strlen($str, $encoding); |
|
12672 | 12672 | |
12673 | 12673 | if ($offset < 0) { |
12674 | - $offset = (int) \max(0, $string_length + $offset); |
|
12674 | + $offset = (int)\max(0, $string_length + $offset); |
|
12675 | 12675 | } elseif ($offset > $string_length) { |
12676 | 12676 | $offset = $string_length; |
12677 | 12677 | } |
12678 | 12678 | |
12679 | 12679 | if ($length !== null && $length < 0) { |
12680 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
12680 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
12681 | 12681 | } elseif ($length === null || $length > $string_length) { |
12682 | 12682 | $length = $string_length; |
12683 | 12683 | } |
@@ -12688,9 +12688,9 @@ discard block |
||
12688 | 12688 | } |
12689 | 12689 | |
12690 | 12690 | /** @noinspection AdditionOperationOnArraysInspection */ |
12691 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
12692 | - $replacement . |
|
12693 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
12691 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
12692 | + $replacement. |
|
12693 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
12694 | 12694 | } |
12695 | 12695 | |
12696 | 12696 | // |
@@ -12699,8 +12699,7 @@ discard block |
||
12699 | 12699 | |
12700 | 12700 | if (ASCII::is_ascii($str)) { |
12701 | 12701 | return ($length === null) ? |
12702 | - \substr_replace($str, $replacement, $offset) : |
|
12703 | - \substr_replace($str, $replacement, $offset, $length); |
|
12702 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
12704 | 12703 | } |
12705 | 12704 | |
12706 | 12705 | // |
@@ -12716,7 +12715,7 @@ discard block |
||
12716 | 12715 | // e.g.: non mbstring support + invalid chars |
12717 | 12716 | return ''; |
12718 | 12717 | } |
12719 | - $length = (int) $length_tmp; |
|
12718 | + $length = (int)$length_tmp; |
|
12720 | 12719 | } |
12721 | 12720 | |
12722 | 12721 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12759,14 +12758,14 @@ discard block |
||
12759 | 12758 | && |
12760 | 12759 | \substr($haystack, -\strlen($needle)) === $needle |
12761 | 12760 | ) { |
12762 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
12761 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
12763 | 12762 | } |
12764 | 12763 | |
12765 | 12764 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
12766 | - return (string) self::substr( |
|
12765 | + return (string)self::substr( |
|
12767 | 12766 | $haystack, |
12768 | 12767 | 0, |
12769 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
12768 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
12770 | 12769 | $encoding |
12771 | 12770 | ); |
12772 | 12771 | } |
@@ -12801,10 +12800,10 @@ discard block |
||
12801 | 12800 | } |
12802 | 12801 | |
12803 | 12802 | if ($encoding === 'UTF-8') { |
12804 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12803 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12805 | 12804 | } |
12806 | 12805 | |
12807 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12806 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12808 | 12807 | } |
12809 | 12808 | |
12810 | 12809 | /** |
@@ -13018,7 +13017,7 @@ discard block |
||
13018 | 13017 | public static function to_boolean($str): bool |
13019 | 13018 | { |
13020 | 13019 | // init |
13021 | - $str = (string) $str; |
|
13020 | + $str = (string)$str; |
|
13022 | 13021 | |
13023 | 13022 | if ($str === '') { |
13024 | 13023 | return false; |
@@ -13046,10 +13045,10 @@ discard block |
||
13046 | 13045 | } |
13047 | 13046 | |
13048 | 13047 | if (\is_numeric($str)) { |
13049 | - return ((float) $str + 0) > 0; |
|
13048 | + return ((float)$str + 0) > 0; |
|
13050 | 13049 | } |
13051 | 13050 | |
13052 | - return (bool) \trim($str); |
|
13051 | + return (bool)\trim($str); |
|
13053 | 13052 | } |
13054 | 13053 | |
13055 | 13054 | /** |
@@ -13097,7 +13096,7 @@ discard block |
||
13097 | 13096 | return $str; |
13098 | 13097 | } |
13099 | 13098 | |
13100 | - $str = (string) $str; |
|
13099 | + $str = (string)$str; |
|
13101 | 13100 | if ($str === '') { |
13102 | 13101 | return ''; |
13103 | 13102 | } |
@@ -13205,7 +13204,7 @@ discard block |
||
13205 | 13204 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
13206 | 13205 | |
13207 | 13206 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13208 | - $buf .= $c1 . $c2; |
|
13207 | + $buf .= $c1.$c2; |
|
13209 | 13208 | ++$i; |
13210 | 13209 | } else { // not valid UTF8 - convert it |
13211 | 13210 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13216,7 +13215,7 @@ discard block |
||
13216 | 13215 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
13217 | 13216 | |
13218 | 13217 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13219 | - $buf .= $c1 . $c2 . $c3; |
|
13218 | + $buf .= $c1.$c2.$c3; |
|
13220 | 13219 | $i += 2; |
13221 | 13220 | } else { // not valid UTF8 - convert it |
13222 | 13221 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13228,7 +13227,7 @@ discard block |
||
13228 | 13227 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
13229 | 13228 | |
13230 | 13229 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13231 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
13230 | + $buf .= $c1.$c2.$c3.$c4; |
|
13232 | 13231 | $i += 3; |
13233 | 13232 | } else { // not valid UTF8 - convert it |
13234 | 13233 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13256,13 +13255,13 @@ discard block |
||
13256 | 13255 | * |
13257 | 13256 | * @return string |
13258 | 13257 | */ |
13259 | - static function (array $matches): string { |
|
13258 | + static function(array $matches): string { |
|
13260 | 13259 | if (isset($matches[3])) { |
13261 | - $cp = (int) \hexdec($matches[3]); |
|
13260 | + $cp = (int)\hexdec($matches[3]); |
|
13262 | 13261 | } else { |
13263 | 13262 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
13264 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
13265 | - + (int) \hexdec($matches[2]) |
|
13263 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
13264 | + + (int)\hexdec($matches[2]) |
|
13266 | 13265 | + 0x10000 |
13267 | 13266 | - (0xD800 << 10) |
13268 | 13267 | - 0xDC00; |
@@ -13273,12 +13272,12 @@ discard block |
||
13273 | 13272 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
13274 | 13273 | |
13275 | 13274 | if ($cp < 0x80) { |
13276 | - return (string) self::chr($cp); |
|
13275 | + return (string)self::chr($cp); |
|
13277 | 13276 | } |
13278 | 13277 | |
13279 | 13278 | if ($cp < 0xA0) { |
13280 | 13279 | /** @noinspection UnnecessaryCastingInspection */ |
13281 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
13280 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
13282 | 13281 | } |
13283 | 13282 | |
13284 | 13283 | return self::decimal_to_chr($cp); |
@@ -13311,7 +13310,7 @@ discard block |
||
13311 | 13310 | public static function to_int(string $str) |
13312 | 13311 | { |
13313 | 13312 | if (\is_numeric($str)) { |
13314 | - return (int) $str; |
|
13313 | + return (int)$str; |
|
13315 | 13314 | } |
13316 | 13315 | |
13317 | 13316 | return null; |
@@ -13346,7 +13345,7 @@ discard block |
||
13346 | 13345 | || |
13347 | 13346 | $input_type === 'double' |
13348 | 13347 | ) { |
13349 | - return (string) $input; |
|
13348 | + return (string)$input; |
|
13350 | 13349 | } |
13351 | 13350 | |
13352 | 13351 | if ($input_type === 'object') { |
@@ -13356,7 +13355,7 @@ discard block |
||
13356 | 13355 | /** @noinspection NestedPositiveIfStatementsInspection */ |
13357 | 13356 | /** @noinspection MissingOrEmptyGroupStatementInspection */ |
13358 | 13357 | if (\method_exists($input, '__toString')) { |
13359 | - return (string) $input; |
|
13358 | + return (string)$input; |
|
13360 | 13359 | } |
13361 | 13360 | } |
13362 | 13361 | |
@@ -13397,7 +13396,7 @@ discard block |
||
13397 | 13396 | } |
13398 | 13397 | |
13399 | 13398 | /** @noinspection PhpComposerExtensionStubsInspection */ |
13400 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
13399 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
13401 | 13400 | } |
13402 | 13401 | |
13403 | 13402 | if ($chars !== null) { |
@@ -13448,15 +13447,15 @@ discard block |
||
13448 | 13447 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
13449 | 13448 | |
13450 | 13449 | if ($encoding === 'UTF-8') { |
13451 | - $str_part_two = (string) \mb_substr($str, 1); |
|
13450 | + $str_part_two = (string)\mb_substr($str, 1); |
|
13452 | 13451 | |
13453 | 13452 | if ($use_mb_functions) { |
13454 | 13453 | $str_part_one = \mb_strtoupper( |
13455 | - (string) \mb_substr($str, 0, 1) |
|
13454 | + (string)\mb_substr($str, 0, 1) |
|
13456 | 13455 | ); |
13457 | 13456 | } else { |
13458 | 13457 | $str_part_one = self::strtoupper( |
13459 | - (string) \mb_substr($str, 0, 1), |
|
13458 | + (string)\mb_substr($str, 0, 1), |
|
13460 | 13459 | $encoding, |
13461 | 13460 | false, |
13462 | 13461 | $lang, |
@@ -13466,16 +13465,16 @@ discard block |
||
13466 | 13465 | } else { |
13467 | 13466 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
13468 | 13467 | |
13469 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
13468 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
13470 | 13469 | |
13471 | 13470 | if ($use_mb_functions) { |
13472 | 13471 | $str_part_one = \mb_strtoupper( |
13473 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
13472 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
13474 | 13473 | $encoding |
13475 | 13474 | ); |
13476 | 13475 | } else { |
13477 | 13476 | $str_part_one = self::strtoupper( |
13478 | - (string) self::substr($str, 0, 1, $encoding), |
|
13477 | + (string)self::substr($str, 0, 1, $encoding), |
|
13479 | 13478 | $encoding, |
13480 | 13479 | false, |
13481 | 13480 | $lang, |
@@ -13484,7 +13483,7 @@ discard block |
||
13484 | 13483 | } |
13485 | 13484 | } |
13486 | 13485 | |
13487 | - return $str_part_one . $str_part_two; |
|
13486 | + return $str_part_one.$str_part_two; |
|
13488 | 13487 | } |
13489 | 13488 | |
13490 | 13489 | /** |
@@ -13545,7 +13544,7 @@ discard block |
||
13545 | 13544 | $str = self::clean($str); |
13546 | 13545 | } |
13547 | 13546 | |
13548 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
13547 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
13549 | 13548 | |
13550 | 13549 | if ( |
13551 | 13550 | $use_php_default_functions |
@@ -13962,7 +13961,7 @@ discard block |
||
13962 | 13961 | if ( |
13963 | 13962 | $keep_utf8_chars |
13964 | 13963 | && |
13965 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
13964 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
13966 | 13965 | ) { |
13967 | 13966 | return $str_backup; |
13968 | 13967 | } |
@@ -14053,17 +14052,17 @@ discard block |
||
14053 | 14052 | return ''; |
14054 | 14053 | } |
14055 | 14054 | |
14056 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
14055 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
14057 | 14056 | |
14058 | 14057 | if ( |
14059 | 14058 | !isset($matches[0]) |
14060 | 14059 | || |
14061 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
14060 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
14062 | 14061 | ) { |
14063 | 14062 | return $str; |
14064 | 14063 | } |
14065 | 14064 | |
14066 | - return \rtrim($matches[0]) . $str_add_on; |
|
14065 | + return \rtrim($matches[0]).$str_add_on; |
|
14067 | 14066 | } |
14068 | 14067 | |
14069 | 14068 | /** |
@@ -14158,7 +14157,7 @@ discard block |
||
14158 | 14157 | } |
14159 | 14158 | } |
14160 | 14159 | |
14161 | - return $str_return . \implode('', $charsArray); |
|
14160 | + return $str_return.\implode('', $charsArray); |
|
14162 | 14161 | } |
14163 | 14162 | |
14164 | 14163 | /** |
@@ -14212,7 +14211,7 @@ discard block |
||
14212 | 14211 | $final_break = ''; |
14213 | 14212 | } |
14214 | 14213 | |
14215 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
14214 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
14216 | 14215 | } |
14217 | 14216 | |
14218 | 14217 | /** |
@@ -14454,7 +14453,7 @@ discard block |
||
14454 | 14453 | /** @noinspection PhpIncludeInspection */ |
14455 | 14454 | /** @noinspection UsingInclusionReturnValueInspection */ |
14456 | 14455 | /** @psalm-suppress UnresolvableInclude */ |
14457 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
14456 | + return include __DIR__.'/data/'.$file.'.php'; |
|
14458 | 14457 | } |
14459 | 14458 | |
14460 | 14459 | /** |
@@ -14474,7 +14473,7 @@ discard block |
||
14474 | 14473 | */ |
14475 | 14474 | \uksort( |
14476 | 14475 | self::$EMOJI, |
14477 | - static function (string $a, string $b): int { |
|
14476 | + static function(string $a, string $b): int { |
|
14478 | 14477 | return \strlen($b) <=> \strlen($a); |
14479 | 14478 | } |
14480 | 14479 | ); |
@@ -14484,7 +14483,7 @@ discard block |
||
14484 | 14483 | |
14485 | 14484 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
14486 | 14485 | $tmp_key = \crc32($key); |
14487 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
14486 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
14488 | 14487 | } |
14489 | 14488 | |
14490 | 14489 | return true; |
@@ -14512,7 +14511,7 @@ discard block |
||
14512 | 14511 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
14513 | 14512 | return \defined('MB_OVERLOAD_STRING') |
14514 | 14513 | && |
14515 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
14514 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
14516 | 14515 | } |
14517 | 14516 | |
14518 | 14517 | /** |
@@ -14578,7 +14577,7 @@ discard block |
||
14578 | 14577 | */ |
14579 | 14578 | static $RX_CLASS_CACHE = []; |
14580 | 14579 | |
14581 | - $cache_key = $s . '_' . $class; |
|
14580 | + $cache_key = $s.'_'.$class; |
|
14582 | 14581 | |
14583 | 14582 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
14584 | 14583 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -14591,7 +14590,7 @@ discard block |
||
14591 | 14590 | /** @noinspection AlterInForeachInspection */ |
14592 | 14591 | foreach (self::str_split($s) as &$s) { |
14593 | 14592 | if ($s === '-') { |
14594 | - $class_array[0] = '-' . $class_array[0]; |
|
14593 | + $class_array[0] = '-'.$class_array[0]; |
|
14595 | 14594 | } elseif (!isset($s[2])) { |
14596 | 14595 | $class_array[0] .= \preg_quote($s, '/'); |
14597 | 14596 | } elseif (self::strlen($s) === 1) { |
@@ -14602,13 +14601,13 @@ discard block |
||
14602 | 14601 | } |
14603 | 14602 | |
14604 | 14603 | if ($class_array[0]) { |
14605 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
14604 | + $class_array[0] = '['.$class_array[0].']'; |
|
14606 | 14605 | } |
14607 | 14606 | |
14608 | 14607 | if (\count($class_array) === 1) { |
14609 | 14608 | $return = $class_array[0]; |
14610 | 14609 | } else { |
14611 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
14610 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
14612 | 14611 | } |
14613 | 14612 | |
14614 | 14613 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -14689,7 +14688,7 @@ discard block |
||
14689 | 14688 | |
14690 | 14689 | if ($delimiter === '-') { |
14691 | 14690 | /** @noinspection AlterInForeachInspection */ |
14692 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
14691 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
14693 | 14692 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
14694 | 14693 | $continue = true; |
14695 | 14694 | |
@@ -14699,7 +14698,7 @@ discard block |
||
14699 | 14698 | } |
14700 | 14699 | |
14701 | 14700 | /** @noinspection AlterInForeachInspection */ |
14702 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
14701 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
14703 | 14702 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
14704 | 14703 | $continue = true; |
14705 | 14704 | |
@@ -14775,8 +14774,8 @@ discard block |
||
14775 | 14774 | } else { |
14776 | 14775 | /** @noinspection OffsetOperationsInspection */ |
14777 | 14776 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
14778 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
14779 | - $buf .= $cc1 . $cc2; |
|
14777 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
14778 | + $buf .= $cc1.$cc2; |
|
14780 | 14779 | } |
14781 | 14780 | |
14782 | 14781 | return $buf; |
@@ -14795,7 +14794,7 @@ discard block |
||
14795 | 14794 | { |
14796 | 14795 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
14797 | 14796 | if (\preg_match($pattern, $str)) { |
14798 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
14797 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
14799 | 14798 | } |
14800 | 14799 | |
14801 | 14800 | return $str; |