@@ -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 | /** |
@@ -600,14 +600,14 @@ discard block |
||
600 | 600 | /** |
601 | 601 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
602 | 602 | */ |
603 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
603 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | if ($code_point <= 0) { |
607 | 607 | return null; |
608 | 608 | } |
609 | 609 | |
610 | - $cache_key = $code_point . '_' . $encoding; |
|
610 | + $cache_key = $code_point.'_'.$encoding; |
|
611 | 611 | if (isset($CHAR_CACHE[$cache_key])) { |
612 | 612 | return $CHAR_CACHE[$cache_key]; |
613 | 613 | } |
@@ -653,27 +653,27 @@ discard block |
||
653 | 653 | self::$CHR = self::getData('chr'); |
654 | 654 | } |
655 | 655 | |
656 | - $code_point = (int) $code_point; |
|
656 | + $code_point = (int)$code_point; |
|
657 | 657 | if ($code_point <= 0x7FF) { |
658 | 658 | /** |
659 | 659 | * @psalm-suppress PossiblyNullArrayAccess |
660 | 660 | */ |
661 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
661 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
662 | 662 | self::$CHR[($code_point & 0x3F) + 0x80]; |
663 | 663 | } elseif ($code_point <= 0xFFFF) { |
664 | 664 | /** |
665 | 665 | * @psalm-suppress PossiblyNullArrayAccess |
666 | 666 | */ |
667 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
668 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
667 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
668 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
669 | 669 | self::$CHR[($code_point & 0x3F) + 0x80]; |
670 | 670 | } else { |
671 | 671 | /** |
672 | 672 | * @psalm-suppress PossiblyNullArrayAccess |
673 | 673 | */ |
674 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
675 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
676 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
674 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
675 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
676 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
677 | 677 | self::$CHR[($code_point & 0x3F) + 0x80]; |
678 | 678 | } |
679 | 679 | |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | |
731 | 731 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
732 | 732 | return \array_map( |
733 | - static function (string $data): int { |
|
733 | + static function(string $data): int { |
|
734 | 734 | // "mb_" is available if overload is used, so use it ... |
735 | 735 | return \mb_strlen($data, 'CP850'); // 8-BIT |
736 | 736 | }, |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | $char = ''; |
818 | 818 | } |
819 | 819 | |
820 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
820 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
821 | 821 | } |
822 | 822 | |
823 | 823 | /** |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
915 | 915 | /x'; |
916 | 916 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
917 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
917 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
918 | 918 | |
919 | 919 | if ($replace_diamond_question_mark) { |
920 | 920 | $str = self::replace_diamond_question_mark($str); |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | public static function cleanup($str): string |
954 | 954 | { |
955 | 955 | // init |
956 | - $str = (string) $str; |
|
956 | + $str = (string)$str; |
|
957 | 957 | |
958 | 958 | if ($str === '') { |
959 | 959 | return ''; |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | { |
1056 | 1056 | if (self::$SUPPORT['mbstring'] === true) { |
1057 | 1057 | /** @noinspection PhpComposerExtensionStubsInspection */ |
1058 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1058 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1160,9 +1160,9 @@ discard block |
||
1160 | 1160 | // - 0-9 (U+0061 - U+007A) |
1161 | 1161 | // - ISO 10646 characters U+00A1 and higher |
1162 | 1162 | // We strip out any character not in the above list. |
1163 | - $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); |
|
1163 | + $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 | 1164 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
1165 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1165 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1166 | 1166 | |
1167 | 1167 | return \trim($str, '-'); |
1168 | 1168 | } |
@@ -1178,7 +1178,7 @@ discard block |
||
1178 | 1178 | */ |
1179 | 1179 | public static function css_stripe_media_queries(string $str): string |
1180 | 1180 | { |
1181 | - return (string) \preg_replace( |
|
1181 | + return (string)\preg_replace( |
|
1182 | 1182 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
1183 | 1183 | '', |
1184 | 1184 | $str |
@@ -1215,7 +1215,7 @@ discard block |
||
1215 | 1215 | */ |
1216 | 1216 | public static function decimal_to_chr($int): string |
1217 | 1217 | { |
1218 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
1218 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
1219 | 1219 | } |
1220 | 1220 | |
1221 | 1221 | /** |
@@ -1265,7 +1265,7 @@ discard block |
||
1265 | 1265 | $flagOffset = 0x1F1E6; |
1266 | 1266 | $asciiOffset = 0x41; |
1267 | 1267 | |
1268 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
1268 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
1269 | 1269 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
1270 | 1270 | } |
1271 | 1271 | |
@@ -1296,16 +1296,16 @@ discard block |
||
1296 | 1296 | self::initEmojiData(); |
1297 | 1297 | |
1298 | 1298 | if ($use_reversible_string_mappings) { |
1299 | - return (string) \str_replace( |
|
1300 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1301 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1299 | + return (string)\str_replace( |
|
1300 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1301 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1302 | 1302 | $str |
1303 | 1303 | ); |
1304 | 1304 | } |
1305 | 1305 | |
1306 | - return (string) \str_replace( |
|
1307 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1308 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1306 | + return (string)\str_replace( |
|
1307 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1308 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1309 | 1309 | $str |
1310 | 1310 | ); |
1311 | 1311 | } |
@@ -1337,16 +1337,16 @@ discard block |
||
1337 | 1337 | self::initEmojiData(); |
1338 | 1338 | |
1339 | 1339 | if ($use_reversible_string_mappings) { |
1340 | - return (string) \str_replace( |
|
1341 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1342 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1340 | + return (string)\str_replace( |
|
1341 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1342 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1343 | 1343 | $str |
1344 | 1344 | ); |
1345 | 1345 | } |
1346 | 1346 | |
1347 | - return (string) \str_replace( |
|
1348 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1349 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1347 | + return (string)\str_replace( |
|
1348 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1349 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1350 | 1350 | $str |
1351 | 1351 | ); |
1352 | 1352 | } |
@@ -1412,7 +1412,7 @@ discard block |
||
1412 | 1412 | if ($to_encoding === 'JSON') { |
1413 | 1413 | $return = self::json_encode($str); |
1414 | 1414 | if ($return === false) { |
1415 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1415 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | return $return; |
@@ -1503,7 +1503,7 @@ discard block |
||
1503 | 1503 | /** |
1504 | 1504 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
1505 | 1505 | */ |
1506 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1506 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1507 | 1507 | } |
1508 | 1508 | |
1509 | 1509 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1605,31 +1605,31 @@ discard block |
||
1605 | 1605 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1606 | 1606 | |
1607 | 1607 | if ($length === null) { |
1608 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
1608 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
1609 | 1609 | } |
1610 | 1610 | |
1611 | 1611 | if ($search === '') { |
1612 | 1612 | if ($encoding === 'UTF-8') { |
1613 | 1613 | if ($length > 0) { |
1614 | - $string_length = (int) \mb_strlen($str); |
|
1614 | + $string_length = (int)\mb_strlen($str); |
|
1615 | 1615 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1616 | 1616 | } else { |
1617 | 1617 | $end = 0; |
1618 | 1618 | } |
1619 | 1619 | |
1620 | - $pos = (int) \min( |
|
1620 | + $pos = (int)\min( |
|
1621 | 1621 | \mb_strpos($str, ' ', $end), |
1622 | 1622 | \mb_strpos($str, '.', $end) |
1623 | 1623 | ); |
1624 | 1624 | } else { |
1625 | 1625 | if ($length > 0) { |
1626 | - $string_length = (int) self::strlen($str, $encoding); |
|
1626 | + $string_length = (int)self::strlen($str, $encoding); |
|
1627 | 1627 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1628 | 1628 | } else { |
1629 | 1629 | $end = 0; |
1630 | 1630 | } |
1631 | 1631 | |
1632 | - $pos = (int) \min( |
|
1632 | + $pos = (int)\min( |
|
1633 | 1633 | self::strpos($str, ' ', $end, $encoding), |
1634 | 1634 | self::strpos($str, '.', $end, $encoding) |
1635 | 1635 | ); |
@@ -1646,18 +1646,18 @@ discard block |
||
1646 | 1646 | return ''; |
1647 | 1647 | } |
1648 | 1648 | |
1649 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1649 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1650 | 1650 | } |
1651 | 1651 | |
1652 | 1652 | return $str; |
1653 | 1653 | } |
1654 | 1654 | |
1655 | 1655 | if ($encoding === 'UTF-8') { |
1656 | - $word_position = (int) \mb_stripos($str, $search); |
|
1657 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1656 | + $word_position = (int)\mb_stripos($str, $search); |
|
1657 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1658 | 1658 | } else { |
1659 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1660 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1659 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1660 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1661 | 1661 | } |
1662 | 1662 | |
1663 | 1663 | $pos_start = 0; |
@@ -1669,12 +1669,12 @@ discard block |
||
1669 | 1669 | } |
1670 | 1670 | if ($half_text !== false) { |
1671 | 1671 | if ($encoding === 'UTF-8') { |
1672 | - $pos_start = (int) \max( |
|
1672 | + $pos_start = (int)\max( |
|
1673 | 1673 | \mb_strrpos($half_text, ' '), |
1674 | 1674 | \mb_strrpos($half_text, '.') |
1675 | 1675 | ); |
1676 | 1676 | } else { |
1677 | - $pos_start = (int) \max( |
|
1677 | + $pos_start = (int)\max( |
|
1678 | 1678 | self::strrpos($half_text, ' ', 0, $encoding), |
1679 | 1679 | self::strrpos($half_text, '.', 0, $encoding) |
1680 | 1680 | ); |
@@ -1684,19 +1684,19 @@ discard block |
||
1684 | 1684 | |
1685 | 1685 | if ($word_position && $half_side > 0) { |
1686 | 1686 | $offset = $pos_start + $length - 1; |
1687 | - $real_length = (int) self::strlen($str, $encoding); |
|
1687 | + $real_length = (int)self::strlen($str, $encoding); |
|
1688 | 1688 | |
1689 | 1689 | if ($offset > $real_length) { |
1690 | 1690 | $offset = $real_length; |
1691 | 1691 | } |
1692 | 1692 | |
1693 | 1693 | if ($encoding === 'UTF-8') { |
1694 | - $pos_end = (int) \min( |
|
1694 | + $pos_end = (int)\min( |
|
1695 | 1695 | \mb_strpos($str, ' ', $offset), |
1696 | 1696 | \mb_strpos($str, '.', $offset) |
1697 | 1697 | ) - $pos_start; |
1698 | 1698 | } else { |
1699 | - $pos_end = (int) \min( |
|
1699 | + $pos_end = (int)\min( |
|
1700 | 1700 | self::strpos($str, ' ', $offset, $encoding), |
1701 | 1701 | self::strpos($str, '.', $offset, $encoding) |
1702 | 1702 | ) - $pos_start; |
@@ -1704,12 +1704,12 @@ discard block |
||
1704 | 1704 | |
1705 | 1705 | if (!$pos_end || $pos_end <= 0) { |
1706 | 1706 | if ($encoding === 'UTF-8') { |
1707 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1707 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1708 | 1708 | } else { |
1709 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1709 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1710 | 1710 | } |
1711 | 1711 | if ($str_sub !== false) { |
1712 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1712 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1713 | 1713 | } else { |
1714 | 1714 | $extract = ''; |
1715 | 1715 | } |
@@ -1720,26 +1720,26 @@ discard block |
||
1720 | 1720 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1721 | 1721 | } |
1722 | 1722 | if ($str_sub !== false) { |
1723 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1723 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1724 | 1724 | } else { |
1725 | 1725 | $extract = ''; |
1726 | 1726 | } |
1727 | 1727 | } |
1728 | 1728 | } else { |
1729 | 1729 | $offset = $length - 1; |
1730 | - $true_length = (int) self::strlen($str, $encoding); |
|
1730 | + $true_length = (int)self::strlen($str, $encoding); |
|
1731 | 1731 | |
1732 | 1732 | if ($offset > $true_length) { |
1733 | 1733 | $offset = $true_length; |
1734 | 1734 | } |
1735 | 1735 | |
1736 | 1736 | if ($encoding === 'UTF-8') { |
1737 | - $pos_end = (int) \min( |
|
1737 | + $pos_end = (int)\min( |
|
1738 | 1738 | \mb_strpos($str, ' ', $offset), |
1739 | 1739 | \mb_strpos($str, '.', $offset) |
1740 | 1740 | ); |
1741 | 1741 | } else { |
1742 | - $pos_end = (int) \min( |
|
1742 | + $pos_end = (int)\min( |
|
1743 | 1743 | self::strpos($str, ' ', $offset, $encoding), |
1744 | 1744 | self::strpos($str, '.', $offset, $encoding) |
1745 | 1745 | ); |
@@ -1752,7 +1752,7 @@ discard block |
||
1752 | 1752 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1753 | 1753 | } |
1754 | 1754 | if ($str_sub !== false) { |
1755 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1755 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1756 | 1756 | } else { |
1757 | 1757 | $extract = ''; |
1758 | 1758 | } |
@@ -1885,7 +1885,7 @@ discard block |
||
1885 | 1885 | { |
1886 | 1886 | $file_content = \file_get_contents($file_path); |
1887 | 1887 | if ($file_content === false) { |
1888 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1888 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1889 | 1889 | } |
1890 | 1890 | |
1891 | 1891 | return self::string_has_bom($file_content); |
@@ -1951,7 +1951,7 @@ discard block |
||
1951 | 1951 | ) { |
1952 | 1952 | // Prevent leading combining chars |
1953 | 1953 | // for NFC-safe concatenations. |
1954 | - $var = $leading_combining . $var; |
|
1954 | + $var = $leading_combining.$var; |
|
1955 | 1955 | } |
1956 | 1956 | } |
1957 | 1957 | |
@@ -2270,10 +2270,10 @@ discard block |
||
2270 | 2270 | } |
2271 | 2271 | |
2272 | 2272 | if ($encoding === 'UTF-8') { |
2273 | - return (string) \mb_substr($str, 0, $n); |
|
2273 | + return (string)\mb_substr($str, 0, $n); |
|
2274 | 2274 | } |
2275 | 2275 | |
2276 | - return (string) self::substr($str, 0, $n, $encoding); |
|
2276 | + return (string)self::substr($str, 0, $n, $encoding); |
|
2277 | 2277 | } |
2278 | 2278 | |
2279 | 2279 | /** |
@@ -2291,7 +2291,7 @@ discard block |
||
2291 | 2291 | */ |
2292 | 2292 | public static function fits_inside(string $str, int $box_size): bool |
2293 | 2293 | { |
2294 | - return (int) self::strlen($str) <= $box_size; |
|
2294 | + return (int)self::strlen($str) <= $box_size; |
|
2295 | 2295 | } |
2296 | 2296 | |
2297 | 2297 | /** |
@@ -2374,7 +2374,7 @@ discard block |
||
2374 | 2374 | return $str; |
2375 | 2375 | } |
2376 | 2376 | |
2377 | - $str = (string) $str; |
|
2377 | + $str = (string)$str; |
|
2378 | 2378 | $last = ''; |
2379 | 2379 | while ($last !== $str) { |
2380 | 2380 | $last = $str; |
@@ -2583,7 +2583,7 @@ discard block |
||
2583 | 2583 | return $fallback; |
2584 | 2584 | } |
2585 | 2585 | /** @noinspection OffsetOperationsInspection */ |
2586 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2586 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2587 | 2587 | |
2588 | 2588 | // DEBUG |
2589 | 2589 | //var_dump($type_code); |
@@ -2641,7 +2641,7 @@ discard block |
||
2641 | 2641 | // |
2642 | 2642 | |
2643 | 2643 | if ($encoding === 'UTF-8') { |
2644 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2644 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2645 | 2645 | if ($max_length === 0) { |
2646 | 2646 | return ''; |
2647 | 2647 | } |
@@ -2662,7 +2662,7 @@ discard block |
||
2662 | 2662 | } else { |
2663 | 2663 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2664 | 2664 | |
2665 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2665 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2666 | 2666 | if ($max_length === 0) { |
2667 | 2667 | return ''; |
2668 | 2668 | } |
@@ -2700,16 +2700,16 @@ discard block |
||
2700 | 2700 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
2701 | 2701 | } |
2702 | 2702 | |
2703 | - $unique_helper = $rand_int . |
|
2704 | - \session_id() . |
|
2705 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2706 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2703 | + $unique_helper = $rand_int. |
|
2704 | + \session_id(). |
|
2705 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2706 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2707 | 2707 | $extra_entropy; |
2708 | 2708 | |
2709 | 2709 | $unique_string = \uniqid($unique_helper, true); |
2710 | 2710 | |
2711 | 2711 | if ($use_md5) { |
2712 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2712 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2713 | 2713 | } |
2714 | 2714 | |
2715 | 2715 | return $unique_string; |
@@ -2808,7 +2808,7 @@ discard block |
||
2808 | 2808 | public static function hex_to_chr(string $hexdec) |
2809 | 2809 | { |
2810 | 2810 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
2811 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
2811 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
2812 | 2812 | } |
2813 | 2813 | |
2814 | 2814 | /** |
@@ -2828,7 +2828,7 @@ discard block |
||
2828 | 2828 | public static function hex_to_int($hexdec) |
2829 | 2829 | { |
2830 | 2830 | // init |
2831 | - $hexdec = (string) $hexdec; |
|
2831 | + $hexdec = (string)$hexdec; |
|
2832 | 2832 | |
2833 | 2833 | if ($hexdec === '') { |
2834 | 2834 | return false; |
@@ -2927,7 +2927,7 @@ discard block |
||
2927 | 2927 | return \implode( |
2928 | 2928 | '', |
2929 | 2929 | \array_map( |
2930 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2930 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2931 | 2931 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2932 | 2932 | }, |
2933 | 2933 | self::str_split($str) |
@@ -3042,7 +3042,7 @@ discard block |
||
3042 | 3042 | /** |
3043 | 3043 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
3044 | 3044 | */ |
3045 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
3045 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
3046 | 3046 | } |
3047 | 3047 | |
3048 | 3048 | do { |
@@ -3051,7 +3051,7 @@ discard block |
||
3051 | 3051 | if (\strpos($str, '&') !== false) { |
3052 | 3052 | if (\strpos($str, '&#') !== false) { |
3053 | 3053 | // decode also numeric & UTF16 two byte entities |
3054 | - $str = (string) \preg_replace( |
|
3054 | + $str = (string)\preg_replace( |
|
3055 | 3055 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
3056 | 3056 | '$1;', |
3057 | 3057 | $str |
@@ -3101,7 +3101,7 @@ discard block |
||
3101 | 3101 | */ |
3102 | 3102 | public static function html_stripe_empty_tags(string $str): string |
3103 | 3103 | { |
3104 | - return (string) \preg_replace( |
|
3104 | + return (string)\preg_replace( |
|
3105 | 3105 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
3106 | 3106 | '', |
3107 | 3107 | $str |
@@ -3429,9 +3429,9 @@ discard block |
||
3429 | 3429 | { |
3430 | 3430 | $hex = \dechex($int); |
3431 | 3431 | |
3432 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
3432 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
3433 | 3433 | |
3434 | - return $prefix . $hex . ''; |
|
3434 | + return $prefix.$hex.''; |
|
3435 | 3435 | } |
3436 | 3436 | |
3437 | 3437 | /** |
@@ -3755,7 +3755,7 @@ discard block |
||
3755 | 3755 | */ |
3756 | 3756 | public static function is_binary($input, bool $strict = false): bool |
3757 | 3757 | { |
3758 | - $input = (string) $input; |
|
3758 | + $input = (string)$input; |
|
3759 | 3759 | if ($input === '') { |
3760 | 3760 | return false; |
3761 | 3761 | } |
@@ -4115,7 +4115,7 @@ discard block |
||
4115 | 4115 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
4116 | 4116 | { |
4117 | 4117 | // init |
4118 | - $str = (string) $str; |
|
4118 | + $str = (string)$str; |
|
4119 | 4119 | $str_chars = []; |
4120 | 4120 | |
4121 | 4121 | if ( |
@@ -4209,7 +4209,7 @@ discard block |
||
4209 | 4209 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
4210 | 4210 | { |
4211 | 4211 | // init |
4212 | - $str = (string) $str; |
|
4212 | + $str = (string)$str; |
|
4213 | 4213 | $str_chars = []; |
4214 | 4214 | |
4215 | 4215 | if ( |
@@ -4307,7 +4307,7 @@ discard block |
||
4307 | 4307 | return true; |
4308 | 4308 | } |
4309 | 4309 | |
4310 | - return self::is_utf8_string((string) $str, $strict); |
|
4310 | + return self::is_utf8_string((string)$str, $strict); |
|
4311 | 4311 | } |
4312 | 4312 | |
4313 | 4313 | /** |
@@ -4463,15 +4463,15 @@ discard block |
||
4463 | 4463 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
4464 | 4464 | |
4465 | 4465 | if ($encoding === 'UTF-8') { |
4466 | - $str_part_two = (string) \mb_substr($str, 1); |
|
4466 | + $str_part_two = (string)\mb_substr($str, 1); |
|
4467 | 4467 | |
4468 | 4468 | if ($use_mb_functions) { |
4469 | 4469 | $str_part_one = \mb_strtolower( |
4470 | - (string) \mb_substr($str, 0, 1) |
|
4470 | + (string)\mb_substr($str, 0, 1) |
|
4471 | 4471 | ); |
4472 | 4472 | } else { |
4473 | 4473 | $str_part_one = self::strtolower( |
4474 | - (string) \mb_substr($str, 0, 1), |
|
4474 | + (string)\mb_substr($str, 0, 1), |
|
4475 | 4475 | $encoding, |
4476 | 4476 | false, |
4477 | 4477 | $lang, |
@@ -4481,10 +4481,10 @@ discard block |
||
4481 | 4481 | } else { |
4482 | 4482 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4483 | 4483 | |
4484 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
4484 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
4485 | 4485 | |
4486 | 4486 | $str_part_one = self::strtolower( |
4487 | - (string) self::substr($str, 0, 1, $encoding), |
|
4487 | + (string)self::substr($str, 0, 1, $encoding), |
|
4488 | 4488 | $encoding, |
4489 | 4489 | false, |
4490 | 4490 | $lang, |
@@ -4492,7 +4492,7 @@ discard block |
||
4492 | 4492 | ); |
4493 | 4493 | } |
4494 | 4494 | |
4495 | - return $str_part_one . $str_part_two; |
|
4495 | + return $str_part_one.$str_part_two; |
|
4496 | 4496 | } |
4497 | 4497 | |
4498 | 4498 | /** |
@@ -4641,7 +4641,7 @@ discard block |
||
4641 | 4641 | } |
4642 | 4642 | |
4643 | 4643 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4644 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4644 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4645 | 4645 | } |
4646 | 4646 | |
4647 | 4647 | if ($chars !== null) { |
@@ -4678,7 +4678,7 @@ discard block |
||
4678 | 4678 | |
4679 | 4679 | $codepoint_max = \max($codepoints); |
4680 | 4680 | |
4681 | - return self::chr((int) $codepoint_max); |
|
4681 | + return self::chr((int)$codepoint_max); |
|
4682 | 4682 | } |
4683 | 4683 | |
4684 | 4684 | /** |
@@ -4698,7 +4698,7 @@ discard block |
||
4698 | 4698 | { |
4699 | 4699 | $bytes = self::chr_size_list($str); |
4700 | 4700 | if ($bytes !== []) { |
4701 | - return (int) \max($bytes); |
|
4701 | + return (int)\max($bytes); |
|
4702 | 4702 | } |
4703 | 4703 | |
4704 | 4704 | return 0; |
@@ -4742,7 +4742,7 @@ discard block |
||
4742 | 4742 | |
4743 | 4743 | $codepoint_min = \min($codepoints); |
4744 | 4744 | |
4745 | - return self::chr((int) $codepoint_min); |
|
4745 | + return self::chr((int)$codepoint_min); |
|
4746 | 4746 | } |
4747 | 4747 | |
4748 | 4748 | /** |
@@ -4790,7 +4790,7 @@ discard block |
||
4790 | 4790 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4791 | 4791 | |
4792 | 4792 | // init |
4793 | - $encoding = (string) $encoding; |
|
4793 | + $encoding = (string)$encoding; |
|
4794 | 4794 | |
4795 | 4795 | if (!$encoding) { |
4796 | 4796 | return $fallback; |
@@ -4852,7 +4852,7 @@ discard block |
||
4852 | 4852 | |
4853 | 4853 | $encoding_original = $encoding; |
4854 | 4854 | $encoding = \strtoupper($encoding); |
4855 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4855 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4856 | 4856 | |
4857 | 4857 | $equivalences = [ |
4858 | 4858 | 'ISO8859' => 'ISO-8859-1', |
@@ -5016,13 +5016,13 @@ discard block |
||
5016 | 5016 | static $CHAR_CACHE = []; |
5017 | 5017 | |
5018 | 5018 | // init |
5019 | - $chr = (string) $chr; |
|
5019 | + $chr = (string)$chr; |
|
5020 | 5020 | |
5021 | 5021 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
5022 | 5022 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5023 | 5023 | } |
5024 | 5024 | |
5025 | - $cache_key = $chr . '_' . $encoding; |
|
5025 | + $cache_key = $chr.'_'.$encoding; |
|
5026 | 5026 | if (isset($CHAR_CACHE[$cache_key])) { |
5027 | 5027 | return $CHAR_CACHE[$cache_key]; |
5028 | 5028 | } |
@@ -5057,7 +5057,7 @@ discard block |
||
5057 | 5057 | // |
5058 | 5058 | |
5059 | 5059 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
5060 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
5060 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
5061 | 5061 | /** @noinspection OffsetOperationsInspection */ |
5062 | 5062 | $code = $chr ? $chr[1] : 0; |
5063 | 5063 | |
@@ -5065,21 +5065,21 @@ discard block |
||
5065 | 5065 | if ($code >= 0xF0 && isset($chr[4])) { |
5066 | 5066 | /** @noinspection UnnecessaryCastingInspection */ |
5067 | 5067 | /** @noinspection OffsetOperationsInspection */ |
5068 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
5068 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
5069 | 5069 | } |
5070 | 5070 | |
5071 | 5071 | /** @noinspection OffsetOperationsInspection */ |
5072 | 5072 | if ($code >= 0xE0 && isset($chr[3])) { |
5073 | 5073 | /** @noinspection UnnecessaryCastingInspection */ |
5074 | 5074 | /** @noinspection OffsetOperationsInspection */ |
5075 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
5075 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
5076 | 5076 | } |
5077 | 5077 | |
5078 | 5078 | /** @noinspection OffsetOperationsInspection */ |
5079 | 5079 | if ($code >= 0xC0 && isset($chr[2])) { |
5080 | 5080 | /** @noinspection UnnecessaryCastingInspection */ |
5081 | 5081 | /** @noinspection OffsetOperationsInspection */ |
5082 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
5082 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
5083 | 5083 | } |
5084 | 5084 | |
5085 | 5085 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -5141,7 +5141,7 @@ discard block |
||
5141 | 5141 | public static function pcre_utf8_support(): bool |
5142 | 5142 | { |
5143 | 5143 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5144 | - return (bool) @\preg_match('//u', ''); |
|
5144 | + return (bool)@\preg_match('//u', ''); |
|
5145 | 5145 | } |
5146 | 5146 | |
5147 | 5147 | /** |
@@ -5182,14 +5182,14 @@ discard block |
||
5182 | 5182 | * @psalm-suppress DocblockTypeContradiction |
5183 | 5183 | */ |
5184 | 5184 | if (!\is_numeric($step)) { |
5185 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
5185 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
5186 | 5186 | } |
5187 | 5187 | |
5188 | 5188 | /** |
5189 | 5189 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
5190 | 5190 | */ |
5191 | 5191 | if ($step <= 0) { |
5192 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
5192 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
5193 | 5193 | } |
5194 | 5194 | } |
5195 | 5195 | |
@@ -5201,16 +5201,16 @@ discard block |
||
5201 | 5201 | $is_xdigit = false; |
5202 | 5202 | |
5203 | 5203 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5204 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
5204 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
5205 | 5205 | $is_digit = true; |
5206 | - $start = (int) $var1; |
|
5206 | + $start = (int)$var1; |
|
5207 | 5207 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
5208 | 5208 | $is_xdigit = true; |
5209 | - $start = (int) self::hex_to_int((string) $var1); |
|
5209 | + $start = (int)self::hex_to_int((string)$var1); |
|
5210 | 5210 | } elseif (!$use_ctype && \is_numeric($var1)) { |
5211 | - $start = (int) $var1; |
|
5211 | + $start = (int)$var1; |
|
5212 | 5212 | } else { |
5213 | - $start = self::ord((string) $var1); |
|
5213 | + $start = self::ord((string)$var1); |
|
5214 | 5214 | } |
5215 | 5215 | |
5216 | 5216 | if (!$start) { |
@@ -5218,13 +5218,13 @@ discard block |
||
5218 | 5218 | } |
5219 | 5219 | |
5220 | 5220 | if ($is_digit) { |
5221 | - $end = (int) $var2; |
|
5221 | + $end = (int)$var2; |
|
5222 | 5222 | } elseif ($is_xdigit) { |
5223 | - $end = (int) self::hex_to_int((string) $var2); |
|
5223 | + $end = (int)self::hex_to_int((string)$var2); |
|
5224 | 5224 | } elseif (!$use_ctype && \is_numeric($var2)) { |
5225 | - $end = (int) $var2; |
|
5225 | + $end = (int)$var2; |
|
5226 | 5226 | } else { |
5227 | - $end = self::ord((string) $var2); |
|
5227 | + $end = self::ord((string)$var2); |
|
5228 | 5228 | } |
5229 | 5229 | |
5230 | 5230 | if (!$end) { |
@@ -5233,7 +5233,7 @@ discard block |
||
5233 | 5233 | |
5234 | 5234 | $array = []; |
5235 | 5235 | foreach (\range($start, $end, $step) as $i) { |
5236 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
5236 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
5237 | 5237 | } |
5238 | 5238 | |
5239 | 5239 | return $array; |
@@ -5345,8 +5345,8 @@ discard block |
||
5345 | 5345 | $delimiter = '/'; |
5346 | 5346 | } |
5347 | 5347 | |
5348 | - return (string) \preg_replace( |
|
5349 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
5348 | + return (string)\preg_replace( |
|
5349 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
5350 | 5350 | $replacement, |
5351 | 5351 | $str |
5352 | 5352 | ); |
@@ -5396,9 +5396,9 @@ discard block |
||
5396 | 5396 | return ''; |
5397 | 5397 | } |
5398 | 5398 | |
5399 | - $str_length -= (int) $bom_byte_length; |
|
5399 | + $str_length -= (int)$bom_byte_length; |
|
5400 | 5400 | |
5401 | - $str = (string) $str_tmp; |
|
5401 | + $str = (string)$str_tmp; |
|
5402 | 5402 | } |
5403 | 5403 | } |
5404 | 5404 | |
@@ -5429,7 +5429,7 @@ discard block |
||
5429 | 5429 | */ |
5430 | 5430 | if (\is_array($what)) { |
5431 | 5431 | foreach ($what as $item) { |
5432 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
5432 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
5433 | 5433 | } |
5434 | 5434 | } |
5435 | 5435 | |
@@ -5467,7 +5467,7 @@ discard block |
||
5467 | 5467 | */ |
5468 | 5468 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
5469 | 5469 | { |
5470 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5470 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5471 | 5471 | } |
5472 | 5472 | |
5473 | 5473 | /** |
@@ -5524,17 +5524,17 @@ discard block |
||
5524 | 5524 | ): string { |
5525 | 5525 | if ($substring && \strpos($str, $substring) === 0) { |
5526 | 5526 | if ($encoding === 'UTF-8') { |
5527 | - return (string) \mb_substr( |
|
5527 | + return (string)\mb_substr( |
|
5528 | 5528 | $str, |
5529 | - (int) \mb_strlen($substring) |
|
5529 | + (int)\mb_strlen($substring) |
|
5530 | 5530 | ); |
5531 | 5531 | } |
5532 | 5532 | |
5533 | 5533 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5534 | 5534 | |
5535 | - return (string) self::substr( |
|
5535 | + return (string)self::substr( |
|
5536 | 5536 | $str, |
5537 | - (int) self::strlen($substring, $encoding), |
|
5537 | + (int)self::strlen($substring, $encoding), |
|
5538 | 5538 | null, |
5539 | 5539 | $encoding |
5540 | 5540 | ); |
@@ -5562,19 +5562,19 @@ discard block |
||
5562 | 5562 | ): string { |
5563 | 5563 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
5564 | 5564 | if ($encoding === 'UTF-8') { |
5565 | - return (string) \mb_substr( |
|
5565 | + return (string)\mb_substr( |
|
5566 | 5566 | $str, |
5567 | 5567 | 0, |
5568 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
5568 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
5569 | 5569 | ); |
5570 | 5570 | } |
5571 | 5571 | |
5572 | 5572 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5573 | 5573 | |
5574 | - return (string) self::substr( |
|
5574 | + return (string)self::substr( |
|
5575 | 5575 | $str, |
5576 | 5576 | 0, |
5577 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
5577 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
5578 | 5578 | $encoding |
5579 | 5579 | ); |
5580 | 5580 | } |
@@ -5676,7 +5676,7 @@ discard block |
||
5676 | 5676 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
5677 | 5677 | @\mb_substitute_character($replacement_char_helper); |
5678 | 5678 | // the polyfill maybe return false, so cast to string |
5679 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5679 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5680 | 5680 | \mb_substitute_character($save); |
5681 | 5681 | } |
5682 | 5682 | |
@@ -5722,7 +5722,7 @@ discard block |
||
5722 | 5722 | } |
5723 | 5723 | |
5724 | 5724 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5725 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5725 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5726 | 5726 | } |
5727 | 5727 | |
5728 | 5728 | if ($chars !== null) { |
@@ -5752,7 +5752,7 @@ discard block |
||
5752 | 5752 | $html .= '<pre>'; |
5753 | 5753 | /** @noinspection AlterInForeachInspection */ |
5754 | 5754 | foreach (self::$SUPPORT as $key => &$value) { |
5755 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5755 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
5756 | 5756 | } |
5757 | 5757 | $html .= '</pre>'; |
5758 | 5758 | |
@@ -5794,7 +5794,7 @@ discard block |
||
5794 | 5794 | return $char; |
5795 | 5795 | } |
5796 | 5796 | |
5797 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5797 | + return '&#'.self::ord($char, $encoding).';'; |
|
5798 | 5798 | } |
5799 | 5799 | |
5800 | 5800 | /** |
@@ -5898,11 +5898,11 @@ discard block |
||
5898 | 5898 | $lang, |
5899 | 5899 | $try_to_keep_the_string_length |
5900 | 5900 | ); |
5901 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5901 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5902 | 5902 | |
5903 | 5903 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5904 | 5904 | |
5905 | - $str = (string) \preg_replace_callback( |
|
5905 | + $str = (string)\preg_replace_callback( |
|
5906 | 5906 | '/[-_\\s]+(.)?/u', |
5907 | 5907 | /** |
5908 | 5908 | * @param array $match |
@@ -5911,7 +5911,7 @@ discard block |
||
5911 | 5911 | * |
5912 | 5912 | * @return string |
5913 | 5913 | */ |
5914 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5914 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5915 | 5915 | if (isset($match[1])) { |
5916 | 5916 | if ($use_mb_functions) { |
5917 | 5917 | if ($encoding === 'UTF-8') { |
@@ -5929,7 +5929,7 @@ discard block |
||
5929 | 5929 | $str |
5930 | 5930 | ); |
5931 | 5931 | |
5932 | - return (string) \preg_replace_callback( |
|
5932 | + return (string)\preg_replace_callback( |
|
5933 | 5933 | '/[\\p{N}]+(.)?/u', |
5934 | 5934 | /** |
5935 | 5935 | * @param array $match |
@@ -5938,7 +5938,7 @@ discard block |
||
5938 | 5938 | * |
5939 | 5939 | * @return string |
5940 | 5940 | */ |
5941 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5941 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5942 | 5942 | if ($use_mb_functions) { |
5943 | 5943 | if ($encoding === 'UTF-8') { |
5944 | 5944 | return \mb_strtoupper($match[0]); |
@@ -6132,7 +6132,7 @@ discard block |
||
6132 | 6132 | ): string { |
6133 | 6133 | if (self::$SUPPORT['mbstring'] === true) { |
6134 | 6134 | /** @noinspection PhpComposerExtensionStubsInspection */ |
6135 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
6135 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
6136 | 6136 | |
6137 | 6137 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
6138 | 6138 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6142,10 +6142,10 @@ discard block |
||
6142 | 6142 | } |
6143 | 6143 | |
6144 | 6144 | /** @noinspection PhpComposerExtensionStubsInspection */ |
6145 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
6145 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
6146 | 6146 | } |
6147 | 6147 | |
6148 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
6148 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
6149 | 6149 | |
6150 | 6150 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
6151 | 6151 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6154,7 +6154,7 @@ discard block |
||
6154 | 6154 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
6155 | 6155 | } |
6156 | 6156 | |
6157 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
6157 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
6158 | 6158 | } |
6159 | 6159 | |
6160 | 6160 | /** |
@@ -6178,7 +6178,7 @@ discard block |
||
6178 | 6178 | public static function str_detect_encoding($str) |
6179 | 6179 | { |
6180 | 6180 | // init |
6181 | - $str = (string) $str; |
|
6181 | + $str = (string)$str; |
|
6182 | 6182 | |
6183 | 6183 | // |
6184 | 6184 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -6280,7 +6280,7 @@ discard block |
||
6280 | 6280 | foreach (self::$ENCODINGS as $encoding_tmp) { |
6281 | 6281 | // INFO: //IGNORE but still throw notice |
6282 | 6282 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
6283 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
6283 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
6284 | 6284 | return $encoding_tmp; |
6285 | 6285 | } |
6286 | 6286 | } |
@@ -6383,7 +6383,7 @@ discard block |
||
6383 | 6383 | return $str; |
6384 | 6384 | } |
6385 | 6385 | |
6386 | - return $substring . $str; |
|
6386 | + return $substring.$str; |
|
6387 | 6387 | } |
6388 | 6388 | |
6389 | 6389 | /** |
@@ -6679,27 +6679,27 @@ discard block |
||
6679 | 6679 | string $encoding = 'UTF-8' |
6680 | 6680 | ): string { |
6681 | 6681 | if ($encoding === 'UTF-8') { |
6682 | - $len = (int) \mb_strlen($str); |
|
6682 | + $len = (int)\mb_strlen($str); |
|
6683 | 6683 | if ($index > $len) { |
6684 | 6684 | return $str; |
6685 | 6685 | } |
6686 | 6686 | |
6687 | 6687 | /** @noinspection UnnecessaryCastingInspection */ |
6688 | - return (string) \mb_substr($str, 0, $index) . |
|
6689 | - $substring . |
|
6690 | - (string) \mb_substr($str, $index, $len); |
|
6688 | + return (string)\mb_substr($str, 0, $index). |
|
6689 | + $substring. |
|
6690 | + (string)\mb_substr($str, $index, $len); |
|
6691 | 6691 | } |
6692 | 6692 | |
6693 | 6693 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6694 | 6694 | |
6695 | - $len = (int) self::strlen($str, $encoding); |
|
6695 | + $len = (int)self::strlen($str, $encoding); |
|
6696 | 6696 | if ($index > $len) { |
6697 | 6697 | return $str; |
6698 | 6698 | } |
6699 | 6699 | |
6700 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
6701 | - $substring . |
|
6702 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6700 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
6701 | + $substring. |
|
6702 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
6703 | 6703 | } |
6704 | 6704 | |
6705 | 6705 | /** |
@@ -6739,15 +6739,15 @@ discard block |
||
6739 | 6739 | */ |
6740 | 6740 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
6741 | 6741 | { |
6742 | - $search = (array) $search; |
|
6742 | + $search = (array)$search; |
|
6743 | 6743 | |
6744 | 6744 | /** @noinspection AlterInForeachInspection */ |
6745 | 6745 | foreach ($search as &$s) { |
6746 | - $s = (string) $s; |
|
6746 | + $s = (string)$s; |
|
6747 | 6747 | if ($s === '') { |
6748 | 6748 | $s = '/^(?<=.)$/'; |
6749 | 6749 | } else { |
6750 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
6750 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
6751 | 6751 | } |
6752 | 6752 | } |
6753 | 6753 | |
@@ -6785,11 +6785,11 @@ discard block |
||
6785 | 6785 | } |
6786 | 6786 | |
6787 | 6787 | if ($search === '') { |
6788 | - return $str . $replacement; |
|
6788 | + return $str.$replacement; |
|
6789 | 6789 | } |
6790 | 6790 | |
6791 | 6791 | if (\stripos($str, $search) === 0) { |
6792 | - return $replacement . \substr($str, \strlen($search)); |
|
6792 | + return $replacement.\substr($str, \strlen($search)); |
|
6793 | 6793 | } |
6794 | 6794 | |
6795 | 6795 | return $str; |
@@ -6820,11 +6820,11 @@ discard block |
||
6820 | 6820 | } |
6821 | 6821 | |
6822 | 6822 | if ($search === '') { |
6823 | - return $str . $replacement; |
|
6823 | + return $str.$replacement; |
|
6824 | 6824 | } |
6825 | 6825 | |
6826 | 6826 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6827 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6827 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6828 | 6828 | } |
6829 | 6829 | |
6830 | 6830 | return $str; |
@@ -6916,15 +6916,15 @@ discard block |
||
6916 | 6916 | } |
6917 | 6917 | |
6918 | 6918 | if ($encoding === 'UTF-8') { |
6919 | - return (string) \mb_substr( |
|
6919 | + return (string)\mb_substr( |
|
6920 | 6920 | $str, |
6921 | - $offset + (int) \mb_strlen($separator) |
|
6921 | + $offset + (int)\mb_strlen($separator) |
|
6922 | 6922 | ); |
6923 | 6923 | } |
6924 | 6924 | |
6925 | - return (string) self::substr( |
|
6925 | + return (string)self::substr( |
|
6926 | 6926 | $str, |
6927 | - $offset + (int) self::strlen($separator, $encoding), |
|
6927 | + $offset + (int)self::strlen($separator, $encoding), |
|
6928 | 6928 | null, |
6929 | 6929 | $encoding |
6930 | 6930 | ); |
@@ -6956,15 +6956,15 @@ discard block |
||
6956 | 6956 | } |
6957 | 6957 | |
6958 | 6958 | if ($encoding === 'UTF-8') { |
6959 | - return (string) \mb_substr( |
|
6959 | + return (string)\mb_substr( |
|
6960 | 6960 | $str, |
6961 | - $offset + (int) self::strlen($separator) |
|
6961 | + $offset + (int)self::strlen($separator) |
|
6962 | 6962 | ); |
6963 | 6963 | } |
6964 | 6964 | |
6965 | - return (string) self::substr( |
|
6965 | + return (string)self::substr( |
|
6966 | 6966 | $str, |
6967 | - $offset + (int) self::strlen($separator, $encoding), |
|
6967 | + $offset + (int)self::strlen($separator, $encoding), |
|
6968 | 6968 | null, |
6969 | 6969 | $encoding |
6970 | 6970 | ); |
@@ -6996,10 +6996,10 @@ discard block |
||
6996 | 6996 | } |
6997 | 6997 | |
6998 | 6998 | if ($encoding === 'UTF-8') { |
6999 | - return (string) \mb_substr($str, 0, $offset); |
|
6999 | + return (string)\mb_substr($str, 0, $offset); |
|
7000 | 7000 | } |
7001 | 7001 | |
7002 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
7002 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
7003 | 7003 | } |
7004 | 7004 | |
7005 | 7005 | /** |
@@ -7028,7 +7028,7 @@ discard block |
||
7028 | 7028 | return ''; |
7029 | 7029 | } |
7030 | 7030 | |
7031 | - return (string) \mb_substr($str, 0, $offset); |
|
7031 | + return (string)\mb_substr($str, 0, $offset); |
|
7032 | 7032 | } |
7033 | 7033 | |
7034 | 7034 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -7036,7 +7036,7 @@ discard block |
||
7036 | 7036 | return ''; |
7037 | 7037 | } |
7038 | 7038 | |
7039 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
7039 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
7040 | 7040 | } |
7041 | 7041 | |
7042 | 7042 | /** |
@@ -7138,12 +7138,12 @@ discard block |
||
7138 | 7138 | } |
7139 | 7139 | |
7140 | 7140 | if ($encoding === 'UTF-8') { |
7141 | - return (string) \mb_substr($str, -$n); |
|
7141 | + return (string)\mb_substr($str, -$n); |
|
7142 | 7142 | } |
7143 | 7143 | |
7144 | 7144 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7145 | 7145 | |
7146 | - return (string) self::substr($str, -$n, null, $encoding); |
|
7146 | + return (string)self::substr($str, -$n, null, $encoding); |
|
7147 | 7147 | } |
7148 | 7148 | |
7149 | 7149 | /** |
@@ -7169,21 +7169,21 @@ discard block |
||
7169 | 7169 | } |
7170 | 7170 | |
7171 | 7171 | if ($encoding === 'UTF-8') { |
7172 | - if ((int) \mb_strlen($str) <= $length) { |
|
7172 | + if ((int)\mb_strlen($str) <= $length) { |
|
7173 | 7173 | return $str; |
7174 | 7174 | } |
7175 | 7175 | |
7176 | 7176 | /** @noinspection UnnecessaryCastingInspection */ |
7177 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
7177 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
7178 | 7178 | } |
7179 | 7179 | |
7180 | 7180 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7181 | 7181 | |
7182 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
7182 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
7183 | 7183 | return $str; |
7184 | 7184 | } |
7185 | 7185 | |
7186 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
7186 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
7187 | 7187 | } |
7188 | 7188 | |
7189 | 7189 | /** |
@@ -7212,12 +7212,12 @@ discard block |
||
7212 | 7212 | |
7213 | 7213 | if ($encoding === 'UTF-8') { |
7214 | 7214 | /** @noinspection UnnecessaryCastingInspection */ |
7215 | - if ((int) \mb_strlen($str) <= $length) { |
|
7215 | + if ((int)\mb_strlen($str) <= $length) { |
|
7216 | 7216 | return $str; |
7217 | 7217 | } |
7218 | 7218 | |
7219 | 7219 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
7220 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
7220 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
7221 | 7221 | } |
7222 | 7222 | |
7223 | 7223 | $str = \mb_substr($str, 0, $length); |
@@ -7226,33 +7226,33 @@ discard block |
||
7226 | 7226 | $new_str = \implode(' ', $array); |
7227 | 7227 | |
7228 | 7228 | if ($new_str === '') { |
7229 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
7229 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
7230 | 7230 | } |
7231 | 7231 | } else { |
7232 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
7232 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
7233 | 7233 | return $str; |
7234 | 7234 | } |
7235 | 7235 | |
7236 | 7236 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
7237 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
7237 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
7238 | 7238 | } |
7239 | 7239 | |
7240 | 7240 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
7241 | 7241 | $str = self::substr($str, 0, $length, $encoding); |
7242 | 7242 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
7243 | 7243 | if ($str === false) { |
7244 | - return '' . $str_add_on; |
|
7244 | + return ''.$str_add_on; |
|
7245 | 7245 | } |
7246 | 7246 | |
7247 | 7247 | $array = \explode(' ', $str, -1); |
7248 | 7248 | $new_str = \implode(' ', $array); |
7249 | 7249 | |
7250 | 7250 | if ($new_str === '') { |
7251 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
7251 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
7252 | 7252 | } |
7253 | 7253 | } |
7254 | 7254 | |
7255 | - return $new_str . $str_add_on; |
|
7255 | + return $new_str.$str_add_on; |
|
7256 | 7256 | } |
7257 | 7257 | |
7258 | 7258 | /** |
@@ -7275,7 +7275,7 @@ discard block |
||
7275 | 7275 | $longest_common_prefix = ''; |
7276 | 7276 | |
7277 | 7277 | if ($encoding === 'UTF-8') { |
7278 | - $max_length = (int) \min( |
|
7278 | + $max_length = (int)\min( |
|
7279 | 7279 | \mb_strlen($str1), |
7280 | 7280 | \mb_strlen($str2) |
7281 | 7281 | ); |
@@ -7296,7 +7296,7 @@ discard block |
||
7296 | 7296 | } else { |
7297 | 7297 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7298 | 7298 | |
7299 | - $max_length = (int) \min( |
|
7299 | + $max_length = (int)\min( |
|
7300 | 7300 | self::strlen($str1, $encoding), |
7301 | 7301 | self::strlen($str2, $encoding) |
7302 | 7302 | ); |
@@ -7345,13 +7345,13 @@ discard block |
||
7345 | 7345 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
7346 | 7346 | |
7347 | 7347 | if ($encoding === 'UTF-8') { |
7348 | - $str_length = (int) \mb_strlen($str1); |
|
7349 | - $other_length = (int) \mb_strlen($str2); |
|
7348 | + $str_length = (int)\mb_strlen($str1); |
|
7349 | + $other_length = (int)\mb_strlen($str2); |
|
7350 | 7350 | } else { |
7351 | 7351 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7352 | 7352 | |
7353 | - $str_length = (int) self::strlen($str1, $encoding); |
|
7354 | - $other_length = (int) self::strlen($str2, $encoding); |
|
7353 | + $str_length = (int)self::strlen($str1, $encoding); |
|
7354 | + $other_length = (int)self::strlen($str2, $encoding); |
|
7355 | 7355 | } |
7356 | 7356 | |
7357 | 7357 | // Return if either string is empty |
@@ -7404,10 +7404,10 @@ discard block |
||
7404 | 7404 | } |
7405 | 7405 | |
7406 | 7406 | if ($encoding === 'UTF-8') { |
7407 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
7407 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
7408 | 7408 | } |
7409 | 7409 | |
7410 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
7410 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
7411 | 7411 | } |
7412 | 7412 | |
7413 | 7413 | /** |
@@ -7431,7 +7431,7 @@ discard block |
||
7431 | 7431 | } |
7432 | 7432 | |
7433 | 7433 | if ($encoding === 'UTF-8') { |
7434 | - $max_length = (int) \min( |
|
7434 | + $max_length = (int)\min( |
|
7435 | 7435 | \mb_strlen($str1, $encoding), |
7436 | 7436 | \mb_strlen($str2, $encoding) |
7437 | 7437 | ); |
@@ -7445,7 +7445,7 @@ discard block |
||
7445 | 7445 | && |
7446 | 7446 | $char === \mb_substr($str2, -$i, 1) |
7447 | 7447 | ) { |
7448 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7448 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7449 | 7449 | } else { |
7450 | 7450 | break; |
7451 | 7451 | } |
@@ -7453,7 +7453,7 @@ discard block |
||
7453 | 7453 | } else { |
7454 | 7454 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7455 | 7455 | |
7456 | - $max_length = (int) \min( |
|
7456 | + $max_length = (int)\min( |
|
7457 | 7457 | self::strlen($str1, $encoding), |
7458 | 7458 | self::strlen($str2, $encoding) |
7459 | 7459 | ); |
@@ -7467,7 +7467,7 @@ discard block |
||
7467 | 7467 | && |
7468 | 7468 | $char === self::substr($str2, -$i, 1, $encoding) |
7469 | 7469 | ) { |
7470 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7470 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7471 | 7471 | } else { |
7472 | 7472 | break; |
7473 | 7473 | } |
@@ -7490,7 +7490,7 @@ discard block |
||
7490 | 7490 | */ |
7491 | 7491 | public static function str_matches_pattern(string $str, string $pattern): bool |
7492 | 7492 | { |
7493 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
7493 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
7494 | 7494 | } |
7495 | 7495 | |
7496 | 7496 | /** |
@@ -7510,7 +7510,7 @@ discard block |
||
7510 | 7510 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
7511 | 7511 | { |
7512 | 7512 | // init |
7513 | - $length = (int) self::strlen($str, $encoding); |
|
7513 | + $length = (int)self::strlen($str, $encoding); |
|
7514 | 7514 | |
7515 | 7515 | if ($offset >= 0) { |
7516 | 7516 | return $length > $offset; |
@@ -7539,7 +7539,7 @@ discard block |
||
7539 | 7539 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
7540 | 7540 | { |
7541 | 7541 | // init |
7542 | - $length = (int) self::strlen($str); |
|
7542 | + $length = (int)self::strlen($str); |
|
7543 | 7543 | |
7544 | 7544 | if ( |
7545 | 7545 | ($index >= 0 && $length <= $index) |
@@ -7583,7 +7583,7 @@ discard block |
||
7583 | 7583 | return $str; |
7584 | 7584 | } |
7585 | 7585 | |
7586 | - if ($pad_type !== (int) $pad_type) { |
|
7586 | + if ($pad_type !== (int)$pad_type) { |
|
7587 | 7587 | if ($pad_type === 'left') { |
7588 | 7588 | $pad_type = \STR_PAD_LEFT; |
7589 | 7589 | } elseif ($pad_type === 'right') { |
@@ -7592,23 +7592,23 @@ discard block |
||
7592 | 7592 | $pad_type = \STR_PAD_BOTH; |
7593 | 7593 | } else { |
7594 | 7594 | throw new \InvalidArgumentException( |
7595 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
7595 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
7596 | 7596 | ); |
7597 | 7597 | } |
7598 | 7598 | } |
7599 | 7599 | |
7600 | 7600 | if ($encoding === 'UTF-8') { |
7601 | - $str_length = (int) \mb_strlen($str); |
|
7601 | + $str_length = (int)\mb_strlen($str); |
|
7602 | 7602 | |
7603 | 7603 | if ($pad_length >= $str_length) { |
7604 | 7604 | switch ($pad_type) { |
7605 | 7605 | case \STR_PAD_LEFT: |
7606 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7606 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7607 | 7607 | |
7608 | 7608 | $diff = ($pad_length - $str_length); |
7609 | 7609 | |
7610 | - $pre = (string) \mb_substr( |
|
7611 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7610 | + $pre = (string)\mb_substr( |
|
7611 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7612 | 7612 | 0, |
7613 | 7613 | $diff |
7614 | 7614 | ); |
@@ -7619,16 +7619,16 @@ discard block |
||
7619 | 7619 | case \STR_PAD_BOTH: |
7620 | 7620 | $diff = ($pad_length - $str_length); |
7621 | 7621 | |
7622 | - $ps_length_left = (int) \floor($diff / 2); |
|
7622 | + $ps_length_left = (int)\floor($diff / 2); |
|
7623 | 7623 | |
7624 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7624 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7625 | 7625 | |
7626 | - $pre = (string) \mb_substr( |
|
7626 | + $pre = (string)\mb_substr( |
|
7627 | 7627 | \str_repeat($pad_string, $ps_length_left), |
7628 | 7628 | 0, |
7629 | 7629 | $ps_length_left |
7630 | 7630 | ); |
7631 | - $post = (string) \mb_substr( |
|
7631 | + $post = (string)\mb_substr( |
|
7632 | 7632 | \str_repeat($pad_string, $ps_length_right), |
7633 | 7633 | 0, |
7634 | 7634 | $ps_length_right |
@@ -7638,19 +7638,19 @@ discard block |
||
7638 | 7638 | |
7639 | 7639 | case \STR_PAD_RIGHT: |
7640 | 7640 | default: |
7641 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7641 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7642 | 7642 | |
7643 | 7643 | $diff = ($pad_length - $str_length); |
7644 | 7644 | |
7645 | - $post = (string) \mb_substr( |
|
7646 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7645 | + $post = (string)\mb_substr( |
|
7646 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7647 | 7647 | 0, |
7648 | 7648 | $diff |
7649 | 7649 | ); |
7650 | 7650 | $pre = ''; |
7651 | 7651 | } |
7652 | 7652 | |
7653 | - return $pre . $str . $post; |
|
7653 | + return $pre.$str.$post; |
|
7654 | 7654 | } |
7655 | 7655 | |
7656 | 7656 | return $str; |
@@ -7658,17 +7658,17 @@ discard block |
||
7658 | 7658 | |
7659 | 7659 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7660 | 7660 | |
7661 | - $str_length = (int) self::strlen($str, $encoding); |
|
7661 | + $str_length = (int)self::strlen($str, $encoding); |
|
7662 | 7662 | |
7663 | 7663 | if ($pad_length >= $str_length) { |
7664 | 7664 | switch ($pad_type) { |
7665 | 7665 | case \STR_PAD_LEFT: |
7666 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7666 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7667 | 7667 | |
7668 | 7668 | $diff = ($pad_length - $str_length); |
7669 | 7669 | |
7670 | - $pre = (string) self::substr( |
|
7671 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7670 | + $pre = (string)self::substr( |
|
7671 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7672 | 7672 | 0, |
7673 | 7673 | $diff, |
7674 | 7674 | $encoding |
@@ -7680,17 +7680,17 @@ discard block |
||
7680 | 7680 | case \STR_PAD_BOTH: |
7681 | 7681 | $diff = ($pad_length - $str_length); |
7682 | 7682 | |
7683 | - $ps_length_left = (int) \floor($diff / 2); |
|
7683 | + $ps_length_left = (int)\floor($diff / 2); |
|
7684 | 7684 | |
7685 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7685 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7686 | 7686 | |
7687 | - $pre = (string) self::substr( |
|
7687 | + $pre = (string)self::substr( |
|
7688 | 7688 | \str_repeat($pad_string, $ps_length_left), |
7689 | 7689 | 0, |
7690 | 7690 | $ps_length_left, |
7691 | 7691 | $encoding |
7692 | 7692 | ); |
7693 | - $post = (string) self::substr( |
|
7693 | + $post = (string)self::substr( |
|
7694 | 7694 | \str_repeat($pad_string, $ps_length_right), |
7695 | 7695 | 0, |
7696 | 7696 | $ps_length_right, |
@@ -7701,12 +7701,12 @@ discard block |
||
7701 | 7701 | |
7702 | 7702 | case \STR_PAD_RIGHT: |
7703 | 7703 | default: |
7704 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7704 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7705 | 7705 | |
7706 | 7706 | $diff = ($pad_length - $str_length); |
7707 | 7707 | |
7708 | - $post = (string) self::substr( |
|
7709 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7708 | + $post = (string)self::substr( |
|
7709 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7710 | 7710 | 0, |
7711 | 7711 | $diff, |
7712 | 7712 | $encoding |
@@ -7714,7 +7714,7 @@ discard block |
||
7714 | 7714 | $pre = ''; |
7715 | 7715 | } |
7716 | 7716 | |
7717 | - return $pre . $str . $post; |
|
7717 | + return $pre.$str.$post; |
|
7718 | 7718 | } |
7719 | 7719 | |
7720 | 7720 | return $str; |
@@ -7923,11 +7923,11 @@ discard block |
||
7923 | 7923 | } |
7924 | 7924 | |
7925 | 7925 | if ($search === '') { |
7926 | - return $str . $replacement; |
|
7926 | + return $str.$replacement; |
|
7927 | 7927 | } |
7928 | 7928 | |
7929 | 7929 | if (\strpos($str, $search) === 0) { |
7930 | - return $replacement . \substr($str, \strlen($search)); |
|
7930 | + return $replacement.\substr($str, \strlen($search)); |
|
7931 | 7931 | } |
7932 | 7932 | |
7933 | 7933 | return $str; |
@@ -7961,11 +7961,11 @@ discard block |
||
7961 | 7961 | } |
7962 | 7962 | |
7963 | 7963 | if ($search === '') { |
7964 | - return $str . $replacement; |
|
7964 | + return $str.$replacement; |
|
7965 | 7965 | } |
7966 | 7966 | |
7967 | 7967 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
7968 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
7968 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
7969 | 7969 | } |
7970 | 7970 | |
7971 | 7971 | return $str; |
@@ -7999,7 +7999,7 @@ discard block |
||
7999 | 7999 | $subject, |
8000 | 8000 | $replace, |
8001 | 8001 | $pos, |
8002 | - (int) self::strlen($search) |
|
8002 | + (int)self::strlen($search) |
|
8003 | 8003 | ); |
8004 | 8004 | } |
8005 | 8005 | |
@@ -8033,7 +8033,7 @@ discard block |
||
8033 | 8033 | $subject, |
8034 | 8034 | $replace, |
8035 | 8035 | $pos, |
8036 | - (int) self::strlen($search) |
|
8036 | + (int)self::strlen($search) |
|
8037 | 8037 | ); |
8038 | 8038 | } |
8039 | 8039 | |
@@ -8056,7 +8056,7 @@ discard block |
||
8056 | 8056 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
8057 | 8057 | { |
8058 | 8058 | if ($encoding === 'UTF-8') { |
8059 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
8059 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
8060 | 8060 | /** @noinspection NonSecureShuffleUsageInspection */ |
8061 | 8061 | \shuffle($indexes); |
8062 | 8062 | |
@@ -8072,7 +8072,7 @@ discard block |
||
8072 | 8072 | } else { |
8073 | 8073 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8074 | 8074 | |
8075 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
8075 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
8076 | 8076 | /** @noinspection NonSecureShuffleUsageInspection */ |
8077 | 8077 | \shuffle($indexes); |
8078 | 8078 | |
@@ -8115,11 +8115,11 @@ discard block |
||
8115 | 8115 | ) { |
8116 | 8116 | if ($encoding === 'UTF-8') { |
8117 | 8117 | if ($end === null) { |
8118 | - $length = (int) \mb_strlen($str); |
|
8118 | + $length = (int)\mb_strlen($str); |
|
8119 | 8119 | } elseif ($end >= 0 && $end <= $start) { |
8120 | 8120 | return ''; |
8121 | 8121 | } elseif ($end < 0) { |
8122 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
8122 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
8123 | 8123 | } else { |
8124 | 8124 | $length = $end - $start; |
8125 | 8125 | } |
@@ -8130,11 +8130,11 @@ discard block |
||
8130 | 8130 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8131 | 8131 | |
8132 | 8132 | if ($end === null) { |
8133 | - $length = (int) self::strlen($str, $encoding); |
|
8133 | + $length = (int)self::strlen($str, $encoding); |
|
8134 | 8134 | } elseif ($end >= 0 && $end <= $start) { |
8135 | 8135 | return ''; |
8136 | 8136 | } elseif ($end < 0) { |
8137 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
8137 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
8138 | 8138 | } else { |
8139 | 8139 | $length = $end - $start; |
8140 | 8140 | } |
@@ -8169,7 +8169,7 @@ discard block |
||
8169 | 8169 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8170 | 8170 | } |
8171 | 8171 | |
8172 | - $str = (string) \preg_replace_callback( |
|
8172 | + $str = (string)\preg_replace_callback( |
|
8173 | 8173 | '/([\\p{N}|\\p{Lu}])/u', |
8174 | 8174 | /** |
8175 | 8175 | * @param string[] $matches |
@@ -8178,28 +8178,28 @@ discard block |
||
8178 | 8178 | * |
8179 | 8179 | * @return string |
8180 | 8180 | */ |
8181 | - static function (array $matches) use ($encoding): string { |
|
8181 | + static function(array $matches) use ($encoding): string { |
|
8182 | 8182 | $match = $matches[1]; |
8183 | - $match_int = (int) $match; |
|
8183 | + $match_int = (int)$match; |
|
8184 | 8184 | |
8185 | - if ((string) $match_int === $match) { |
|
8186 | - return '_' . $match . '_'; |
|
8185 | + if ((string)$match_int === $match) { |
|
8186 | + return '_'.$match.'_'; |
|
8187 | 8187 | } |
8188 | 8188 | |
8189 | 8189 | if ($encoding === 'UTF-8') { |
8190 | - return '_' . \mb_strtolower($match); |
|
8190 | + return '_'.\mb_strtolower($match); |
|
8191 | 8191 | } |
8192 | 8192 | |
8193 | - return '_' . self::strtolower($match, $encoding); |
|
8193 | + return '_'.self::strtolower($match, $encoding); |
|
8194 | 8194 | }, |
8195 | 8195 | $str |
8196 | 8196 | ); |
8197 | 8197 | |
8198 | - $str = (string) \preg_replace( |
|
8198 | + $str = (string)\preg_replace( |
|
8199 | 8199 | [ |
8200 | - '/\\s+/u', // convert spaces to "_" |
|
8200 | + '/\\s+/u', // convert spaces to "_" |
|
8201 | 8201 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
8202 | - '/_+/', // remove double "_" |
|
8202 | + '/_+/', // remove double "_" |
|
8203 | 8203 | ], |
8204 | 8204 | [ |
8205 | 8205 | '_', |
@@ -8330,7 +8330,7 @@ discard block |
||
8330 | 8330 | } |
8331 | 8331 | |
8332 | 8332 | // init |
8333 | - $input = (string) $input; |
|
8333 | + $input = (string)$input; |
|
8334 | 8334 | |
8335 | 8335 | if ($input === '') { |
8336 | 8336 | return []; |
@@ -8387,7 +8387,7 @@ discard block |
||
8387 | 8387 | ($input[$i] & "\xE0") === "\xC0" |
8388 | 8388 | ) { |
8389 | 8389 | if (($input[$i + 1] & "\xC0") === "\x80") { |
8390 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
8390 | + $ret[] = $input[$i].$input[$i + 1]; |
|
8391 | 8391 | |
8392 | 8392 | ++$i; |
8393 | 8393 | } |
@@ -8401,7 +8401,7 @@ discard block |
||
8401 | 8401 | && |
8402 | 8402 | ($input[$i + 2] & "\xC0") === "\x80" |
8403 | 8403 | ) { |
8404 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
8404 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
8405 | 8405 | |
8406 | 8406 | $i += 2; |
8407 | 8407 | } |
@@ -8417,7 +8417,7 @@ discard block |
||
8417 | 8417 | && |
8418 | 8418 | ($input[$i + 3] & "\xC0") === "\x80" |
8419 | 8419 | ) { |
8420 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
8420 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
8421 | 8421 | |
8422 | 8422 | $i += 3; |
8423 | 8423 | } |
@@ -8429,7 +8429,7 @@ discard block |
||
8429 | 8429 | $ret = \array_chunk($ret, $length); |
8430 | 8430 | |
8431 | 8431 | return \array_map( |
8432 | - static function (array &$item): string { |
|
8432 | + static function(array &$item): string { |
|
8433 | 8433 | return \implode('', $item); |
8434 | 8434 | }, |
8435 | 8435 | $ret |
@@ -8495,7 +8495,7 @@ discard block |
||
8495 | 8495 | $limit = -1; |
8496 | 8496 | } |
8497 | 8497 | |
8498 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
8498 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
8499 | 8499 | |
8500 | 8500 | if ($array === false) { |
8501 | 8501 | return []; |
@@ -8591,9 +8591,9 @@ discard block |
||
8591 | 8591 | return ''; |
8592 | 8592 | } |
8593 | 8593 | |
8594 | - return (string) \mb_substr( |
|
8594 | + return (string)\mb_substr( |
|
8595 | 8595 | $str, |
8596 | - $offset + (int) \mb_strlen($separator) |
|
8596 | + $offset + (int)\mb_strlen($separator) |
|
8597 | 8597 | ); |
8598 | 8598 | } |
8599 | 8599 | |
@@ -8602,9 +8602,9 @@ discard block |
||
8602 | 8602 | return ''; |
8603 | 8603 | } |
8604 | 8604 | |
8605 | - return (string) \mb_substr( |
|
8605 | + return (string)\mb_substr( |
|
8606 | 8606 | $str, |
8607 | - $offset + (int) self::strlen($separator, $encoding), |
|
8607 | + $offset + (int)self::strlen($separator, $encoding), |
|
8608 | 8608 | null, |
8609 | 8609 | $encoding |
8610 | 8610 | ); |
@@ -8636,9 +8636,9 @@ discard block |
||
8636 | 8636 | return ''; |
8637 | 8637 | } |
8638 | 8638 | |
8639 | - return (string) \mb_substr( |
|
8639 | + return (string)\mb_substr( |
|
8640 | 8640 | $str, |
8641 | - $offset + (int) \mb_strlen($separator) |
|
8641 | + $offset + (int)\mb_strlen($separator) |
|
8642 | 8642 | ); |
8643 | 8643 | } |
8644 | 8644 | |
@@ -8647,9 +8647,9 @@ discard block |
||
8647 | 8647 | return ''; |
8648 | 8648 | } |
8649 | 8649 | |
8650 | - return (string) self::substr( |
|
8650 | + return (string)self::substr( |
|
8651 | 8651 | $str, |
8652 | - $offset + (int) self::strlen($separator, $encoding), |
|
8652 | + $offset + (int)self::strlen($separator, $encoding), |
|
8653 | 8653 | null, |
8654 | 8654 | $encoding |
8655 | 8655 | ); |
@@ -8681,7 +8681,7 @@ discard block |
||
8681 | 8681 | return ''; |
8682 | 8682 | } |
8683 | 8683 | |
8684 | - return (string) \mb_substr( |
|
8684 | + return (string)\mb_substr( |
|
8685 | 8685 | $str, |
8686 | 8686 | 0, |
8687 | 8687 | $offset |
@@ -8693,7 +8693,7 @@ discard block |
||
8693 | 8693 | return ''; |
8694 | 8694 | } |
8695 | 8695 | |
8696 | - return (string) self::substr( |
|
8696 | + return (string)self::substr( |
|
8697 | 8697 | $str, |
8698 | 8698 | 0, |
8699 | 8699 | $offset, |
@@ -8724,7 +8724,7 @@ discard block |
||
8724 | 8724 | return ''; |
8725 | 8725 | } |
8726 | 8726 | |
8727 | - return (string) \mb_substr( |
|
8727 | + return (string)\mb_substr( |
|
8728 | 8728 | $str, |
8729 | 8729 | 0, |
8730 | 8730 | $offset |
@@ -8738,7 +8738,7 @@ discard block |
||
8738 | 8738 | |
8739 | 8739 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8740 | 8740 | |
8741 | - return (string) self::substr( |
|
8741 | + return (string)self::substr( |
|
8742 | 8742 | $str, |
8743 | 8743 | 0, |
8744 | 8744 | $offset, |
@@ -8853,7 +8853,7 @@ discard block |
||
8853 | 8853 | */ |
8854 | 8854 | public static function str_surround(string $str, string $substring): string |
8855 | 8855 | { |
8856 | - return $substring . $str . $substring; |
|
8856 | + return $substring.$str.$substring; |
|
8857 | 8857 | } |
8858 | 8858 | |
8859 | 8859 | /** |
@@ -8917,9 +8917,9 @@ discard block |
||
8917 | 8917 | $word_define_chars = ''; |
8918 | 8918 | } |
8919 | 8919 | |
8920 | - $str = (string) \preg_replace_callback( |
|
8921 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
8922 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8920 | + $str = (string)\preg_replace_callback( |
|
8921 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
8922 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8923 | 8923 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
8924 | 8924 | return $match[0]; |
8925 | 8925 | } |
@@ -9019,16 +9019,16 @@ discard block |
||
9019 | 9019 | |
9020 | 9020 | // the main substitutions |
9021 | 9021 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
9022 | - $str = (string) \preg_replace_callback( |
|
9022 | + $str = (string)\preg_replace_callback( |
|
9023 | 9023 | '~\\b (_*) (?: # 1. Leading underscore and |
9024 | 9024 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
9025 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
9025 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
9026 | 9026 | | |
9027 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
9027 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
9028 | 9028 | | |
9029 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
9029 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
9030 | 9030 | | |
9031 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
9031 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
9032 | 9032 | ) (_*) \\b # 6. With trailing underscore |
9033 | 9033 | ~ux', |
9034 | 9034 | /** |
@@ -9038,7 +9038,7 @@ discard block |
||
9038 | 9038 | * |
9039 | 9039 | * @return string |
9040 | 9040 | */ |
9041 | - static function (array $matches) use ($encoding): string { |
|
9041 | + static function(array $matches) use ($encoding): string { |
|
9042 | 9042 | // preserve leading underscore |
9043 | 9043 | $str = $matches[1]; |
9044 | 9044 | if ($matches[2]) { |
@@ -9063,11 +9063,11 @@ discard block |
||
9063 | 9063 | ); |
9064 | 9064 | |
9065 | 9065 | // Exceptions for small words: capitalize at start of title... |
9066 | - $str = (string) \preg_replace_callback( |
|
9066 | + $str = (string)\preg_replace_callback( |
|
9067 | 9067 | '~( \\A [[:punct:]]* # start of title... |
9068 | 9068 | | [:.;?!][ ]+ # or of subsentence... |
9069 | 9069 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
9070 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
9070 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
9071 | 9071 | ~uxi', |
9072 | 9072 | /** |
9073 | 9073 | * @param string[] $matches |
@@ -9076,15 +9076,15 @@ discard block |
||
9076 | 9076 | * |
9077 | 9077 | * @return string |
9078 | 9078 | */ |
9079 | - static function (array $matches) use ($encoding): string { |
|
9080 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
9079 | + static function(array $matches) use ($encoding): string { |
|
9080 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
9081 | 9081 | }, |
9082 | 9082 | $str |
9083 | 9083 | ); |
9084 | 9084 | |
9085 | 9085 | // ...and end of title |
9086 | - $str = (string) \preg_replace_callback( |
|
9087 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
9086 | + $str = (string)\preg_replace_callback( |
|
9087 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
9088 | 9088 | (?= [[:punct:]]* \Z # ...at the end of the title... |
9089 | 9089 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
9090 | 9090 | ~uxi', |
@@ -9095,7 +9095,7 @@ discard block |
||
9095 | 9095 | * |
9096 | 9096 | * @return string |
9097 | 9097 | */ |
9098 | - static function (array $matches) use ($encoding): string { |
|
9098 | + static function(array $matches) use ($encoding): string { |
|
9099 | 9099 | return static::ucfirst($matches[1], $encoding); |
9100 | 9100 | }, |
9101 | 9101 | $str |
@@ -9103,10 +9103,10 @@ discard block |
||
9103 | 9103 | |
9104 | 9104 | // Exceptions for small words in hyphenated compound words. |
9105 | 9105 | // e.g. "in-flight" -> In-Flight |
9106 | - $str = (string) \preg_replace_callback( |
|
9106 | + $str = (string)\preg_replace_callback( |
|
9107 | 9107 | '~\\b |
9108 | 9108 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
9109 | - ( ' . $small_words_rx . ' ) |
|
9109 | + ( ' . $small_words_rx.' ) |
|
9110 | 9110 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
9111 | 9111 | ~uxi', |
9112 | 9112 | /** |
@@ -9116,18 +9116,18 @@ discard block |
||
9116 | 9116 | * |
9117 | 9117 | * @return string |
9118 | 9118 | */ |
9119 | - static function (array $matches) use ($encoding): string { |
|
9119 | + static function(array $matches) use ($encoding): string { |
|
9120 | 9120 | return static::ucfirst($matches[1], $encoding); |
9121 | 9121 | }, |
9122 | 9122 | $str |
9123 | 9123 | ); |
9124 | 9124 | |
9125 | 9125 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
9126 | - $str = (string) \preg_replace_callback( |
|
9126 | + $str = (string)\preg_replace_callback( |
|
9127 | 9127 | '~\\b |
9128 | 9128 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
9129 | 9129 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
9130 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
9130 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
9131 | 9131 | (?! - ) # Negative lookahead for another - |
9132 | 9132 | ~uxi', |
9133 | 9133 | /** |
@@ -9137,8 +9137,8 @@ discard block |
||
9137 | 9137 | * |
9138 | 9138 | * @return string |
9139 | 9139 | */ |
9140 | - static function (array $matches) use ($encoding): string { |
|
9141 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
9140 | + static function(array $matches) use ($encoding): string { |
|
9141 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
9142 | 9142 | }, |
9143 | 9143 | $str |
9144 | 9144 | ); |
@@ -9257,7 +9257,7 @@ discard block |
||
9257 | 9257 | ); |
9258 | 9258 | |
9259 | 9259 | foreach ($tmp_return as &$item) { |
9260 | - $item = (string) $item; |
|
9260 | + $item = (string)$item; |
|
9261 | 9261 | } |
9262 | 9262 | |
9263 | 9263 | return $tmp_return; |
@@ -9311,39 +9311,39 @@ discard block |
||
9311 | 9311 | } |
9312 | 9312 | |
9313 | 9313 | if ($encoding === 'UTF-8') { |
9314 | - if ($length >= (int) \mb_strlen($str)) { |
|
9314 | + if ($length >= (int)\mb_strlen($str)) { |
|
9315 | 9315 | return $str; |
9316 | 9316 | } |
9317 | 9317 | |
9318 | 9318 | if ($substring !== '') { |
9319 | - $length -= (int) \mb_strlen($substring); |
|
9319 | + $length -= (int)\mb_strlen($substring); |
|
9320 | 9320 | |
9321 | 9321 | /** @noinspection UnnecessaryCastingInspection */ |
9322 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
9322 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
9323 | 9323 | } |
9324 | 9324 | |
9325 | 9325 | /** @noinspection UnnecessaryCastingInspection */ |
9326 | - return (string) \mb_substr($str, 0, $length); |
|
9326 | + return (string)\mb_substr($str, 0, $length); |
|
9327 | 9327 | } |
9328 | 9328 | |
9329 | 9329 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9330 | 9330 | |
9331 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
9331 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
9332 | 9332 | return $str; |
9333 | 9333 | } |
9334 | 9334 | |
9335 | 9335 | if ($substring !== '') { |
9336 | - $length -= (int) self::strlen($substring, $encoding); |
|
9336 | + $length -= (int)self::strlen($substring, $encoding); |
|
9337 | 9337 | } |
9338 | 9338 | |
9339 | 9339 | return ( |
9340 | - (string) self::substr( |
|
9340 | + (string)self::substr( |
|
9341 | 9341 | $str, |
9342 | 9342 | 0, |
9343 | 9343 | $length, |
9344 | 9344 | $encoding |
9345 | 9345 | ) |
9346 | - ) . $substring; |
|
9346 | + ).$substring; |
|
9347 | 9347 | } |
9348 | 9348 | |
9349 | 9349 | /** |
@@ -9377,12 +9377,12 @@ discard block |
||
9377 | 9377 | } |
9378 | 9378 | |
9379 | 9379 | if ($encoding === 'UTF-8') { |
9380 | - if ($length >= (int) \mb_strlen($str)) { |
|
9380 | + if ($length >= (int)\mb_strlen($str)) { |
|
9381 | 9381 | return $str; |
9382 | 9382 | } |
9383 | 9383 | |
9384 | 9384 | // need to further trim the string so we can append the substring |
9385 | - $length -= (int) \mb_strlen($substring); |
|
9385 | + $length -= (int)\mb_strlen($substring); |
|
9386 | 9386 | if ($length <= 0) { |
9387 | 9387 | return $substring; |
9388 | 9388 | } |
@@ -9408,18 +9408,18 @@ discard block |
||
9408 | 9408 | !$ignore_do_not_split_words_for_one_word |
9409 | 9409 | ) |
9410 | 9410 | ) { |
9411 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
9411 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
9412 | 9412 | } |
9413 | 9413 | } |
9414 | 9414 | } else { |
9415 | 9415 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9416 | 9416 | |
9417 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
9417 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
9418 | 9418 | return $str; |
9419 | 9419 | } |
9420 | 9420 | |
9421 | 9421 | // need to further trim the string so we can append the substring |
9422 | - $length -= (int) self::strlen($substring, $encoding); |
|
9422 | + $length -= (int)self::strlen($substring, $encoding); |
|
9423 | 9423 | if ($length <= 0) { |
9424 | 9424 | return $substring; |
9425 | 9425 | } |
@@ -9445,12 +9445,12 @@ discard block |
||
9445 | 9445 | !$ignore_do_not_split_words_for_one_word |
9446 | 9446 | ) |
9447 | 9447 | ) { |
9448 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
9448 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
9449 | 9449 | } |
9450 | 9450 | } |
9451 | 9451 | } |
9452 | 9452 | |
9453 | - return $truncated . $substring; |
|
9453 | + return $truncated.$substring; |
|
9454 | 9454 | } |
9455 | 9455 | |
9456 | 9456 | /** |
@@ -9577,13 +9577,13 @@ discard block |
||
9577 | 9577 | } |
9578 | 9578 | } elseif ($format === 2) { |
9579 | 9579 | $number_of_words = []; |
9580 | - $offset = (int) self::strlen($str_parts[0]); |
|
9580 | + $offset = (int)self::strlen($str_parts[0]); |
|
9581 | 9581 | for ($i = 1; $i < $len; $i += 2) { |
9582 | 9582 | $number_of_words[$offset] = $str_parts[$i]; |
9583 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
9583 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
9584 | 9584 | } |
9585 | 9585 | } else { |
9586 | - $number_of_words = (int) (($len - 1) / 2); |
|
9586 | + $number_of_words = (int)(($len - 1) / 2); |
|
9587 | 9587 | } |
9588 | 9588 | |
9589 | 9589 | return $number_of_words; |
@@ -9716,7 +9716,7 @@ discard block |
||
9716 | 9716 | } |
9717 | 9717 | |
9718 | 9718 | if ($char_list === '') { |
9719 | - return (int) self::strlen($str, $encoding); |
|
9719 | + return (int)self::strlen($str, $encoding); |
|
9720 | 9720 | } |
9721 | 9721 | |
9722 | 9722 | if ($offset || $length !== null) { |
@@ -9743,7 +9743,7 @@ discard block |
||
9743 | 9743 | } |
9744 | 9744 | |
9745 | 9745 | $matches = []; |
9746 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
9746 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
9747 | 9747 | $return = self::strlen($matches[1], $encoding); |
9748 | 9748 | if ($return === false) { |
9749 | 9749 | return 0; |
@@ -9752,7 +9752,7 @@ discard block |
||
9752 | 9752 | return $return; |
9753 | 9753 | } |
9754 | 9754 | |
9755 | - return (int) self::strlen($str, $encoding); |
|
9755 | + return (int)self::strlen($str, $encoding); |
|
9756 | 9756 | } |
9757 | 9757 | |
9758 | 9758 | /** |
@@ -9815,7 +9815,7 @@ discard block |
||
9815 | 9815 | |
9816 | 9816 | $str = ''; |
9817 | 9817 | foreach ($intOrHex as $strPart) { |
9818 | - $str .= '&#' . (int) $strPart . ';'; |
|
9818 | + $str .= '&#'.(int)$strPart.';'; |
|
9819 | 9819 | } |
9820 | 9820 | |
9821 | 9821 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -9910,7 +9910,7 @@ discard block |
||
9910 | 9910 | return ''; |
9911 | 9911 | } |
9912 | 9912 | |
9913 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
9913 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
9914 | 9914 | } |
9915 | 9915 | |
9916 | 9916 | /** |
@@ -9981,7 +9981,7 @@ discard block |
||
9981 | 9981 | // fallback for ascii only |
9982 | 9982 | // |
9983 | 9983 | |
9984 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
9984 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
9985 | 9985 | return \stripos($haystack, $needle, $offset); |
9986 | 9986 | } |
9987 | 9987 | |
@@ -10062,7 +10062,7 @@ discard block |
||
10062 | 10062 | /** |
10063 | 10063 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10064 | 10064 | */ |
10065 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10065 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10066 | 10066 | } |
10067 | 10067 | |
10068 | 10068 | if ( |
@@ -10076,11 +10076,11 @@ discard block |
||
10076 | 10076 | } |
10077 | 10077 | } |
10078 | 10078 | |
10079 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
10079 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
10080 | 10080 | return \stristr($haystack, $needle, $before_needle); |
10081 | 10081 | } |
10082 | 10082 | |
10083 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
10083 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
10084 | 10084 | |
10085 | 10085 | if (!isset($match[1])) { |
10086 | 10086 | return false; |
@@ -10090,7 +10090,7 @@ discard block |
||
10090 | 10090 | return $match[1]; |
10091 | 10091 | } |
10092 | 10092 | |
10093 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
10093 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
10094 | 10094 | } |
10095 | 10095 | |
10096 | 10096 | /** |
@@ -10173,7 +10173,7 @@ discard block |
||
10173 | 10173 | /** |
10174 | 10174 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10175 | 10175 | */ |
10176 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10176 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10177 | 10177 | } |
10178 | 10178 | |
10179 | 10179 | // |
@@ -10311,8 +10311,8 @@ discard block |
||
10311 | 10311 | } |
10312 | 10312 | |
10313 | 10313 | return \strnatcmp( |
10314 | - (string) self::strtonatfold($str1), |
|
10315 | - (string) self::strtonatfold($str2) |
|
10314 | + (string)self::strtonatfold($str1), |
|
10315 | + (string)self::strtonatfold($str2) |
|
10316 | 10316 | ); |
10317 | 10317 | } |
10318 | 10318 | |
@@ -10382,11 +10382,11 @@ discard block |
||
10382 | 10382 | } |
10383 | 10383 | |
10384 | 10384 | if ($encoding === 'UTF-8') { |
10385 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
10386 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
10385 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
10386 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
10387 | 10387 | } else { |
10388 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
10389 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
10388 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
10389 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
10390 | 10390 | } |
10391 | 10391 | |
10392 | 10392 | return self::strcmp($str1, $str2); |
@@ -10413,8 +10413,8 @@ discard block |
||
10413 | 10413 | return false; |
10414 | 10414 | } |
10415 | 10415 | |
10416 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
10417 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
10416 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
10417 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
10418 | 10418 | } |
10419 | 10419 | |
10420 | 10420 | return false; |
@@ -10453,10 +10453,10 @@ discard block |
||
10453 | 10453 | } |
10454 | 10454 | |
10455 | 10455 | // iconv and mbstring do not support integer $needle |
10456 | - if ((int) $needle === $needle) { |
|
10457 | - $needle = (string) self::chr($needle); |
|
10456 | + if ((int)$needle === $needle) { |
|
10457 | + $needle = (string)self::chr($needle); |
|
10458 | 10458 | } |
10459 | - $needle = (string) $needle; |
|
10459 | + $needle = (string)$needle; |
|
10460 | 10460 | |
10461 | 10461 | if ($needle === '') { |
10462 | 10462 | return false; |
@@ -10508,7 +10508,7 @@ discard block |
||
10508 | 10508 | /** |
10509 | 10509 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10510 | 10510 | */ |
10511 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10511 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10512 | 10512 | } |
10513 | 10513 | |
10514 | 10514 | // |
@@ -10549,7 +10549,7 @@ discard block |
||
10549 | 10549 | // fallback for ascii only |
10550 | 10550 | // |
10551 | 10551 | |
10552 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10552 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10553 | 10553 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
10554 | 10554 | return @\strpos($haystack, $needle, $offset); |
10555 | 10555 | } |
@@ -10562,7 +10562,7 @@ discard block |
||
10562 | 10562 | if ($haystack_tmp === false) { |
10563 | 10563 | $haystack_tmp = ''; |
10564 | 10564 | } |
10565 | - $haystack = (string) $haystack_tmp; |
|
10565 | + $haystack = (string)$haystack_tmp; |
|
10566 | 10566 | |
10567 | 10567 | if ($offset < 0) { |
10568 | 10568 | $offset = 0; |
@@ -10574,7 +10574,7 @@ discard block |
||
10574 | 10574 | } |
10575 | 10575 | |
10576 | 10576 | if ($pos) { |
10577 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10577 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10578 | 10578 | } |
10579 | 10579 | |
10580 | 10580 | return $offset + 0; |
@@ -10729,7 +10729,7 @@ discard block |
||
10729 | 10729 | /** |
10730 | 10730 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10731 | 10731 | */ |
10732 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10732 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10733 | 10733 | } |
10734 | 10734 | |
10735 | 10735 | // |
@@ -10741,7 +10741,7 @@ discard block |
||
10741 | 10741 | if ($needle_tmp === false) { |
10742 | 10742 | return false; |
10743 | 10743 | } |
10744 | - $needle = (string) $needle_tmp; |
|
10744 | + $needle = (string)$needle_tmp; |
|
10745 | 10745 | |
10746 | 10746 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
10747 | 10747 | if ($pos === false) { |
@@ -10763,7 +10763,7 @@ discard block |
||
10763 | 10763 | if ($needle_tmp === false) { |
10764 | 10764 | return false; |
10765 | 10765 | } |
10766 | - $needle = (string) $needle_tmp; |
|
10766 | + $needle = (string)$needle_tmp; |
|
10767 | 10767 | |
10768 | 10768 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
10769 | 10769 | if ($pos === false) { |
@@ -10804,7 +10804,7 @@ discard block |
||
10804 | 10804 | if ($encoding === 'UTF-8') { |
10805 | 10805 | if (self::$SUPPORT['intl'] === true) { |
10806 | 10806 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
10807 | - $i = (int) \grapheme_strlen($str); |
|
10807 | + $i = (int)\grapheme_strlen($str); |
|
10808 | 10808 | while ($i--) { |
10809 | 10809 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
10810 | 10810 | if ($reversed_tmp !== false) { |
@@ -10812,7 +10812,7 @@ discard block |
||
10812 | 10812 | } |
10813 | 10813 | } |
10814 | 10814 | } else { |
10815 | - $i = (int) \mb_strlen($str); |
|
10815 | + $i = (int)\mb_strlen($str); |
|
10816 | 10816 | while ($i--) { |
10817 | 10817 | $reversed_tmp = \mb_substr($str, $i, 1); |
10818 | 10818 | if ($reversed_tmp !== false) { |
@@ -10823,7 +10823,7 @@ discard block |
||
10823 | 10823 | } else { |
10824 | 10824 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10825 | 10825 | |
10826 | - $i = (int) self::strlen($str, $encoding); |
|
10826 | + $i = (int)self::strlen($str, $encoding); |
|
10827 | 10827 | while ($i--) { |
10828 | 10828 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
10829 | 10829 | if ($reversed_tmp !== false) { |
@@ -10902,7 +10902,7 @@ discard block |
||
10902 | 10902 | if ($needle_tmp === false) { |
10903 | 10903 | return false; |
10904 | 10904 | } |
10905 | - $needle = (string) $needle_tmp; |
|
10905 | + $needle = (string)$needle_tmp; |
|
10906 | 10906 | |
10907 | 10907 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
10908 | 10908 | if ($pos === false) { |
@@ -10945,10 +10945,10 @@ discard block |
||
10945 | 10945 | } |
10946 | 10946 | |
10947 | 10947 | // iconv and mbstring do not support integer $needle |
10948 | - if ((int) $needle === $needle && $needle >= 0) { |
|
10949 | - $needle = (string) self::chr($needle); |
|
10948 | + if ((int)$needle === $needle && $needle >= 0) { |
|
10949 | + $needle = (string)self::chr($needle); |
|
10950 | 10950 | } |
10951 | - $needle = (string) $needle; |
|
10951 | + $needle = (string)$needle; |
|
10952 | 10952 | |
10953 | 10953 | if ($needle === '') { |
10954 | 10954 | return false; |
@@ -10996,7 +10996,7 @@ discard block |
||
10996 | 10996 | /** |
10997 | 10997 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10998 | 10998 | */ |
10999 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10999 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11000 | 11000 | } |
11001 | 11001 | |
11002 | 11002 | // |
@@ -11020,7 +11020,7 @@ discard block |
||
11020 | 11020 | // fallback for ascii only |
11021 | 11021 | // |
11022 | 11022 | |
11023 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11023 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11024 | 11024 | return \strripos($haystack, $needle, $offset); |
11025 | 11025 | } |
11026 | 11026 | |
@@ -11103,10 +11103,10 @@ discard block |
||
11103 | 11103 | } |
11104 | 11104 | |
11105 | 11105 | // iconv and mbstring do not support integer $needle |
11106 | - if ((int) $needle === $needle && $needle >= 0) { |
|
11107 | - $needle = (string) self::chr($needle); |
|
11106 | + if ((int)$needle === $needle && $needle >= 0) { |
|
11107 | + $needle = (string)self::chr($needle); |
|
11108 | 11108 | } |
11109 | - $needle = (string) $needle; |
|
11109 | + $needle = (string)$needle; |
|
11110 | 11110 | |
11111 | 11111 | if ($needle === '') { |
11112 | 11112 | return false; |
@@ -11154,7 +11154,7 @@ discard block |
||
11154 | 11154 | /** |
11155 | 11155 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11156 | 11156 | */ |
11157 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11157 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11158 | 11158 | } |
11159 | 11159 | |
11160 | 11160 | // |
@@ -11178,7 +11178,7 @@ discard block |
||
11178 | 11178 | // fallback for ascii only |
11179 | 11179 | // |
11180 | 11180 | |
11181 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11181 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11182 | 11182 | return \strrpos($haystack, $needle, $offset); |
11183 | 11183 | } |
11184 | 11184 | |
@@ -11198,7 +11198,7 @@ discard block |
||
11198 | 11198 | if ($haystack_tmp === false) { |
11199 | 11199 | $haystack_tmp = ''; |
11200 | 11200 | } |
11201 | - $haystack = (string) $haystack_tmp; |
|
11201 | + $haystack = (string)$haystack_tmp; |
|
11202 | 11202 | } |
11203 | 11203 | |
11204 | 11204 | $pos = \strrpos($haystack, $needle); |
@@ -11212,7 +11212,7 @@ discard block |
||
11212 | 11212 | return false; |
11213 | 11213 | } |
11214 | 11214 | |
11215 | - return $offset + (int) self::strlen($str_tmp); |
|
11215 | + return $offset + (int)self::strlen($str_tmp); |
|
11216 | 11216 | } |
11217 | 11217 | |
11218 | 11218 | /** |
@@ -11280,12 +11280,12 @@ discard block |
||
11280 | 11280 | if ($offset || $length !== null) { |
11281 | 11281 | if ($encoding === 'UTF-8') { |
11282 | 11282 | if ($length === null) { |
11283 | - $str = (string) \mb_substr($str, $offset); |
|
11283 | + $str = (string)\mb_substr($str, $offset); |
|
11284 | 11284 | } else { |
11285 | - $str = (string) \mb_substr($str, $offset, $length); |
|
11285 | + $str = (string)\mb_substr($str, $offset, $length); |
|
11286 | 11286 | } |
11287 | 11287 | } else { |
11288 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
11288 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
11289 | 11289 | } |
11290 | 11290 | } |
11291 | 11291 | |
@@ -11295,7 +11295,7 @@ discard block |
||
11295 | 11295 | |
11296 | 11296 | $matches = []; |
11297 | 11297 | |
11298 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
11298 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
11299 | 11299 | } |
11300 | 11300 | |
11301 | 11301 | /** |
@@ -11377,7 +11377,7 @@ discard block |
||
11377 | 11377 | /** |
11378 | 11378 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11379 | 11379 | */ |
11380 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11380 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11381 | 11381 | } |
11382 | 11382 | |
11383 | 11383 | // |
@@ -11399,7 +11399,7 @@ discard block |
||
11399 | 11399 | // fallback for ascii only |
11400 | 11400 | // |
11401 | 11401 | |
11402 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11402 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11403 | 11403 | return \strstr($haystack, $needle, $before_needle); |
11404 | 11404 | } |
11405 | 11405 | |
@@ -11407,7 +11407,7 @@ discard block |
||
11407 | 11407 | // fallback via vanilla php |
11408 | 11408 | // |
11409 | 11409 | |
11410 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
11410 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
11411 | 11411 | |
11412 | 11412 | if (!isset($match[1])) { |
11413 | 11413 | return false; |
@@ -11417,7 +11417,7 @@ discard block |
||
11417 | 11417 | return $match[1]; |
11418 | 11418 | } |
11419 | 11419 | |
11420 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
11420 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
11421 | 11421 | } |
11422 | 11422 | |
11423 | 11423 | /** |
@@ -11547,7 +11547,7 @@ discard block |
||
11547 | 11547 | bool $try_to_keep_the_string_length = false |
11548 | 11548 | ): string { |
11549 | 11549 | // init |
11550 | - $str = (string) $str; |
|
11550 | + $str = (string)$str; |
|
11551 | 11551 | |
11552 | 11552 | if ($str === '') { |
11553 | 11553 | return ''; |
@@ -11576,25 +11576,25 @@ discard block |
||
11576 | 11576 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11577 | 11577 | } |
11578 | 11578 | |
11579 | - $language_code = $lang . '-Lower'; |
|
11579 | + $language_code = $lang.'-Lower'; |
|
11580 | 11580 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11581 | 11581 | /** |
11582 | 11582 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11583 | 11583 | */ |
11584 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11584 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11585 | 11585 | |
11586 | 11586 | $language_code = 'Any-Lower'; |
11587 | 11587 | } |
11588 | 11588 | |
11589 | 11589 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11590 | 11590 | /** @noinspection UnnecessaryCastingInspection */ |
11591 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11591 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11592 | 11592 | } |
11593 | 11593 | |
11594 | 11594 | /** |
11595 | 11595 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11596 | 11596 | */ |
11597 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
11597 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
11598 | 11598 | } |
11599 | 11599 | |
11600 | 11600 | // always fallback via symfony polyfill |
@@ -11629,7 +11629,7 @@ discard block |
||
11629 | 11629 | bool $try_to_keep_the_string_length = false |
11630 | 11630 | ): string { |
11631 | 11631 | // init |
11632 | - $str = (string) $str; |
|
11632 | + $str = (string)$str; |
|
11633 | 11633 | |
11634 | 11634 | if ($str === '') { |
11635 | 11635 | return ''; |
@@ -11658,25 +11658,25 @@ discard block |
||
11658 | 11658 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11659 | 11659 | } |
11660 | 11660 | |
11661 | - $language_code = $lang . '-Upper'; |
|
11661 | + $language_code = $lang.'-Upper'; |
|
11662 | 11662 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11663 | 11663 | /** |
11664 | 11664 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11665 | 11665 | */ |
11666 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
11666 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
11667 | 11667 | |
11668 | 11668 | $language_code = 'Any-Upper'; |
11669 | 11669 | } |
11670 | 11670 | |
11671 | 11671 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11672 | 11672 | /** @noinspection UnnecessaryCastingInspection */ |
11673 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11673 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11674 | 11674 | } |
11675 | 11675 | |
11676 | 11676 | /** |
11677 | 11677 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11678 | 11678 | */ |
11679 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
11679 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
11680 | 11680 | } |
11681 | 11681 | |
11682 | 11682 | // always fallback via symfony polyfill |
@@ -11740,7 +11740,7 @@ discard block |
||
11740 | 11740 | $from = \array_combine($from, $to); |
11741 | 11741 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
11742 | 11742 | if ($from === false) { |
11743 | - 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) . ')'); |
|
11743 | + 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).')'); |
|
11744 | 11744 | } |
11745 | 11745 | } |
11746 | 11746 | |
@@ -11806,9 +11806,9 @@ discard block |
||
11806 | 11806 | } |
11807 | 11807 | |
11808 | 11808 | $wide = 0; |
11809 | - $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); |
|
11809 | + $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); |
|
11810 | 11810 | |
11811 | - return ($wide << 1) + (int) self::strlen($str); |
|
11811 | + return ($wide << 1) + (int)self::strlen($str); |
|
11812 | 11812 | } |
11813 | 11813 | |
11814 | 11814 | /** |
@@ -11917,7 +11917,7 @@ discard block |
||
11917 | 11917 | /** |
11918 | 11918 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11919 | 11919 | */ |
11920 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11920 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11921 | 11921 | } |
11922 | 11922 | |
11923 | 11923 | // |
@@ -12013,16 +12013,16 @@ discard block |
||
12013 | 12013 | ) { |
12014 | 12014 | if ($encoding === 'UTF-8') { |
12015 | 12015 | if ($length === null) { |
12016 | - $str1 = (string) \mb_substr($str1, $offset); |
|
12016 | + $str1 = (string)\mb_substr($str1, $offset); |
|
12017 | 12017 | } else { |
12018 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
12018 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
12019 | 12019 | } |
12020 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
12020 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
12021 | 12021 | } else { |
12022 | 12022 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12023 | 12023 | |
12024 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
12025 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
12024 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
12025 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
12026 | 12026 | } |
12027 | 12027 | } |
12028 | 12028 | |
@@ -12089,13 +12089,13 @@ discard block |
||
12089 | 12089 | if ($length_tmp === false) { |
12090 | 12090 | return false; |
12091 | 12091 | } |
12092 | - $length = (int) $length_tmp; |
|
12092 | + $length = (int)$length_tmp; |
|
12093 | 12093 | } |
12094 | 12094 | |
12095 | 12095 | if ($encoding === 'UTF-8') { |
12096 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
12096 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
12097 | 12097 | } else { |
12098 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
12098 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
12099 | 12099 | } |
12100 | 12100 | } |
12101 | 12101 | |
@@ -12107,7 +12107,7 @@ discard block |
||
12107 | 12107 | /** |
12108 | 12108 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
12109 | 12109 | */ |
12110 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
12110 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
12111 | 12111 | } |
12112 | 12112 | |
12113 | 12113 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -12118,7 +12118,7 @@ discard block |
||
12118 | 12118 | return \mb_substr_count($haystack, $needle, $encoding); |
12119 | 12119 | } |
12120 | 12120 | |
12121 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
12121 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
12122 | 12122 | |
12123 | 12123 | return \count($matches); |
12124 | 12124 | } |
@@ -12168,7 +12168,7 @@ discard block |
||
12168 | 12168 | if ($length_tmp === false) { |
12169 | 12169 | return false; |
12170 | 12170 | } |
12171 | - $length = (int) $length_tmp; |
|
12171 | + $length = (int)$length_tmp; |
|
12172 | 12172 | } |
12173 | 12173 | |
12174 | 12174 | if ( |
@@ -12190,7 +12190,7 @@ discard block |
||
12190 | 12190 | if ($haystack_tmp === false) { |
12191 | 12191 | $haystack_tmp = ''; |
12192 | 12192 | } |
12193 | - $haystack = (string) $haystack_tmp; |
|
12193 | + $haystack = (string)$haystack_tmp; |
|
12194 | 12194 | } |
12195 | 12195 | |
12196 | 12196 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -12231,10 +12231,10 @@ discard block |
||
12231 | 12231 | |
12232 | 12232 | if ($encoding === 'UTF-8') { |
12233 | 12233 | if ($case_sensitive) { |
12234 | - return (int) \mb_substr_count($str, $substring); |
|
12234 | + return (int)\mb_substr_count($str, $substring); |
|
12235 | 12235 | } |
12236 | 12236 | |
12237 | - return (int) \mb_substr_count( |
|
12237 | + return (int)\mb_substr_count( |
|
12238 | 12238 | \mb_strtoupper($str), |
12239 | 12239 | \mb_strtoupper($substring) |
12240 | 12240 | ); |
@@ -12243,10 +12243,10 @@ discard block |
||
12243 | 12243 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12244 | 12244 | |
12245 | 12245 | if ($case_sensitive) { |
12246 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
12246 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
12247 | 12247 | } |
12248 | 12248 | |
12249 | - return (int) \mb_substr_count( |
|
12249 | + return (int)\mb_substr_count( |
|
12250 | 12250 | self::strtocasefold($str, true, false, $encoding, null, false), |
12251 | 12251 | self::strtocasefold($substring, true, false, $encoding, null, false), |
12252 | 12252 | $encoding |
@@ -12280,7 +12280,7 @@ discard block |
||
12280 | 12280 | } |
12281 | 12281 | |
12282 | 12282 | if (self::str_istarts_with($haystack, $needle)) { |
12283 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
12283 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
12284 | 12284 | } |
12285 | 12285 | |
12286 | 12286 | return $haystack; |
@@ -12347,7 +12347,7 @@ discard block |
||
12347 | 12347 | } |
12348 | 12348 | |
12349 | 12349 | if (self::str_iends_with($haystack, $needle)) { |
12350 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
12350 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
12351 | 12351 | } |
12352 | 12352 | |
12353 | 12353 | return $haystack; |
@@ -12380,7 +12380,7 @@ discard block |
||
12380 | 12380 | } |
12381 | 12381 | |
12382 | 12382 | if (self::str_starts_with($haystack, $needle)) { |
12383 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
12383 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
12384 | 12384 | } |
12385 | 12385 | |
12386 | 12386 | return $haystack; |
@@ -12437,7 +12437,7 @@ discard block |
||
12437 | 12437 | if (\is_array($offset)) { |
12438 | 12438 | $offset = \array_slice($offset, 0, $num); |
12439 | 12439 | foreach ($offset as &$value_tmp) { |
12440 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
12440 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
12441 | 12441 | } |
12442 | 12442 | unset($value_tmp); |
12443 | 12443 | } else { |
@@ -12450,7 +12450,7 @@ discard block |
||
12450 | 12450 | } elseif (\is_array($length)) { |
12451 | 12451 | $length = \array_slice($length, 0, $num); |
12452 | 12452 | foreach ($length as &$value_tmp_V2) { |
12453 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
12453 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
12454 | 12454 | } |
12455 | 12455 | unset($value_tmp_V2); |
12456 | 12456 | } else { |
@@ -12470,8 +12470,8 @@ discard block |
||
12470 | 12470 | } |
12471 | 12471 | |
12472 | 12472 | // init |
12473 | - $str = (string) $str; |
|
12474 | - $replacement = (string) $replacement; |
|
12473 | + $str = (string)$str; |
|
12474 | + $replacement = (string)$replacement; |
|
12475 | 12475 | |
12476 | 12476 | if (\is_array($length)) { |
12477 | 12477 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -12486,16 +12486,16 @@ discard block |
||
12486 | 12486 | } |
12487 | 12487 | |
12488 | 12488 | if (self::$SUPPORT['mbstring'] === true) { |
12489 | - $string_length = (int) self::strlen($str, $encoding); |
|
12489 | + $string_length = (int)self::strlen($str, $encoding); |
|
12490 | 12490 | |
12491 | 12491 | if ($offset < 0) { |
12492 | - $offset = (int) \max(0, $string_length + $offset); |
|
12492 | + $offset = (int)\max(0, $string_length + $offset); |
|
12493 | 12493 | } elseif ($offset > $string_length) { |
12494 | 12494 | $offset = $string_length; |
12495 | 12495 | } |
12496 | 12496 | |
12497 | 12497 | if ($length !== null && $length < 0) { |
12498 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
12498 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
12499 | 12499 | } elseif ($length === null || $length > $string_length) { |
12500 | 12500 | $length = $string_length; |
12501 | 12501 | } |
@@ -12506,9 +12506,9 @@ discard block |
||
12506 | 12506 | } |
12507 | 12507 | |
12508 | 12508 | /** @noinspection AdditionOperationOnArraysInspection */ |
12509 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
12510 | - $replacement . |
|
12511 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
12509 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
12510 | + $replacement. |
|
12511 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
12512 | 12512 | } |
12513 | 12513 | |
12514 | 12514 | // |
@@ -12517,8 +12517,7 @@ discard block |
||
12517 | 12517 | |
12518 | 12518 | if (ASCII::is_ascii($str)) { |
12519 | 12519 | return ($length === null) ? |
12520 | - \substr_replace($str, $replacement, $offset) : |
|
12521 | - \substr_replace($str, $replacement, $offset, $length); |
|
12520 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
12522 | 12521 | } |
12523 | 12522 | |
12524 | 12523 | // |
@@ -12534,7 +12533,7 @@ discard block |
||
12534 | 12533 | // e.g.: non mbstring support + invalid chars |
12535 | 12534 | return ''; |
12536 | 12535 | } |
12537 | - $length = (int) $length_tmp; |
|
12536 | + $length = (int)$length_tmp; |
|
12538 | 12537 | } |
12539 | 12538 | |
12540 | 12539 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12577,14 +12576,14 @@ discard block |
||
12577 | 12576 | && |
12578 | 12577 | \substr($haystack, -\strlen($needle)) === $needle |
12579 | 12578 | ) { |
12580 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
12579 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
12581 | 12580 | } |
12582 | 12581 | |
12583 | 12582 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
12584 | - return (string) self::substr( |
|
12583 | + return (string)self::substr( |
|
12585 | 12584 | $haystack, |
12586 | 12585 | 0, |
12587 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
12586 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
12588 | 12587 | $encoding |
12589 | 12588 | ); |
12590 | 12589 | } |
@@ -12619,10 +12618,10 @@ discard block |
||
12619 | 12618 | } |
12620 | 12619 | |
12621 | 12620 | if ($encoding === 'UTF-8') { |
12622 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12621 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12623 | 12622 | } |
12624 | 12623 | |
12625 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12624 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12626 | 12625 | } |
12627 | 12626 | |
12628 | 12627 | /** |
@@ -12834,7 +12833,7 @@ discard block |
||
12834 | 12833 | public static function to_boolean($str): bool |
12835 | 12834 | { |
12836 | 12835 | // init |
12837 | - $str = (string) $str; |
|
12836 | + $str = (string)$str; |
|
12838 | 12837 | |
12839 | 12838 | if ($str === '') { |
12840 | 12839 | return false; |
@@ -12862,10 +12861,10 @@ discard block |
||
12862 | 12861 | } |
12863 | 12862 | |
12864 | 12863 | if (\is_numeric($str)) { |
12865 | - return ((float) $str + 0) > 0; |
|
12864 | + return ((float)$str + 0) > 0; |
|
12866 | 12865 | } |
12867 | 12866 | |
12868 | - return (bool) \trim($str); |
|
12867 | + return (bool)\trim($str); |
|
12869 | 12868 | } |
12870 | 12869 | |
12871 | 12870 | /** |
@@ -12913,7 +12912,7 @@ discard block |
||
12913 | 12912 | return $str; |
12914 | 12913 | } |
12915 | 12914 | |
12916 | - $str = (string) $str; |
|
12915 | + $str = (string)$str; |
|
12917 | 12916 | if ($str === '') { |
12918 | 12917 | return ''; |
12919 | 12918 | } |
@@ -13021,7 +13020,7 @@ discard block |
||
13021 | 13020 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
13022 | 13021 | |
13023 | 13022 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13024 | - $buf .= $c1 . $c2; |
|
13023 | + $buf .= $c1.$c2; |
|
13025 | 13024 | ++$i; |
13026 | 13025 | } else { // not valid UTF8 - convert it |
13027 | 13026 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13032,7 +13031,7 @@ discard block |
||
13032 | 13031 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
13033 | 13032 | |
13034 | 13033 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13035 | - $buf .= $c1 . $c2 . $c3; |
|
13034 | + $buf .= $c1.$c2.$c3; |
|
13036 | 13035 | $i += 2; |
13037 | 13036 | } else { // not valid UTF8 - convert it |
13038 | 13037 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13044,7 +13043,7 @@ discard block |
||
13044 | 13043 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
13045 | 13044 | |
13046 | 13045 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13047 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
13046 | + $buf .= $c1.$c2.$c3.$c4; |
|
13048 | 13047 | $i += 3; |
13049 | 13048 | } else { // not valid UTF8 - convert it |
13050 | 13049 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13072,13 +13071,13 @@ discard block |
||
13072 | 13071 | * |
13073 | 13072 | * @return string |
13074 | 13073 | */ |
13075 | - static function (array $matches): string { |
|
13074 | + static function(array $matches): string { |
|
13076 | 13075 | if (isset($matches[3])) { |
13077 | - $cp = (int) \hexdec($matches[3]); |
|
13076 | + $cp = (int)\hexdec($matches[3]); |
|
13078 | 13077 | } else { |
13079 | 13078 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
13080 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
13081 | - + (int) \hexdec($matches[2]) |
|
13079 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
13080 | + + (int)\hexdec($matches[2]) |
|
13082 | 13081 | + 0x10000 |
13083 | 13082 | - (0xD800 << 10) |
13084 | 13083 | - 0xDC00; |
@@ -13089,12 +13088,12 @@ discard block |
||
13089 | 13088 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
13090 | 13089 | |
13091 | 13090 | if ($cp < 0x80) { |
13092 | - return (string) self::chr($cp); |
|
13091 | + return (string)self::chr($cp); |
|
13093 | 13092 | } |
13094 | 13093 | |
13095 | 13094 | if ($cp < 0xA0) { |
13096 | 13095 | /** @noinspection UnnecessaryCastingInspection */ |
13097 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
13096 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
13098 | 13097 | } |
13099 | 13098 | |
13100 | 13099 | return self::decimal_to_chr($cp); |
@@ -13127,7 +13126,7 @@ discard block |
||
13127 | 13126 | public static function to_int(string $str) |
13128 | 13127 | { |
13129 | 13128 | if (\is_numeric($str)) { |
13130 | - return (int) $str; |
|
13129 | + return (int)$str; |
|
13131 | 13130 | } |
13132 | 13131 | |
13133 | 13132 | return null; |
@@ -13162,7 +13161,7 @@ discard block |
||
13162 | 13161 | || |
13163 | 13162 | $input_type === 'double' |
13164 | 13163 | ) { |
13165 | - return (string) $input; |
|
13164 | + return (string)$input; |
|
13166 | 13165 | } |
13167 | 13166 | |
13168 | 13167 | if ($input_type === 'object') { |
@@ -13172,7 +13171,7 @@ discard block |
||
13172 | 13171 | /** @noinspection NestedPositiveIfStatementsInspection */ |
13173 | 13172 | /** @noinspection MissingOrEmptyGroupStatementInspection */ |
13174 | 13173 | if (\method_exists($input, '__toString')) { |
13175 | - return (string) $input; |
|
13174 | + return (string)$input; |
|
13176 | 13175 | } |
13177 | 13176 | } |
13178 | 13177 | |
@@ -13213,7 +13212,7 @@ discard block |
||
13213 | 13212 | } |
13214 | 13213 | |
13215 | 13214 | /** @noinspection PhpComposerExtensionStubsInspection */ |
13216 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
13215 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
13217 | 13216 | } |
13218 | 13217 | |
13219 | 13218 | if ($chars !== null) { |
@@ -13264,15 +13263,15 @@ discard block |
||
13264 | 13263 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
13265 | 13264 | |
13266 | 13265 | if ($encoding === 'UTF-8') { |
13267 | - $str_part_two = (string) \mb_substr($str, 1); |
|
13266 | + $str_part_two = (string)\mb_substr($str, 1); |
|
13268 | 13267 | |
13269 | 13268 | if ($use_mb_functions) { |
13270 | 13269 | $str_part_one = \mb_strtoupper( |
13271 | - (string) \mb_substr($str, 0, 1) |
|
13270 | + (string)\mb_substr($str, 0, 1) |
|
13272 | 13271 | ); |
13273 | 13272 | } else { |
13274 | 13273 | $str_part_one = self::strtoupper( |
13275 | - (string) \mb_substr($str, 0, 1), |
|
13274 | + (string)\mb_substr($str, 0, 1), |
|
13276 | 13275 | $encoding, |
13277 | 13276 | false, |
13278 | 13277 | $lang, |
@@ -13282,16 +13281,16 @@ discard block |
||
13282 | 13281 | } else { |
13283 | 13282 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
13284 | 13283 | |
13285 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
13284 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
13286 | 13285 | |
13287 | 13286 | if ($use_mb_functions) { |
13288 | 13287 | $str_part_one = \mb_strtoupper( |
13289 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
13288 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
13290 | 13289 | $encoding |
13291 | 13290 | ); |
13292 | 13291 | } else { |
13293 | 13292 | $str_part_one = self::strtoupper( |
13294 | - (string) self::substr($str, 0, 1, $encoding), |
|
13293 | + (string)self::substr($str, 0, 1, $encoding), |
|
13295 | 13294 | $encoding, |
13296 | 13295 | false, |
13297 | 13296 | $lang, |
@@ -13300,7 +13299,7 @@ discard block |
||
13300 | 13299 | } |
13301 | 13300 | } |
13302 | 13301 | |
13303 | - return $str_part_one . $str_part_two; |
|
13302 | + return $str_part_one.$str_part_two; |
|
13304 | 13303 | } |
13305 | 13304 | |
13306 | 13305 | /** |
@@ -13361,7 +13360,7 @@ discard block |
||
13361 | 13360 | $str = self::clean($str); |
13362 | 13361 | } |
13363 | 13362 | |
13364 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
13363 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
13365 | 13364 | |
13366 | 13365 | if ( |
13367 | 13366 | $use_php_default_functions |
@@ -13778,7 +13777,7 @@ discard block |
||
13778 | 13777 | if ( |
13779 | 13778 | $keep_utf8_chars |
13780 | 13779 | && |
13781 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
13780 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
13782 | 13781 | ) { |
13783 | 13782 | return $str_backup; |
13784 | 13783 | } |
@@ -13869,17 +13868,17 @@ discard block |
||
13869 | 13868 | return ''; |
13870 | 13869 | } |
13871 | 13870 | |
13872 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
13871 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
13873 | 13872 | |
13874 | 13873 | if ( |
13875 | 13874 | !isset($matches[0]) |
13876 | 13875 | || |
13877 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
13876 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
13878 | 13877 | ) { |
13879 | 13878 | return $str; |
13880 | 13879 | } |
13881 | 13880 | |
13882 | - return \rtrim($matches[0]) . $str_add_on; |
|
13881 | + return \rtrim($matches[0]).$str_add_on; |
|
13883 | 13882 | } |
13884 | 13883 | |
13885 | 13884 | /** |
@@ -13974,7 +13973,7 @@ discard block |
||
13974 | 13973 | } |
13975 | 13974 | } |
13976 | 13975 | |
13977 | - return $str_return . \implode('', $charsArray); |
|
13976 | + return $str_return.\implode('', $charsArray); |
|
13978 | 13977 | } |
13979 | 13978 | |
13980 | 13979 | /** |
@@ -14028,7 +14027,7 @@ discard block |
||
14028 | 14027 | $final_break = ''; |
14029 | 14028 | } |
14030 | 14029 | |
14031 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
14030 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
14032 | 14031 | } |
14033 | 14032 | |
14034 | 14033 | /** |
@@ -14270,7 +14269,7 @@ discard block |
||
14270 | 14269 | /** @noinspection PhpIncludeInspection */ |
14271 | 14270 | /** @noinspection UsingInclusionReturnValueInspection */ |
14272 | 14271 | /** @psalm-suppress UnresolvableInclude */ |
14273 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
14272 | + return include __DIR__.'/data/'.$file.'.php'; |
|
14274 | 14273 | } |
14275 | 14274 | |
14276 | 14275 | /** |
@@ -14290,7 +14289,7 @@ discard block |
||
14290 | 14289 | */ |
14291 | 14290 | \uksort( |
14292 | 14291 | self::$EMOJI, |
14293 | - static function (string $a, string $b): int { |
|
14292 | + static function(string $a, string $b): int { |
|
14294 | 14293 | return \strlen($b) <=> \strlen($a); |
14295 | 14294 | } |
14296 | 14295 | ); |
@@ -14300,7 +14299,7 @@ discard block |
||
14300 | 14299 | |
14301 | 14300 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
14302 | 14301 | $tmp_key = \crc32($key); |
14303 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
14302 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
14304 | 14303 | } |
14305 | 14304 | |
14306 | 14305 | return true; |
@@ -14328,7 +14327,7 @@ discard block |
||
14328 | 14327 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
14329 | 14328 | return \defined('MB_OVERLOAD_STRING') |
14330 | 14329 | && |
14331 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
14330 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
14332 | 14331 | } |
14333 | 14332 | |
14334 | 14333 | /** |
@@ -14394,7 +14393,7 @@ discard block |
||
14394 | 14393 | */ |
14395 | 14394 | static $RX_CLASS_CACHE = []; |
14396 | 14395 | |
14397 | - $cache_key = $s . '_' . $class; |
|
14396 | + $cache_key = $s.'_'.$class; |
|
14398 | 14397 | |
14399 | 14398 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
14400 | 14399 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -14407,7 +14406,7 @@ discard block |
||
14407 | 14406 | /** @noinspection AlterInForeachInspection */ |
14408 | 14407 | foreach (self::str_split($s) as &$s) { |
14409 | 14408 | if ($s === '-') { |
14410 | - $class_array[0] = '-' . $class_array[0]; |
|
14409 | + $class_array[0] = '-'.$class_array[0]; |
|
14411 | 14410 | } elseif (!isset($s[2])) { |
14412 | 14411 | $class_array[0] .= \preg_quote($s, '/'); |
14413 | 14412 | } elseif (self::strlen($s) === 1) { |
@@ -14418,13 +14417,13 @@ discard block |
||
14418 | 14417 | } |
14419 | 14418 | |
14420 | 14419 | if ($class_array[0]) { |
14421 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
14420 | + $class_array[0] = '['.$class_array[0].']'; |
|
14422 | 14421 | } |
14423 | 14422 | |
14424 | 14423 | if (\count($class_array) === 1) { |
14425 | 14424 | $return = $class_array[0]; |
14426 | 14425 | } else { |
14427 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
14426 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
14428 | 14427 | } |
14429 | 14428 | |
14430 | 14429 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -14505,7 +14504,7 @@ discard block |
||
14505 | 14504 | |
14506 | 14505 | if ($delimiter === '-') { |
14507 | 14506 | /** @noinspection AlterInForeachInspection */ |
14508 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
14507 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
14509 | 14508 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
14510 | 14509 | $continue = true; |
14511 | 14510 | |
@@ -14515,7 +14514,7 @@ discard block |
||
14515 | 14514 | } |
14516 | 14515 | |
14517 | 14516 | /** @noinspection AlterInForeachInspection */ |
14518 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
14517 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
14519 | 14518 | if (self::strpos($name, $beginning, 0, $encoding) === 0) { |
14520 | 14519 | $continue = true; |
14521 | 14520 | |
@@ -14585,8 +14584,8 @@ discard block |
||
14585 | 14584 | } else { |
14586 | 14585 | /** @noinspection OffsetOperationsInspection */ |
14587 | 14586 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
14588 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
14589 | - $buf .= $cc1 . $cc2; |
|
14587 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
14588 | + $buf .= $cc1.$cc2; |
|
14590 | 14589 | } |
14591 | 14590 | |
14592 | 14591 | return $buf; |
@@ -14605,7 +14604,7 @@ discard block |
||
14605 | 14604 | { |
14606 | 14605 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
14607 | 14606 | if (\preg_match($pattern, $str)) { |
14608 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
14607 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
14609 | 14608 | } |
14610 | 14609 | |
14611 | 14610 | return $str; |