@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | if ($encoding === 'UTF-8') { |
274 | - return (string) \mb_substr($str, $pos, 1); |
|
274 | + return (string)\mb_substr($str, $pos, 1); |
|
275 | 275 | } |
276 | 276 | |
277 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
277 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | public static function add_bom_to_string(string $str): string |
295 | 295 | { |
296 | 296 | if (!self::string_has_bom($str)) { |
297 | - $str = self::bom() . $str; |
|
297 | + $str = self::bom().$str; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | return $str; |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | $return = []; |
330 | 330 | foreach ($array as $key => &$value) { |
331 | 331 | $key = $case === \CASE_LOWER |
332 | - ? self::strtolower((string) $key, $encoding) |
|
333 | - : self::strtoupper((string) $key, $encoding); |
|
332 | + ? self::strtolower((string)$key, $encoding) |
|
333 | + : self::strtoupper((string)$key, $encoding); |
|
334 | 334 | |
335 | 335 | $return[$key] = $value; |
336 | 336 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | return ''; |
367 | 367 | } |
368 | 368 | |
369 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
369 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
370 | 370 | $end_position = \mb_strpos($str, $end, $substr_index); |
371 | 371 | if ( |
372 | 372 | $end_position === false |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | return ''; |
377 | 377 | } |
378 | 378 | |
379 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
379 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | return ''; |
387 | 387 | } |
388 | 388 | |
389 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
389 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
390 | 390 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
391 | 391 | if ( |
392 | 392 | $end_position === false |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | return ''; |
397 | 397 | } |
398 | 398 | |
399 | - return (string) self::substr( |
|
399 | + return (string)self::substr( |
|
400 | 400 | $str, |
401 | 401 | $substr_index, |
402 | 402 | $end_position - $substr_index, |
@@ -480,10 +480,10 @@ discard block |
||
480 | 480 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
481 | 481 | { |
482 | 482 | if ($encoding === 'UTF-8') { |
483 | - return (string) \mb_substr($str, $index, 1); |
|
483 | + return (string)\mb_substr($str, $index, 1); |
|
484 | 484 | } |
485 | 485 | |
486 | - return (string) self::substr($str, $index, 1, $encoding); |
|
486 | + return (string)self::substr($str, $index, 1, $encoding); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
@@ -601,14 +601,14 @@ discard block |
||
601 | 601 | /** |
602 | 602 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
603 | 603 | */ |
604 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
604 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | if (!\is_int($code_point) || $code_point <= 0) { |
608 | 608 | return null; |
609 | 609 | } |
610 | 610 | |
611 | - $cache_key = $code_point . '_' . $encoding; |
|
611 | + $cache_key = $code_point.'_'.$encoding; |
|
612 | 612 | if (isset($CHAR_CACHE[$cache_key])) { |
613 | 613 | return $CHAR_CACHE[$cache_key]; |
614 | 614 | } |
@@ -654,27 +654,27 @@ discard block |
||
654 | 654 | self::$CHR = self::getData('chr'); |
655 | 655 | } |
656 | 656 | |
657 | - $code_point = (int) $code_point; |
|
657 | + $code_point = (int)$code_point; |
|
658 | 658 | if ($code_point <= 0x7FF) { |
659 | 659 | /** |
660 | 660 | * @psalm-suppress PossiblyNullArrayAccess |
661 | 661 | */ |
662 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
662 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
663 | 663 | self::$CHR[($code_point & 0x3F) + 0x80]; |
664 | 664 | } elseif ($code_point <= 0xFFFF) { |
665 | 665 | /** |
666 | 666 | * @psalm-suppress PossiblyNullArrayAccess |
667 | 667 | */ |
668 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
669 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
668 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
669 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
670 | 670 | self::$CHR[($code_point & 0x3F) + 0x80]; |
671 | 671 | } else { |
672 | 672 | /** |
673 | 673 | * @psalm-suppress PossiblyNullArrayAccess |
674 | 674 | */ |
675 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
676 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
677 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
675 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
676 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
677 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
678 | 678 | self::$CHR[($code_point & 0x3F) + 0x80]; |
679 | 679 | } |
680 | 680 | |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | |
732 | 732 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
733 | 733 | return \array_map( |
734 | - static function (string $data): int { |
|
734 | + static function(string $data): int { |
|
735 | 735 | // "mb_" is available if overload is used, so use it ... |
736 | 736 | return \mb_strlen($data, 'CP850'); // 8-BIT |
737 | 737 | }, |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | $char = ''; |
819 | 819 | } |
820 | 820 | |
821 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
821 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | /** |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
916 | 916 | /x'; |
917 | 917 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
918 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
918 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
919 | 919 | |
920 | 920 | if ($replace_diamond_question_mark) { |
921 | 921 | $str = self::replace_diamond_question_mark($str); |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | public static function cleanup($str): string |
955 | 955 | { |
956 | 956 | // init |
957 | - $str = (string) $str; |
|
957 | + $str = (string)$str; |
|
958 | 958 | |
959 | 959 | if ($str === '') { |
960 | 960 | return ''; |
@@ -1056,7 +1056,7 @@ discard block |
||
1056 | 1056 | { |
1057 | 1057 | if (self::$SUPPORT['mbstring'] === true) { |
1058 | 1058 | /** @noinspection PhpComposerExtensionStubsInspection */ |
1059 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1059 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1161,9 +1161,9 @@ discard block |
||
1161 | 1161 | // - 0-9 (U+0061 - U+007A) |
1162 | 1162 | // - ISO 10646 characters U+00A1 and higher |
1163 | 1163 | // We strip out any character not in the above list. |
1164 | - $str = (string) \preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
1164 | + $str = (string)\preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
1165 | 1165 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
1166 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1166 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1167 | 1167 | |
1168 | 1168 | return \trim($str, '-'); |
1169 | 1169 | } |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | */ |
1180 | 1180 | public static function css_stripe_media_queries(string $str): string |
1181 | 1181 | { |
1182 | - return (string) \preg_replace( |
|
1182 | + return (string)\preg_replace( |
|
1183 | 1183 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
1184 | 1184 | '', |
1185 | 1185 | $str |
@@ -1220,7 +1220,7 @@ discard block |
||
1220 | 1220 | { |
1221 | 1221 | // We cannot use ENT_HTML5 here, as carriage return ( ) is not |
1222 | 1222 | // a valid numeric entity with that document type. |
1223 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML401); |
|
1223 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML401); |
|
1224 | 1224 | } |
1225 | 1225 | |
1226 | 1226 | /** |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | $flagOffset = 0x1F1E6; |
1271 | 1271 | $asciiOffset = 0x41; |
1272 | 1272 | |
1273 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
1273 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
1274 | 1274 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
1275 | 1275 | } |
1276 | 1276 | |
@@ -1301,16 +1301,16 @@ discard block |
||
1301 | 1301 | self::initEmojiData(); |
1302 | 1302 | |
1303 | 1303 | if ($use_reversible_string_mappings) { |
1304 | - return (string) \str_replace( |
|
1305 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1306 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1304 | + return (string)\str_replace( |
|
1305 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1306 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1307 | 1307 | $str |
1308 | 1308 | ); |
1309 | 1309 | } |
1310 | 1310 | |
1311 | - return (string) \str_replace( |
|
1312 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1313 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1311 | + return (string)\str_replace( |
|
1312 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1313 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1314 | 1314 | $str |
1315 | 1315 | ); |
1316 | 1316 | } |
@@ -1342,16 +1342,16 @@ discard block |
||
1342 | 1342 | self::initEmojiData(); |
1343 | 1343 | |
1344 | 1344 | if ($use_reversible_string_mappings) { |
1345 | - return (string) \str_replace( |
|
1346 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1347 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1345 | + return (string)\str_replace( |
|
1346 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1347 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1348 | 1348 | $str |
1349 | 1349 | ); |
1350 | 1350 | } |
1351 | 1351 | |
1352 | - return (string) \str_replace( |
|
1353 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1354 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1352 | + return (string)\str_replace( |
|
1353 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1354 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1355 | 1355 | $str |
1356 | 1356 | ); |
1357 | 1357 | } |
@@ -1417,7 +1417,7 @@ discard block |
||
1417 | 1417 | if ($to_encoding === 'JSON') { |
1418 | 1418 | $return = self::json_encode($str); |
1419 | 1419 | if ($return === false) { |
1420 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1420 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1421 | 1421 | } |
1422 | 1422 | |
1423 | 1423 | return $return; |
@@ -1508,7 +1508,7 @@ discard block |
||
1508 | 1508 | /** |
1509 | 1509 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
1510 | 1510 | */ |
1511 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1511 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1512 | 1512 | } |
1513 | 1513 | |
1514 | 1514 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1610,31 +1610,31 @@ discard block |
||
1610 | 1610 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1611 | 1611 | |
1612 | 1612 | if ($length === null) { |
1613 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
1613 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
1614 | 1614 | } |
1615 | 1615 | |
1616 | 1616 | if ($search === '') { |
1617 | 1617 | if ($encoding === 'UTF-8') { |
1618 | 1618 | if ($length > 0) { |
1619 | - $string_length = (int) \mb_strlen($str); |
|
1619 | + $string_length = (int)\mb_strlen($str); |
|
1620 | 1620 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1621 | 1621 | } else { |
1622 | 1622 | $end = 0; |
1623 | 1623 | } |
1624 | 1624 | |
1625 | - $pos = (int) \min( |
|
1625 | + $pos = (int)\min( |
|
1626 | 1626 | \mb_strpos($str, ' ', $end), |
1627 | 1627 | \mb_strpos($str, '.', $end) |
1628 | 1628 | ); |
1629 | 1629 | } else { |
1630 | 1630 | if ($length > 0) { |
1631 | - $string_length = (int) self::strlen($str, $encoding); |
|
1631 | + $string_length = (int)self::strlen($str, $encoding); |
|
1632 | 1632 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1633 | 1633 | } else { |
1634 | 1634 | $end = 0; |
1635 | 1635 | } |
1636 | 1636 | |
1637 | - $pos = (int) \min( |
|
1637 | + $pos = (int)\min( |
|
1638 | 1638 | self::strpos($str, ' ', $end, $encoding), |
1639 | 1639 | self::strpos($str, '.', $end, $encoding) |
1640 | 1640 | ); |
@@ -1651,18 +1651,18 @@ discard block |
||
1651 | 1651 | return ''; |
1652 | 1652 | } |
1653 | 1653 | |
1654 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1654 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1655 | 1655 | } |
1656 | 1656 | |
1657 | 1657 | return $str; |
1658 | 1658 | } |
1659 | 1659 | |
1660 | 1660 | if ($encoding === 'UTF-8') { |
1661 | - $word_position = (int) \mb_stripos($str, $search); |
|
1662 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1661 | + $word_position = (int)\mb_stripos($str, $search); |
|
1662 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1663 | 1663 | } else { |
1664 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1665 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1664 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1665 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1666 | 1666 | } |
1667 | 1667 | |
1668 | 1668 | $pos_start = 0; |
@@ -1674,12 +1674,12 @@ discard block |
||
1674 | 1674 | } |
1675 | 1675 | if ($half_text !== false) { |
1676 | 1676 | if ($encoding === 'UTF-8') { |
1677 | - $pos_start = (int) \max( |
|
1677 | + $pos_start = (int)\max( |
|
1678 | 1678 | \mb_strrpos($half_text, ' '), |
1679 | 1679 | \mb_strrpos($half_text, '.') |
1680 | 1680 | ); |
1681 | 1681 | } else { |
1682 | - $pos_start = (int) \max( |
|
1682 | + $pos_start = (int)\max( |
|
1683 | 1683 | self::strrpos($half_text, ' ', 0, $encoding), |
1684 | 1684 | self::strrpos($half_text, '.', 0, $encoding) |
1685 | 1685 | ); |
@@ -1689,19 +1689,19 @@ discard block |
||
1689 | 1689 | |
1690 | 1690 | if ($word_position && $half_side > 0) { |
1691 | 1691 | $offset = $pos_start + $length - 1; |
1692 | - $real_length = (int) self::strlen($str, $encoding); |
|
1692 | + $real_length = (int)self::strlen($str, $encoding); |
|
1693 | 1693 | |
1694 | 1694 | if ($offset > $real_length) { |
1695 | 1695 | $offset = $real_length; |
1696 | 1696 | } |
1697 | 1697 | |
1698 | 1698 | if ($encoding === 'UTF-8') { |
1699 | - $pos_end = (int) \min( |
|
1699 | + $pos_end = (int)\min( |
|
1700 | 1700 | \mb_strpos($str, ' ', $offset), |
1701 | 1701 | \mb_strpos($str, '.', $offset) |
1702 | 1702 | ) - $pos_start; |
1703 | 1703 | } else { |
1704 | - $pos_end = (int) \min( |
|
1704 | + $pos_end = (int)\min( |
|
1705 | 1705 | self::strpos($str, ' ', $offset, $encoding), |
1706 | 1706 | self::strpos($str, '.', $offset, $encoding) |
1707 | 1707 | ) - $pos_start; |
@@ -1709,12 +1709,12 @@ discard block |
||
1709 | 1709 | |
1710 | 1710 | if (!$pos_end || $pos_end <= 0) { |
1711 | 1711 | if ($encoding === 'UTF-8') { |
1712 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1712 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1713 | 1713 | } else { |
1714 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1714 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1715 | 1715 | } |
1716 | 1716 | if ($str_sub !== false) { |
1717 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1717 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1718 | 1718 | } else { |
1719 | 1719 | $extract = ''; |
1720 | 1720 | } |
@@ -1725,26 +1725,26 @@ discard block |
||
1725 | 1725 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1726 | 1726 | } |
1727 | 1727 | if ($str_sub !== false) { |
1728 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1728 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1729 | 1729 | } else { |
1730 | 1730 | $extract = ''; |
1731 | 1731 | } |
1732 | 1732 | } |
1733 | 1733 | } else { |
1734 | 1734 | $offset = $length - 1; |
1735 | - $true_length = (int) self::strlen($str, $encoding); |
|
1735 | + $true_length = (int)self::strlen($str, $encoding); |
|
1736 | 1736 | |
1737 | 1737 | if ($offset > $true_length) { |
1738 | 1738 | $offset = $true_length; |
1739 | 1739 | } |
1740 | 1740 | |
1741 | 1741 | if ($encoding === 'UTF-8') { |
1742 | - $pos_end = (int) \min( |
|
1742 | + $pos_end = (int)\min( |
|
1743 | 1743 | \mb_strpos($str, ' ', $offset), |
1744 | 1744 | \mb_strpos($str, '.', $offset) |
1745 | 1745 | ); |
1746 | 1746 | } else { |
1747 | - $pos_end = (int) \min( |
|
1747 | + $pos_end = (int)\min( |
|
1748 | 1748 | self::strpos($str, ' ', $offset, $encoding), |
1749 | 1749 | self::strpos($str, '.', $offset, $encoding) |
1750 | 1750 | ); |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1758 | 1758 | } |
1759 | 1759 | if ($str_sub !== false) { |
1760 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1760 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1761 | 1761 | } else { |
1762 | 1762 | $extract = ''; |
1763 | 1763 | } |
@@ -1890,7 +1890,7 @@ discard block |
||
1890 | 1890 | { |
1891 | 1891 | $file_content = \file_get_contents($file_path); |
1892 | 1892 | if ($file_content === false) { |
1893 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1893 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1894 | 1894 | } |
1895 | 1895 | |
1896 | 1896 | return self::string_has_bom($file_content); |
@@ -1956,7 +1956,7 @@ discard block |
||
1956 | 1956 | ) { |
1957 | 1957 | // Prevent leading combining chars |
1958 | 1958 | // for NFC-safe concatenations. |
1959 | - $var = $leading_combining . $var; |
|
1959 | + $var = $leading_combining.$var; |
|
1960 | 1960 | } |
1961 | 1961 | } |
1962 | 1962 | |
@@ -2277,10 +2277,10 @@ discard block |
||
2277 | 2277 | } |
2278 | 2278 | |
2279 | 2279 | if ($encoding === 'UTF-8') { |
2280 | - return (string) \mb_substr($str, 0, $n); |
|
2280 | + return (string)\mb_substr($str, 0, $n); |
|
2281 | 2281 | } |
2282 | 2282 | |
2283 | - return (string) self::substr($str, 0, $n, $encoding); |
|
2283 | + return (string)self::substr($str, 0, $n, $encoding); |
|
2284 | 2284 | } |
2285 | 2285 | |
2286 | 2286 | /** |
@@ -2298,7 +2298,7 @@ discard block |
||
2298 | 2298 | */ |
2299 | 2299 | public static function fits_inside(string $str, int $box_size): bool |
2300 | 2300 | { |
2301 | - return (int) self::strlen($str) <= $box_size; |
|
2301 | + return (int)self::strlen($str) <= $box_size; |
|
2302 | 2302 | } |
2303 | 2303 | |
2304 | 2304 | /** |
@@ -2381,7 +2381,7 @@ discard block |
||
2381 | 2381 | return $str; |
2382 | 2382 | } |
2383 | 2383 | |
2384 | - $str = (string) $str; |
|
2384 | + $str = (string)$str; |
|
2385 | 2385 | $last = ''; |
2386 | 2386 | while ($last !== $str) { |
2387 | 2387 | $last = $str; |
@@ -2590,7 +2590,7 @@ discard block |
||
2590 | 2590 | return $fallback; |
2591 | 2591 | } |
2592 | 2592 | /** @noinspection OffsetOperationsInspection */ |
2593 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2593 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2594 | 2594 | |
2595 | 2595 | // DEBUG |
2596 | 2596 | //var_dump($type_code); |
@@ -2648,7 +2648,7 @@ discard block |
||
2648 | 2648 | // |
2649 | 2649 | |
2650 | 2650 | if ($encoding === 'UTF-8') { |
2651 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2651 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2652 | 2652 | if ($max_length === 0) { |
2653 | 2653 | return ''; |
2654 | 2654 | } |
@@ -2669,7 +2669,7 @@ discard block |
||
2669 | 2669 | } else { |
2670 | 2670 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2671 | 2671 | |
2672 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2672 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2673 | 2673 | if ($max_length === 0) { |
2674 | 2674 | return ''; |
2675 | 2675 | } |
@@ -2707,16 +2707,16 @@ discard block |
||
2707 | 2707 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
2708 | 2708 | } |
2709 | 2709 | |
2710 | - $unique_helper = $rand_int . |
|
2711 | - \session_id() . |
|
2712 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2713 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2710 | + $unique_helper = $rand_int. |
|
2711 | + \session_id(). |
|
2712 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2713 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2714 | 2714 | $extra_entropy; |
2715 | 2715 | |
2716 | 2716 | $unique_string = \uniqid($unique_helper, true); |
2717 | 2717 | |
2718 | 2718 | if ($use_md5) { |
2719 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2719 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2720 | 2720 | } |
2721 | 2721 | |
2722 | 2722 | return $unique_string; |
@@ -2815,7 +2815,7 @@ discard block |
||
2815 | 2815 | public static function hex_to_chr(string $hexdec) |
2816 | 2816 | { |
2817 | 2817 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
2818 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
2818 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
2819 | 2819 | } |
2820 | 2820 | |
2821 | 2821 | /** |
@@ -2835,7 +2835,7 @@ discard block |
||
2835 | 2835 | public static function hex_to_int($hexdec) |
2836 | 2836 | { |
2837 | 2837 | // init |
2838 | - $hexdec = (string) $hexdec; |
|
2838 | + $hexdec = (string)$hexdec; |
|
2839 | 2839 | |
2840 | 2840 | if ($hexdec === '') { |
2841 | 2841 | return false; |
@@ -2935,7 +2935,7 @@ discard block |
||
2935 | 2935 | return \implode( |
2936 | 2936 | '', |
2937 | 2937 | \array_map( |
2938 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2938 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2939 | 2939 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2940 | 2940 | }, |
2941 | 2941 | self::str_split($str) |
@@ -3050,7 +3050,7 @@ discard block |
||
3050 | 3050 | /** |
3051 | 3051 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
3052 | 3052 | */ |
3053 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
3053 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
3054 | 3054 | } |
3055 | 3055 | |
3056 | 3056 | do { |
@@ -3059,7 +3059,7 @@ discard block |
||
3059 | 3059 | if (\strpos($str, '&') !== false) { |
3060 | 3060 | if (\strpos($str, '&#') !== false) { |
3061 | 3061 | // decode also numeric & UTF16 two byte entities |
3062 | - $str = (string) \preg_replace( |
|
3062 | + $str = (string)\preg_replace( |
|
3063 | 3063 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
3064 | 3064 | '$1;', |
3065 | 3065 | $str |
@@ -3109,7 +3109,7 @@ discard block |
||
3109 | 3109 | */ |
3110 | 3110 | public static function html_stripe_empty_tags(string $str): string |
3111 | 3111 | { |
3112 | - return (string) \preg_replace( |
|
3112 | + return (string)\preg_replace( |
|
3113 | 3113 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
3114 | 3114 | '', |
3115 | 3115 | $str |
@@ -3439,9 +3439,9 @@ discard block |
||
3439 | 3439 | { |
3440 | 3440 | $hex = \dechex($int); |
3441 | 3441 | |
3442 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
3442 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
3443 | 3443 | |
3444 | - return $prefix . $hex . ''; |
|
3444 | + return $prefix.$hex.''; |
|
3445 | 3445 | } |
3446 | 3446 | |
3447 | 3447 | /** |
@@ -3770,7 +3770,7 @@ discard block |
||
3770 | 3770 | */ |
3771 | 3771 | public static function is_binary($input, bool $strict = false): bool |
3772 | 3772 | { |
3773 | - $input = (string) $input; |
|
3773 | + $input = (string)$input; |
|
3774 | 3774 | if ($input === '') { |
3775 | 3775 | return false; |
3776 | 3776 | } |
@@ -4130,7 +4130,7 @@ discard block |
||
4130 | 4130 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
4131 | 4131 | { |
4132 | 4132 | // init |
4133 | - $str = (string) $str; |
|
4133 | + $str = (string)$str; |
|
4134 | 4134 | $str_chars = []; |
4135 | 4135 | |
4136 | 4136 | if ( |
@@ -4224,7 +4224,7 @@ discard block |
||
4224 | 4224 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
4225 | 4225 | { |
4226 | 4226 | // init |
4227 | - $str = (string) $str; |
|
4227 | + $str = (string)$str; |
|
4228 | 4228 | $str_chars = []; |
4229 | 4229 | |
4230 | 4230 | if ( |
@@ -4322,7 +4322,7 @@ discard block |
||
4322 | 4322 | return true; |
4323 | 4323 | } |
4324 | 4324 | |
4325 | - return self::is_utf8_string((string) $str, $strict); |
|
4325 | + return self::is_utf8_string((string)$str, $strict); |
|
4326 | 4326 | } |
4327 | 4327 | |
4328 | 4328 | /** |
@@ -4480,15 +4480,15 @@ discard block |
||
4480 | 4480 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
4481 | 4481 | |
4482 | 4482 | if ($encoding === 'UTF-8') { |
4483 | - $str_part_two = (string) \mb_substr($str, 1); |
|
4483 | + $str_part_two = (string)\mb_substr($str, 1); |
|
4484 | 4484 | |
4485 | 4485 | if ($use_mb_functions) { |
4486 | 4486 | $str_part_one = \mb_strtolower( |
4487 | - (string) \mb_substr($str, 0, 1) |
|
4487 | + (string)\mb_substr($str, 0, 1) |
|
4488 | 4488 | ); |
4489 | 4489 | } else { |
4490 | 4490 | $str_part_one = self::strtolower( |
4491 | - (string) \mb_substr($str, 0, 1), |
|
4491 | + (string)\mb_substr($str, 0, 1), |
|
4492 | 4492 | $encoding, |
4493 | 4493 | false, |
4494 | 4494 | $lang, |
@@ -4498,10 +4498,10 @@ discard block |
||
4498 | 4498 | } else { |
4499 | 4499 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4500 | 4500 | |
4501 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
4501 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
4502 | 4502 | |
4503 | 4503 | $str_part_one = self::strtolower( |
4504 | - (string) self::substr($str, 0, 1, $encoding), |
|
4504 | + (string)self::substr($str, 0, 1, $encoding), |
|
4505 | 4505 | $encoding, |
4506 | 4506 | false, |
4507 | 4507 | $lang, |
@@ -4509,7 +4509,7 @@ discard block |
||
4509 | 4509 | ); |
4510 | 4510 | } |
4511 | 4511 | |
4512 | - return $str_part_one . $str_part_two; |
|
4512 | + return $str_part_one.$str_part_two; |
|
4513 | 4513 | } |
4514 | 4514 | |
4515 | 4515 | /** |
@@ -4658,7 +4658,7 @@ discard block |
||
4658 | 4658 | } |
4659 | 4659 | |
4660 | 4660 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4661 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4661 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4662 | 4662 | } |
4663 | 4663 | |
4664 | 4664 | if ($chars !== null) { |
@@ -4695,7 +4695,7 @@ discard block |
||
4695 | 4695 | |
4696 | 4696 | $codepoint_max = \max($codepoints); |
4697 | 4697 | |
4698 | - return self::chr((int) $codepoint_max); |
|
4698 | + return self::chr((int)$codepoint_max); |
|
4699 | 4699 | } |
4700 | 4700 | |
4701 | 4701 | /** |
@@ -4715,7 +4715,7 @@ discard block |
||
4715 | 4715 | { |
4716 | 4716 | $bytes = self::chr_size_list($str); |
4717 | 4717 | if ($bytes !== []) { |
4718 | - return (int) \max($bytes); |
|
4718 | + return (int)\max($bytes); |
|
4719 | 4719 | } |
4720 | 4720 | |
4721 | 4721 | return 0; |
@@ -4761,7 +4761,7 @@ discard block |
||
4761 | 4761 | |
4762 | 4762 | $codepoint_min = \min($codepoints); |
4763 | 4763 | |
4764 | - return self::chr((int) $codepoint_min); |
|
4764 | + return self::chr((int)$codepoint_min); |
|
4765 | 4765 | } |
4766 | 4766 | |
4767 | 4767 | /** |
@@ -4809,7 +4809,7 @@ discard block |
||
4809 | 4809 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4810 | 4810 | |
4811 | 4811 | // init |
4812 | - $encoding = (string) $encoding; |
|
4812 | + $encoding = (string)$encoding; |
|
4813 | 4813 | |
4814 | 4814 | if (!$encoding) { |
4815 | 4815 | return $fallback; |
@@ -4871,7 +4871,7 @@ discard block |
||
4871 | 4871 | |
4872 | 4872 | $encoding_original = $encoding; |
4873 | 4873 | $encoding = \strtoupper($encoding); |
4874 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4874 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4875 | 4875 | |
4876 | 4876 | $equivalences = [ |
4877 | 4877 | 'ISO8859' => 'ISO-8859-1', |
@@ -5038,13 +5038,13 @@ discard block |
||
5038 | 5038 | static $CHAR_CACHE = []; |
5039 | 5039 | |
5040 | 5040 | // init |
5041 | - $chr = (string) $chr; |
|
5041 | + $chr = (string)$chr; |
|
5042 | 5042 | |
5043 | 5043 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
5044 | 5044 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5045 | 5045 | } |
5046 | 5046 | |
5047 | - $cache_key = $chr . '_' . $encoding; |
|
5047 | + $cache_key = $chr.'_'.$encoding; |
|
5048 | 5048 | if (isset($CHAR_CACHE[$cache_key])) { |
5049 | 5049 | return $CHAR_CACHE[$cache_key]; |
5050 | 5050 | } |
@@ -5079,7 +5079,7 @@ discard block |
||
5079 | 5079 | // |
5080 | 5080 | |
5081 | 5081 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
5082 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
5082 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
5083 | 5083 | /** @noinspection OffsetOperationsInspection */ |
5084 | 5084 | $code = $chr ? $chr[1] : 0; |
5085 | 5085 | |
@@ -5087,21 +5087,21 @@ discard block |
||
5087 | 5087 | if ($code >= 0xF0 && isset($chr[4])) { |
5088 | 5088 | /** @noinspection UnnecessaryCastingInspection */ |
5089 | 5089 | /** @noinspection OffsetOperationsInspection */ |
5090 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
5090 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
5091 | 5091 | } |
5092 | 5092 | |
5093 | 5093 | /** @noinspection OffsetOperationsInspection */ |
5094 | 5094 | if ($code >= 0xE0 && isset($chr[3])) { |
5095 | 5095 | /** @noinspection UnnecessaryCastingInspection */ |
5096 | 5096 | /** @noinspection OffsetOperationsInspection */ |
5097 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
5097 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
5098 | 5098 | } |
5099 | 5099 | |
5100 | 5100 | /** @noinspection OffsetOperationsInspection */ |
5101 | 5101 | if ($code >= 0xC0 && isset($chr[2])) { |
5102 | 5102 | /** @noinspection UnnecessaryCastingInspection */ |
5103 | 5103 | /** @noinspection OffsetOperationsInspection */ |
5104 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
5104 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
5105 | 5105 | } |
5106 | 5106 | |
5107 | 5107 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -5163,7 +5163,7 @@ discard block |
||
5163 | 5163 | public static function pcre_utf8_support(): bool |
5164 | 5164 | { |
5165 | 5165 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5166 | - return (bool) @\preg_match('//u', ''); |
|
5166 | + return (bool)@\preg_match('//u', ''); |
|
5167 | 5167 | } |
5168 | 5168 | |
5169 | 5169 | /** |
@@ -5204,14 +5204,14 @@ discard block |
||
5204 | 5204 | * @psalm-suppress DocblockTypeContradiction |
5205 | 5205 | */ |
5206 | 5206 | if (!\is_numeric($step)) { |
5207 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
5207 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
5208 | 5208 | } |
5209 | 5209 | |
5210 | 5210 | /** |
5211 | 5211 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
5212 | 5212 | */ |
5213 | 5213 | if ($step <= 0) { |
5214 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
5214 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
5215 | 5215 | } |
5216 | 5216 | } |
5217 | 5217 | |
@@ -5223,16 +5223,16 @@ discard block |
||
5223 | 5223 | $is_xdigit = false; |
5224 | 5224 | |
5225 | 5225 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5226 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
5226 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
5227 | 5227 | $is_digit = true; |
5228 | - $start = (int) $var1; |
|
5228 | + $start = (int)$var1; |
|
5229 | 5229 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
5230 | 5230 | $is_xdigit = true; |
5231 | - $start = (int) self::hex_to_int((string) $var1); |
|
5231 | + $start = (int)self::hex_to_int((string)$var1); |
|
5232 | 5232 | } elseif (!$use_ctype && \is_numeric($var1)) { |
5233 | - $start = (int) $var1; |
|
5233 | + $start = (int)$var1; |
|
5234 | 5234 | } else { |
5235 | - $start = self::ord((string) $var1); |
|
5235 | + $start = self::ord((string)$var1); |
|
5236 | 5236 | } |
5237 | 5237 | |
5238 | 5238 | if (!$start) { |
@@ -5240,13 +5240,13 @@ discard block |
||
5240 | 5240 | } |
5241 | 5241 | |
5242 | 5242 | if ($is_digit) { |
5243 | - $end = (int) $var2; |
|
5243 | + $end = (int)$var2; |
|
5244 | 5244 | } elseif ($is_xdigit) { |
5245 | - $end = (int) self::hex_to_int((string) $var2); |
|
5245 | + $end = (int)self::hex_to_int((string)$var2); |
|
5246 | 5246 | } elseif (!$use_ctype && \is_numeric($var2)) { |
5247 | - $end = (int) $var2; |
|
5247 | + $end = (int)$var2; |
|
5248 | 5248 | } else { |
5249 | - $end = self::ord((string) $var2); |
|
5249 | + $end = self::ord((string)$var2); |
|
5250 | 5250 | } |
5251 | 5251 | |
5252 | 5252 | if (!$end) { |
@@ -5255,7 +5255,7 @@ discard block |
||
5255 | 5255 | |
5256 | 5256 | $array = []; |
5257 | 5257 | foreach (\range($start, $end, $step) as $i) { |
5258 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
5258 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
5259 | 5259 | } |
5260 | 5260 | |
5261 | 5261 | return $array; |
@@ -5351,8 +5351,8 @@ discard block |
||
5351 | 5351 | $delimiter = '/'; |
5352 | 5352 | } |
5353 | 5353 | |
5354 | - return (string) \preg_replace( |
|
5355 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
5354 | + return (string)\preg_replace( |
|
5355 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
5356 | 5356 | $replacement, |
5357 | 5357 | $str |
5358 | 5358 | ); |
@@ -5402,9 +5402,9 @@ discard block |
||
5402 | 5402 | return ''; |
5403 | 5403 | } |
5404 | 5404 | |
5405 | - $str_length -= (int) $bom_byte_length; |
|
5405 | + $str_length -= (int)$bom_byte_length; |
|
5406 | 5406 | |
5407 | - $str = (string) $str_tmp; |
|
5407 | + $str = (string)$str_tmp; |
|
5408 | 5408 | } |
5409 | 5409 | } |
5410 | 5410 | |
@@ -5435,7 +5435,7 @@ discard block |
||
5435 | 5435 | */ |
5436 | 5436 | if (\is_array($what)) { |
5437 | 5437 | foreach ($what as $item) { |
5438 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
5438 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
5439 | 5439 | } |
5440 | 5440 | } |
5441 | 5441 | |
@@ -5473,7 +5473,7 @@ discard block |
||
5473 | 5473 | */ |
5474 | 5474 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
5475 | 5475 | { |
5476 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5476 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5477 | 5477 | } |
5478 | 5478 | |
5479 | 5479 | /** |
@@ -5537,17 +5537,17 @@ discard block |
||
5537 | 5537 | \strpos($str, $substring) === 0 |
5538 | 5538 | ) { |
5539 | 5539 | if ($encoding === 'UTF-8') { |
5540 | - return (string) \mb_substr( |
|
5540 | + return (string)\mb_substr( |
|
5541 | 5541 | $str, |
5542 | - (int) \mb_strlen($substring) |
|
5542 | + (int)\mb_strlen($substring) |
|
5543 | 5543 | ); |
5544 | 5544 | } |
5545 | 5545 | |
5546 | 5546 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5547 | 5547 | |
5548 | - return (string) self::substr( |
|
5548 | + return (string)self::substr( |
|
5549 | 5549 | $str, |
5550 | - (int) self::strlen($substring, $encoding), |
|
5550 | + (int)self::strlen($substring, $encoding), |
|
5551 | 5551 | null, |
5552 | 5552 | $encoding |
5553 | 5553 | ); |
@@ -5575,19 +5575,19 @@ discard block |
||
5575 | 5575 | ): string { |
5576 | 5576 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
5577 | 5577 | if ($encoding === 'UTF-8') { |
5578 | - return (string) \mb_substr( |
|
5578 | + return (string)\mb_substr( |
|
5579 | 5579 | $str, |
5580 | 5580 | 0, |
5581 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
5581 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
5582 | 5582 | ); |
5583 | 5583 | } |
5584 | 5584 | |
5585 | 5585 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5586 | 5586 | |
5587 | - return (string) self::substr( |
|
5587 | + return (string)self::substr( |
|
5588 | 5588 | $str, |
5589 | 5589 | 0, |
5590 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
5590 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
5591 | 5591 | $encoding |
5592 | 5592 | ); |
5593 | 5593 | } |
@@ -5690,7 +5690,7 @@ discard block |
||
5690 | 5690 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
5691 | 5691 | @\mb_substitute_character($replacement_char_helper); |
5692 | 5692 | // the polyfill maybe return false, so cast to string |
5693 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5693 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5694 | 5694 | \mb_substitute_character($save); |
5695 | 5695 | } |
5696 | 5696 | |
@@ -5736,7 +5736,7 @@ discard block |
||
5736 | 5736 | } |
5737 | 5737 | |
5738 | 5738 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5739 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5739 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5740 | 5740 | } |
5741 | 5741 | |
5742 | 5742 | if ($chars !== null) { |
@@ -5766,7 +5766,7 @@ discard block |
||
5766 | 5766 | $html .= '<pre>'; |
5767 | 5767 | /** @noinspection AlterInForeachInspection */ |
5768 | 5768 | foreach (self::$SUPPORT as $key => &$value) { |
5769 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5769 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
5770 | 5770 | } |
5771 | 5771 | $html .= '</pre>'; |
5772 | 5772 | |
@@ -5808,7 +5808,7 @@ discard block |
||
5808 | 5808 | return $char; |
5809 | 5809 | } |
5810 | 5810 | |
5811 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5811 | + return '&#'.self::ord($char, $encoding).';'; |
|
5812 | 5812 | } |
5813 | 5813 | |
5814 | 5814 | /** |
@@ -5912,11 +5912,11 @@ discard block |
||
5912 | 5912 | $lang, |
5913 | 5913 | $try_to_keep_the_string_length |
5914 | 5914 | ); |
5915 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5915 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5916 | 5916 | |
5917 | 5917 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5918 | 5918 | |
5919 | - $str = (string) \preg_replace_callback( |
|
5919 | + $str = (string)\preg_replace_callback( |
|
5920 | 5920 | '/[-_\\s]+(.)?/u', |
5921 | 5921 | /** |
5922 | 5922 | * @param array $match |
@@ -5925,7 +5925,7 @@ discard block |
||
5925 | 5925 | * |
5926 | 5926 | * @return string |
5927 | 5927 | */ |
5928 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5928 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5929 | 5929 | if (isset($match[1])) { |
5930 | 5930 | if ($use_mb_functions) { |
5931 | 5931 | if ($encoding === 'UTF-8') { |
@@ -5943,7 +5943,7 @@ discard block |
||
5943 | 5943 | $str |
5944 | 5944 | ); |
5945 | 5945 | |
5946 | - return (string) \preg_replace_callback( |
|
5946 | + return (string)\preg_replace_callback( |
|
5947 | 5947 | '/[\\p{N}]+(.)?/u', |
5948 | 5948 | /** |
5949 | 5949 | * @param array $match |
@@ -5952,7 +5952,7 @@ discard block |
||
5952 | 5952 | * |
5953 | 5953 | * @return string |
5954 | 5954 | */ |
5955 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5955 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5956 | 5956 | if ($use_mb_functions) { |
5957 | 5957 | if ($encoding === 'UTF-8') { |
5958 | 5958 | return \mb_strtoupper($match[0]); |
@@ -6151,7 +6151,7 @@ discard block |
||
6151 | 6151 | ): string { |
6152 | 6152 | if (self::$SUPPORT['mbstring'] === true) { |
6153 | 6153 | /** @noinspection PhpComposerExtensionStubsInspection */ |
6154 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
6154 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
6155 | 6155 | |
6156 | 6156 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
6157 | 6157 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6161,10 +6161,10 @@ discard block |
||
6161 | 6161 | } |
6162 | 6162 | |
6163 | 6163 | /** @noinspection PhpComposerExtensionStubsInspection */ |
6164 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
6164 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
6165 | 6165 | } |
6166 | 6166 | |
6167 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
6167 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
6168 | 6168 | |
6169 | 6169 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
6170 | 6170 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6173,7 +6173,7 @@ discard block |
||
6173 | 6173 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
6174 | 6174 | } |
6175 | 6175 | |
6176 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
6176 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
6177 | 6177 | } |
6178 | 6178 | |
6179 | 6179 | /** |
@@ -6197,7 +6197,7 @@ discard block |
||
6197 | 6197 | public static function str_detect_encoding($str) |
6198 | 6198 | { |
6199 | 6199 | // init |
6200 | - $str = (string) $str; |
|
6200 | + $str = (string)$str; |
|
6201 | 6201 | |
6202 | 6202 | // |
6203 | 6203 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -6299,7 +6299,7 @@ discard block |
||
6299 | 6299 | foreach (self::$ENCODINGS as $encoding_tmp) { |
6300 | 6300 | // INFO: //IGNORE but still throw notice |
6301 | 6301 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
6302 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
6302 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
6303 | 6303 | return $encoding_tmp; |
6304 | 6304 | } |
6305 | 6305 | } |
@@ -6407,7 +6407,7 @@ discard block |
||
6407 | 6407 | return $str; |
6408 | 6408 | } |
6409 | 6409 | |
6410 | - return $substring . $str; |
|
6410 | + return $substring.$str; |
|
6411 | 6411 | } |
6412 | 6412 | |
6413 | 6413 | /** |
@@ -6703,27 +6703,27 @@ discard block |
||
6703 | 6703 | string $encoding = 'UTF-8' |
6704 | 6704 | ): string { |
6705 | 6705 | if ($encoding === 'UTF-8') { |
6706 | - $len = (int) \mb_strlen($str); |
|
6706 | + $len = (int)\mb_strlen($str); |
|
6707 | 6707 | if ($index > $len) { |
6708 | 6708 | return $str; |
6709 | 6709 | } |
6710 | 6710 | |
6711 | 6711 | /** @noinspection UnnecessaryCastingInspection */ |
6712 | - return (string) \mb_substr($str, 0, $index) . |
|
6713 | - $substring . |
|
6714 | - (string) \mb_substr($str, $index, $len); |
|
6712 | + return (string)\mb_substr($str, 0, $index). |
|
6713 | + $substring. |
|
6714 | + (string)\mb_substr($str, $index, $len); |
|
6715 | 6715 | } |
6716 | 6716 | |
6717 | 6717 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6718 | 6718 | |
6719 | - $len = (int) self::strlen($str, $encoding); |
|
6719 | + $len = (int)self::strlen($str, $encoding); |
|
6720 | 6720 | if ($index > $len) { |
6721 | 6721 | return $str; |
6722 | 6722 | } |
6723 | 6723 | |
6724 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
6725 | - $substring . |
|
6726 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6724 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
6725 | + $substring. |
|
6726 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
6727 | 6727 | } |
6728 | 6728 | |
6729 | 6729 | /** |
@@ -6763,15 +6763,15 @@ discard block |
||
6763 | 6763 | */ |
6764 | 6764 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
6765 | 6765 | { |
6766 | - $search = (array) $search; |
|
6766 | + $search = (array)$search; |
|
6767 | 6767 | |
6768 | 6768 | /** @noinspection AlterInForeachInspection */ |
6769 | 6769 | foreach ($search as &$s) { |
6770 | - $s = (string) $s; |
|
6770 | + $s = (string)$s; |
|
6771 | 6771 | if ($s === '') { |
6772 | 6772 | $s = '/^(?<=.)$/'; |
6773 | 6773 | } else { |
6774 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
6774 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
6775 | 6775 | } |
6776 | 6776 | } |
6777 | 6777 | |
@@ -6819,12 +6819,12 @@ discard block |
||
6819 | 6819 | } |
6820 | 6820 | |
6821 | 6821 | if ($search === '') { |
6822 | - return $str . $replacement; |
|
6822 | + return $str.$replacement; |
|
6823 | 6823 | } |
6824 | 6824 | |
6825 | 6825 | $searchLength = \strlen($search); |
6826 | 6826 | if (\strncasecmp($str, $search, $searchLength) === 0) { |
6827 | - return $replacement . \substr($str, $searchLength); |
|
6827 | + return $replacement.\substr($str, $searchLength); |
|
6828 | 6828 | } |
6829 | 6829 | |
6830 | 6830 | return $str; |
@@ -6855,11 +6855,11 @@ discard block |
||
6855 | 6855 | } |
6856 | 6856 | |
6857 | 6857 | if ($search === '') { |
6858 | - return $str . $replacement; |
|
6858 | + return $str.$replacement; |
|
6859 | 6859 | } |
6860 | 6860 | |
6861 | 6861 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6862 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6862 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6863 | 6863 | } |
6864 | 6864 | |
6865 | 6865 | return $str; |
@@ -6951,15 +6951,15 @@ discard block |
||
6951 | 6951 | } |
6952 | 6952 | |
6953 | 6953 | if ($encoding === 'UTF-8') { |
6954 | - return (string) \mb_substr( |
|
6954 | + return (string)\mb_substr( |
|
6955 | 6955 | $str, |
6956 | - $offset + (int) \mb_strlen($separator) |
|
6956 | + $offset + (int)\mb_strlen($separator) |
|
6957 | 6957 | ); |
6958 | 6958 | } |
6959 | 6959 | |
6960 | - return (string) self::substr( |
|
6960 | + return (string)self::substr( |
|
6961 | 6961 | $str, |
6962 | - $offset + (int) self::strlen($separator, $encoding), |
|
6962 | + $offset + (int)self::strlen($separator, $encoding), |
|
6963 | 6963 | null, |
6964 | 6964 | $encoding |
6965 | 6965 | ); |
@@ -6991,15 +6991,15 @@ discard block |
||
6991 | 6991 | } |
6992 | 6992 | |
6993 | 6993 | if ($encoding === 'UTF-8') { |
6994 | - return (string) \mb_substr( |
|
6994 | + return (string)\mb_substr( |
|
6995 | 6995 | $str, |
6996 | - $offset + (int) self::strlen($separator) |
|
6996 | + $offset + (int)self::strlen($separator) |
|
6997 | 6997 | ); |
6998 | 6998 | } |
6999 | 6999 | |
7000 | - return (string) self::substr( |
|
7000 | + return (string)self::substr( |
|
7001 | 7001 | $str, |
7002 | - $offset + (int) self::strlen($separator, $encoding), |
|
7002 | + $offset + (int)self::strlen($separator, $encoding), |
|
7003 | 7003 | null, |
7004 | 7004 | $encoding |
7005 | 7005 | ); |
@@ -7031,10 +7031,10 @@ discard block |
||
7031 | 7031 | } |
7032 | 7032 | |
7033 | 7033 | if ($encoding === 'UTF-8') { |
7034 | - return (string) \mb_substr($str, 0, $offset); |
|
7034 | + return (string)\mb_substr($str, 0, $offset); |
|
7035 | 7035 | } |
7036 | 7036 | |
7037 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
7037 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
7038 | 7038 | } |
7039 | 7039 | |
7040 | 7040 | /** |
@@ -7063,7 +7063,7 @@ discard block |
||
7063 | 7063 | return ''; |
7064 | 7064 | } |
7065 | 7065 | |
7066 | - return (string) \mb_substr($str, 0, $offset); |
|
7066 | + return (string)\mb_substr($str, 0, $offset); |
|
7067 | 7067 | } |
7068 | 7068 | |
7069 | 7069 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -7071,7 +7071,7 @@ discard block |
||
7071 | 7071 | return ''; |
7072 | 7072 | } |
7073 | 7073 | |
7074 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
7074 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
7075 | 7075 | } |
7076 | 7076 | |
7077 | 7077 | /** |
@@ -7173,12 +7173,12 @@ discard block |
||
7173 | 7173 | } |
7174 | 7174 | |
7175 | 7175 | if ($encoding === 'UTF-8') { |
7176 | - return (string) \mb_substr($str, -$n); |
|
7176 | + return (string)\mb_substr($str, -$n); |
|
7177 | 7177 | } |
7178 | 7178 | |
7179 | 7179 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7180 | 7180 | |
7181 | - return (string) self::substr($str, -$n, null, $encoding); |
|
7181 | + return (string)self::substr($str, -$n, null, $encoding); |
|
7182 | 7182 | } |
7183 | 7183 | |
7184 | 7184 | /** |
@@ -7204,21 +7204,21 @@ discard block |
||
7204 | 7204 | } |
7205 | 7205 | |
7206 | 7206 | if ($encoding === 'UTF-8') { |
7207 | - if ((int) \mb_strlen($str) <= $length) { |
|
7207 | + if ((int)\mb_strlen($str) <= $length) { |
|
7208 | 7208 | return $str; |
7209 | 7209 | } |
7210 | 7210 | |
7211 | 7211 | /** @noinspection UnnecessaryCastingInspection */ |
7212 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
7212 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
7213 | 7213 | } |
7214 | 7214 | |
7215 | 7215 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7216 | 7216 | |
7217 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
7217 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
7218 | 7218 | return $str; |
7219 | 7219 | } |
7220 | 7220 | |
7221 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
7221 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
7222 | 7222 | } |
7223 | 7223 | |
7224 | 7224 | /** |
@@ -7247,12 +7247,12 @@ discard block |
||
7247 | 7247 | |
7248 | 7248 | if ($encoding === 'UTF-8') { |
7249 | 7249 | /** @noinspection UnnecessaryCastingInspection */ |
7250 | - if ((int) \mb_strlen($str) <= $length) { |
|
7250 | + if ((int)\mb_strlen($str) <= $length) { |
|
7251 | 7251 | return $str; |
7252 | 7252 | } |
7253 | 7253 | |
7254 | 7254 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
7255 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
7255 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
7256 | 7256 | } |
7257 | 7257 | |
7258 | 7258 | $str = \mb_substr($str, 0, $length); |
@@ -7261,33 +7261,33 @@ discard block |
||
7261 | 7261 | $new_str = \implode(' ', $array); |
7262 | 7262 | |
7263 | 7263 | if ($new_str === '') { |
7264 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
7264 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
7265 | 7265 | } |
7266 | 7266 | } else { |
7267 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
7267 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
7268 | 7268 | return $str; |
7269 | 7269 | } |
7270 | 7270 | |
7271 | 7271 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
7272 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
7272 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
7273 | 7273 | } |
7274 | 7274 | |
7275 | 7275 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
7276 | 7276 | $str = self::substr($str, 0, $length, $encoding); |
7277 | 7277 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
7278 | 7278 | if ($str === false) { |
7279 | - return '' . $str_add_on; |
|
7279 | + return ''.$str_add_on; |
|
7280 | 7280 | } |
7281 | 7281 | |
7282 | 7282 | $array = \explode(' ', $str, -1); |
7283 | 7283 | $new_str = \implode(' ', $array); |
7284 | 7284 | |
7285 | 7285 | if ($new_str === '') { |
7286 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
7286 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
7287 | 7287 | } |
7288 | 7288 | } |
7289 | 7289 | |
7290 | - return $new_str . $str_add_on; |
|
7290 | + return $new_str.$str_add_on; |
|
7291 | 7291 | } |
7292 | 7292 | |
7293 | 7293 | /** |
@@ -7310,7 +7310,7 @@ discard block |
||
7310 | 7310 | $longest_common_prefix = ''; |
7311 | 7311 | |
7312 | 7312 | if ($encoding === 'UTF-8') { |
7313 | - $max_length = (int) \min( |
|
7313 | + $max_length = (int)\min( |
|
7314 | 7314 | \mb_strlen($str1), |
7315 | 7315 | \mb_strlen($str2) |
7316 | 7316 | ); |
@@ -7331,7 +7331,7 @@ discard block |
||
7331 | 7331 | } else { |
7332 | 7332 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7333 | 7333 | |
7334 | - $max_length = (int) \min( |
|
7334 | + $max_length = (int)\min( |
|
7335 | 7335 | self::strlen($str1, $encoding), |
7336 | 7336 | self::strlen($str2, $encoding) |
7337 | 7337 | ); |
@@ -7380,13 +7380,13 @@ discard block |
||
7380 | 7380 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
7381 | 7381 | |
7382 | 7382 | if ($encoding === 'UTF-8') { |
7383 | - $str_length = (int) \mb_strlen($str1); |
|
7384 | - $other_length = (int) \mb_strlen($str2); |
|
7383 | + $str_length = (int)\mb_strlen($str1); |
|
7384 | + $other_length = (int)\mb_strlen($str2); |
|
7385 | 7385 | } else { |
7386 | 7386 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7387 | 7387 | |
7388 | - $str_length = (int) self::strlen($str1, $encoding); |
|
7389 | - $other_length = (int) self::strlen($str2, $encoding); |
|
7388 | + $str_length = (int)self::strlen($str1, $encoding); |
|
7389 | + $other_length = (int)self::strlen($str2, $encoding); |
|
7390 | 7390 | } |
7391 | 7391 | |
7392 | 7392 | // Return if either string is empty |
@@ -7439,10 +7439,10 @@ discard block |
||
7439 | 7439 | } |
7440 | 7440 | |
7441 | 7441 | if ($encoding === 'UTF-8') { |
7442 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
7442 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
7443 | 7443 | } |
7444 | 7444 | |
7445 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
7445 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
7446 | 7446 | } |
7447 | 7447 | |
7448 | 7448 | /** |
@@ -7466,7 +7466,7 @@ discard block |
||
7466 | 7466 | } |
7467 | 7467 | |
7468 | 7468 | if ($encoding === 'UTF-8') { |
7469 | - $max_length = (int) \min( |
|
7469 | + $max_length = (int)\min( |
|
7470 | 7470 | \mb_strlen($str1, $encoding), |
7471 | 7471 | \mb_strlen($str2, $encoding) |
7472 | 7472 | ); |
@@ -7480,7 +7480,7 @@ discard block |
||
7480 | 7480 | && |
7481 | 7481 | $char === \mb_substr($str2, -$i, 1) |
7482 | 7482 | ) { |
7483 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7483 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7484 | 7484 | } else { |
7485 | 7485 | break; |
7486 | 7486 | } |
@@ -7488,7 +7488,7 @@ discard block |
||
7488 | 7488 | } else { |
7489 | 7489 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7490 | 7490 | |
7491 | - $max_length = (int) \min( |
|
7491 | + $max_length = (int)\min( |
|
7492 | 7492 | self::strlen($str1, $encoding), |
7493 | 7493 | self::strlen($str2, $encoding) |
7494 | 7494 | ); |
@@ -7502,7 +7502,7 @@ discard block |
||
7502 | 7502 | && |
7503 | 7503 | $char === self::substr($str2, -$i, 1, $encoding) |
7504 | 7504 | ) { |
7505 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7505 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7506 | 7506 | } else { |
7507 | 7507 | break; |
7508 | 7508 | } |
@@ -7525,7 +7525,7 @@ discard block |
||
7525 | 7525 | */ |
7526 | 7526 | public static function str_matches_pattern(string $str, string $pattern): bool |
7527 | 7527 | { |
7528 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
7528 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
7529 | 7529 | } |
7530 | 7530 | |
7531 | 7531 | /** |
@@ -7545,7 +7545,7 @@ discard block |
||
7545 | 7545 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
7546 | 7546 | { |
7547 | 7547 | // init |
7548 | - $length = (int) self::strlen($str, $encoding); |
|
7548 | + $length = (int)self::strlen($str, $encoding); |
|
7549 | 7549 | |
7550 | 7550 | if ($offset >= 0) { |
7551 | 7551 | return $length > $offset; |
@@ -7574,7 +7574,7 @@ discard block |
||
7574 | 7574 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
7575 | 7575 | { |
7576 | 7576 | // init |
7577 | - $length = (int) self::strlen($str); |
|
7577 | + $length = (int)self::strlen($str); |
|
7578 | 7578 | |
7579 | 7579 | if ( |
7580 | 7580 | ($index >= 0 && $length <= $index) |
@@ -7618,7 +7618,7 @@ discard block |
||
7618 | 7618 | return $str; |
7619 | 7619 | } |
7620 | 7620 | |
7621 | - if ($pad_type !== (int) $pad_type) { |
|
7621 | + if ($pad_type !== (int)$pad_type) { |
|
7622 | 7622 | if ($pad_type === 'left') { |
7623 | 7623 | $pad_type = \STR_PAD_LEFT; |
7624 | 7624 | } elseif ($pad_type === 'right') { |
@@ -7627,23 +7627,23 @@ discard block |
||
7627 | 7627 | $pad_type = \STR_PAD_BOTH; |
7628 | 7628 | } else { |
7629 | 7629 | throw new \InvalidArgumentException( |
7630 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
7630 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
7631 | 7631 | ); |
7632 | 7632 | } |
7633 | 7633 | } |
7634 | 7634 | |
7635 | 7635 | if ($encoding === 'UTF-8') { |
7636 | - $str_length = (int) \mb_strlen($str); |
|
7636 | + $str_length = (int)\mb_strlen($str); |
|
7637 | 7637 | |
7638 | 7638 | if ($pad_length >= $str_length) { |
7639 | 7639 | switch ($pad_type) { |
7640 | 7640 | case \STR_PAD_LEFT: |
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 | - $pre = (string) \mb_substr( |
|
7646 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7645 | + $pre = (string)\mb_substr( |
|
7646 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7647 | 7647 | 0, |
7648 | 7648 | $diff |
7649 | 7649 | ); |
@@ -7654,16 +7654,16 @@ discard block |
||
7654 | 7654 | case \STR_PAD_BOTH: |
7655 | 7655 | $diff = ($pad_length - $str_length); |
7656 | 7656 | |
7657 | - $ps_length_left = (int) \floor($diff / 2); |
|
7657 | + $ps_length_left = (int)\floor($diff / 2); |
|
7658 | 7658 | |
7659 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7659 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7660 | 7660 | |
7661 | - $pre = (string) \mb_substr( |
|
7661 | + $pre = (string)\mb_substr( |
|
7662 | 7662 | \str_repeat($pad_string, $ps_length_left), |
7663 | 7663 | 0, |
7664 | 7664 | $ps_length_left |
7665 | 7665 | ); |
7666 | - $post = (string) \mb_substr( |
|
7666 | + $post = (string)\mb_substr( |
|
7667 | 7667 | \str_repeat($pad_string, $ps_length_right), |
7668 | 7668 | 0, |
7669 | 7669 | $ps_length_right |
@@ -7673,19 +7673,19 @@ discard block |
||
7673 | 7673 | |
7674 | 7674 | case \STR_PAD_RIGHT: |
7675 | 7675 | default: |
7676 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7676 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7677 | 7677 | |
7678 | 7678 | $diff = ($pad_length - $str_length); |
7679 | 7679 | |
7680 | - $post = (string) \mb_substr( |
|
7681 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7680 | + $post = (string)\mb_substr( |
|
7681 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7682 | 7682 | 0, |
7683 | 7683 | $diff |
7684 | 7684 | ); |
7685 | 7685 | $pre = ''; |
7686 | 7686 | } |
7687 | 7687 | |
7688 | - return $pre . $str . $post; |
|
7688 | + return $pre.$str.$post; |
|
7689 | 7689 | } |
7690 | 7690 | |
7691 | 7691 | return $str; |
@@ -7693,17 +7693,17 @@ discard block |
||
7693 | 7693 | |
7694 | 7694 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7695 | 7695 | |
7696 | - $str_length = (int) self::strlen($str, $encoding); |
|
7696 | + $str_length = (int)self::strlen($str, $encoding); |
|
7697 | 7697 | |
7698 | 7698 | if ($pad_length >= $str_length) { |
7699 | 7699 | switch ($pad_type) { |
7700 | 7700 | case \STR_PAD_LEFT: |
7701 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7701 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7702 | 7702 | |
7703 | 7703 | $diff = ($pad_length - $str_length); |
7704 | 7704 | |
7705 | - $pre = (string) self::substr( |
|
7706 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7705 | + $pre = (string)self::substr( |
|
7706 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7707 | 7707 | 0, |
7708 | 7708 | $diff, |
7709 | 7709 | $encoding |
@@ -7715,17 +7715,17 @@ discard block |
||
7715 | 7715 | case \STR_PAD_BOTH: |
7716 | 7716 | $diff = ($pad_length - $str_length); |
7717 | 7717 | |
7718 | - $ps_length_left = (int) \floor($diff / 2); |
|
7718 | + $ps_length_left = (int)\floor($diff / 2); |
|
7719 | 7719 | |
7720 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7720 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7721 | 7721 | |
7722 | - $pre = (string) self::substr( |
|
7722 | + $pre = (string)self::substr( |
|
7723 | 7723 | \str_repeat($pad_string, $ps_length_left), |
7724 | 7724 | 0, |
7725 | 7725 | $ps_length_left, |
7726 | 7726 | $encoding |
7727 | 7727 | ); |
7728 | - $post = (string) self::substr( |
|
7728 | + $post = (string)self::substr( |
|
7729 | 7729 | \str_repeat($pad_string, $ps_length_right), |
7730 | 7730 | 0, |
7731 | 7731 | $ps_length_right, |
@@ -7736,12 +7736,12 @@ discard block |
||
7736 | 7736 | |
7737 | 7737 | case \STR_PAD_RIGHT: |
7738 | 7738 | default: |
7739 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7739 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7740 | 7740 | |
7741 | 7741 | $diff = ($pad_length - $str_length); |
7742 | 7742 | |
7743 | - $post = (string) self::substr( |
|
7744 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7743 | + $post = (string)self::substr( |
|
7744 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7745 | 7745 | 0, |
7746 | 7746 | $diff, |
7747 | 7747 | $encoding |
@@ -7749,7 +7749,7 @@ discard block |
||
7749 | 7749 | $pre = ''; |
7750 | 7750 | } |
7751 | 7751 | |
7752 | - return $pre . $str . $post; |
|
7752 | + return $pre.$str.$post; |
|
7753 | 7753 | } |
7754 | 7754 | |
7755 | 7755 | return $str; |
@@ -7960,12 +7960,12 @@ discard block |
||
7960 | 7960 | } |
7961 | 7961 | |
7962 | 7962 | if ($search === '') { |
7963 | - return $str . $replacement; |
|
7963 | + return $str.$replacement; |
|
7964 | 7964 | } |
7965 | 7965 | |
7966 | 7966 | $searchLength = \strlen($search); |
7967 | 7967 | if (\strncmp($str, $search, $searchLength) === 0) { |
7968 | - return $replacement . \substr($str, $searchLength); |
|
7968 | + return $replacement.\substr($str, $searchLength); |
|
7969 | 7969 | } |
7970 | 7970 | |
7971 | 7971 | return $str; |
@@ -7999,11 +7999,11 @@ discard block |
||
7999 | 7999 | } |
8000 | 8000 | |
8001 | 8001 | if ($search === '') { |
8002 | - return $str . $replacement; |
|
8002 | + return $str.$replacement; |
|
8003 | 8003 | } |
8004 | 8004 | |
8005 | 8005 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
8006 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
8006 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
8007 | 8007 | } |
8008 | 8008 | |
8009 | 8009 | return $str; |
@@ -8037,7 +8037,7 @@ discard block |
||
8037 | 8037 | $subject, |
8038 | 8038 | $replace, |
8039 | 8039 | $pos, |
8040 | - (int) self::strlen($search) |
|
8040 | + (int)self::strlen($search) |
|
8041 | 8041 | ); |
8042 | 8042 | } |
8043 | 8043 | |
@@ -8071,7 +8071,7 @@ discard block |
||
8071 | 8071 | $subject, |
8072 | 8072 | $replace, |
8073 | 8073 | $pos, |
8074 | - (int) self::strlen($search) |
|
8074 | + (int)self::strlen($search) |
|
8075 | 8075 | ); |
8076 | 8076 | } |
8077 | 8077 | |
@@ -8094,7 +8094,7 @@ discard block |
||
8094 | 8094 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
8095 | 8095 | { |
8096 | 8096 | if ($encoding === 'UTF-8') { |
8097 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
8097 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
8098 | 8098 | /** @noinspection NonSecureShuffleUsageInspection */ |
8099 | 8099 | \shuffle($indexes); |
8100 | 8100 | |
@@ -8110,7 +8110,7 @@ discard block |
||
8110 | 8110 | } else { |
8111 | 8111 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8112 | 8112 | |
8113 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
8113 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
8114 | 8114 | /** @noinspection NonSecureShuffleUsageInspection */ |
8115 | 8115 | \shuffle($indexes); |
8116 | 8116 | |
@@ -8153,11 +8153,11 @@ discard block |
||
8153 | 8153 | ) { |
8154 | 8154 | if ($encoding === 'UTF-8') { |
8155 | 8155 | if ($end === null) { |
8156 | - $length = (int) \mb_strlen($str); |
|
8156 | + $length = (int)\mb_strlen($str); |
|
8157 | 8157 | } elseif ($end >= 0 && $end <= $start) { |
8158 | 8158 | return ''; |
8159 | 8159 | } elseif ($end < 0) { |
8160 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
8160 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
8161 | 8161 | } else { |
8162 | 8162 | $length = $end - $start; |
8163 | 8163 | } |
@@ -8168,11 +8168,11 @@ discard block |
||
8168 | 8168 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8169 | 8169 | |
8170 | 8170 | if ($end === null) { |
8171 | - $length = (int) self::strlen($str, $encoding); |
|
8171 | + $length = (int)self::strlen($str, $encoding); |
|
8172 | 8172 | } elseif ($end >= 0 && $end <= $start) { |
8173 | 8173 | return ''; |
8174 | 8174 | } elseif ($end < 0) { |
8175 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
8175 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
8176 | 8176 | } else { |
8177 | 8177 | $length = $end - $start; |
8178 | 8178 | } |
@@ -8207,7 +8207,7 @@ discard block |
||
8207 | 8207 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8208 | 8208 | } |
8209 | 8209 | |
8210 | - $str = (string) \preg_replace_callback( |
|
8210 | + $str = (string)\preg_replace_callback( |
|
8211 | 8211 | '/([\\p{N}|\\p{Lu}])/u', |
8212 | 8212 | /** |
8213 | 8213 | * @param string[] $matches |
@@ -8216,28 +8216,28 @@ discard block |
||
8216 | 8216 | * |
8217 | 8217 | * @return string |
8218 | 8218 | */ |
8219 | - static function (array $matches) use ($encoding): string { |
|
8219 | + static function(array $matches) use ($encoding): string { |
|
8220 | 8220 | $match = $matches[1]; |
8221 | - $match_int = (int) $match; |
|
8221 | + $match_int = (int)$match; |
|
8222 | 8222 | |
8223 | - if ((string) $match_int === $match) { |
|
8224 | - return '_' . $match . '_'; |
|
8223 | + if ((string)$match_int === $match) { |
|
8224 | + return '_'.$match.'_'; |
|
8225 | 8225 | } |
8226 | 8226 | |
8227 | 8227 | if ($encoding === 'UTF-8') { |
8228 | - return '_' . \mb_strtolower($match); |
|
8228 | + return '_'.\mb_strtolower($match); |
|
8229 | 8229 | } |
8230 | 8230 | |
8231 | - return '_' . self::strtolower($match, $encoding); |
|
8231 | + return '_'.self::strtolower($match, $encoding); |
|
8232 | 8232 | }, |
8233 | 8233 | $str |
8234 | 8234 | ); |
8235 | 8235 | |
8236 | - $str = (string) \preg_replace( |
|
8236 | + $str = (string)\preg_replace( |
|
8237 | 8237 | [ |
8238 | - '/\\s+/u', // convert spaces to "_" |
|
8238 | + '/\\s+/u', // convert spaces to "_" |
|
8239 | 8239 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
8240 | - '/_+/', // remove double "_" |
|
8240 | + '/_+/', // remove double "_" |
|
8241 | 8241 | ], |
8242 | 8242 | [ |
8243 | 8243 | '_', |
@@ -8368,7 +8368,7 @@ discard block |
||
8368 | 8368 | } |
8369 | 8369 | |
8370 | 8370 | // init |
8371 | - $input = (string) $input; |
|
8371 | + $input = (string)$input; |
|
8372 | 8372 | |
8373 | 8373 | if ($input === '') { |
8374 | 8374 | return []; |
@@ -8425,7 +8425,7 @@ discard block |
||
8425 | 8425 | ($input[$i] & "\xE0") === "\xC0" |
8426 | 8426 | ) { |
8427 | 8427 | if (($input[$i + 1] & "\xC0") === "\x80") { |
8428 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
8428 | + $ret[] = $input[$i].$input[$i + 1]; |
|
8429 | 8429 | |
8430 | 8430 | ++$i; |
8431 | 8431 | } |
@@ -8439,7 +8439,7 @@ discard block |
||
8439 | 8439 | && |
8440 | 8440 | ($input[$i + 2] & "\xC0") === "\x80" |
8441 | 8441 | ) { |
8442 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
8442 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
8443 | 8443 | |
8444 | 8444 | $i += 2; |
8445 | 8445 | } |
@@ -8455,7 +8455,7 @@ discard block |
||
8455 | 8455 | && |
8456 | 8456 | ($input[$i + 3] & "\xC0") === "\x80" |
8457 | 8457 | ) { |
8458 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
8458 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
8459 | 8459 | |
8460 | 8460 | $i += 3; |
8461 | 8461 | } |
@@ -8467,7 +8467,7 @@ discard block |
||
8467 | 8467 | $ret = \array_chunk($ret, $length); |
8468 | 8468 | |
8469 | 8469 | return \array_map( |
8470 | - static function (array $item): string { |
|
8470 | + static function(array $item): string { |
|
8471 | 8471 | return \implode('', $item); |
8472 | 8472 | }, |
8473 | 8473 | $ret |
@@ -8533,7 +8533,7 @@ discard block |
||
8533 | 8533 | $limit = -1; |
8534 | 8534 | } |
8535 | 8535 | |
8536 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
8536 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
8537 | 8537 | |
8538 | 8538 | if ($array === false) { |
8539 | 8539 | return []; |
@@ -8634,9 +8634,9 @@ discard block |
||
8634 | 8634 | return ''; |
8635 | 8635 | } |
8636 | 8636 | |
8637 | - return (string) \mb_substr( |
|
8637 | + return (string)\mb_substr( |
|
8638 | 8638 | $str, |
8639 | - $offset + (int) \mb_strlen($separator) |
|
8639 | + $offset + (int)\mb_strlen($separator) |
|
8640 | 8640 | ); |
8641 | 8641 | } |
8642 | 8642 | |
@@ -8645,9 +8645,9 @@ discard block |
||
8645 | 8645 | return ''; |
8646 | 8646 | } |
8647 | 8647 | |
8648 | - return (string) \mb_substr( |
|
8648 | + return (string)\mb_substr( |
|
8649 | 8649 | $str, |
8650 | - $offset + (int) self::strlen($separator, $encoding), |
|
8650 | + $offset + (int)self::strlen($separator, $encoding), |
|
8651 | 8651 | null, |
8652 | 8652 | $encoding |
8653 | 8653 | ); |
@@ -8679,9 +8679,9 @@ discard block |
||
8679 | 8679 | return ''; |
8680 | 8680 | } |
8681 | 8681 | |
8682 | - return (string) \mb_substr( |
|
8682 | + return (string)\mb_substr( |
|
8683 | 8683 | $str, |
8684 | - $offset + (int) \mb_strlen($separator) |
|
8684 | + $offset + (int)\mb_strlen($separator) |
|
8685 | 8685 | ); |
8686 | 8686 | } |
8687 | 8687 | |
@@ -8690,9 +8690,9 @@ discard block |
||
8690 | 8690 | return ''; |
8691 | 8691 | } |
8692 | 8692 | |
8693 | - return (string) self::substr( |
|
8693 | + return (string)self::substr( |
|
8694 | 8694 | $str, |
8695 | - $offset + (int) self::strlen($separator, $encoding), |
|
8695 | + $offset + (int)self::strlen($separator, $encoding), |
|
8696 | 8696 | null, |
8697 | 8697 | $encoding |
8698 | 8698 | ); |
@@ -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 |
@@ -8736,7 +8736,7 @@ discard block |
||
8736 | 8736 | return ''; |
8737 | 8737 | } |
8738 | 8738 | |
8739 | - return (string) self::substr( |
|
8739 | + return (string)self::substr( |
|
8740 | 8740 | $str, |
8741 | 8741 | 0, |
8742 | 8742 | $offset, |
@@ -8767,7 +8767,7 @@ discard block |
||
8767 | 8767 | return ''; |
8768 | 8768 | } |
8769 | 8769 | |
8770 | - return (string) \mb_substr( |
|
8770 | + return (string)\mb_substr( |
|
8771 | 8771 | $str, |
8772 | 8772 | 0, |
8773 | 8773 | $offset |
@@ -8781,7 +8781,7 @@ discard block |
||
8781 | 8781 | |
8782 | 8782 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8783 | 8783 | |
8784 | - return (string) self::substr( |
|
8784 | + return (string)self::substr( |
|
8785 | 8785 | $str, |
8786 | 8786 | 0, |
8787 | 8787 | $offset, |
@@ -8896,7 +8896,7 @@ discard block |
||
8896 | 8896 | */ |
8897 | 8897 | public static function str_surround(string $str, string $substring): string |
8898 | 8898 | { |
8899 | - return $substring . $str . $substring; |
|
8899 | + return $substring.$str.$substring; |
|
8900 | 8900 | } |
8901 | 8901 | |
8902 | 8902 | /** |
@@ -8960,9 +8960,9 @@ discard block |
||
8960 | 8960 | $word_define_chars = ''; |
8961 | 8961 | } |
8962 | 8962 | |
8963 | - $str = (string) \preg_replace_callback( |
|
8964 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
8965 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8963 | + $str = (string)\preg_replace_callback( |
|
8964 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
8965 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8966 | 8966 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
8967 | 8967 | return $match[0]; |
8968 | 8968 | } |
@@ -9129,16 +9129,16 @@ discard block |
||
9129 | 9129 | |
9130 | 9130 | // the main substitutions |
9131 | 9131 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
9132 | - $str = (string) \preg_replace_callback( |
|
9132 | + $str = (string)\preg_replace_callback( |
|
9133 | 9133 | '~\\b (_*) (?: # 1. Leading underscore and |
9134 | 9134 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
9135 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
9135 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
9136 | 9136 | | |
9137 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
9137 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
9138 | 9138 | | |
9139 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
9139 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
9140 | 9140 | | |
9141 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
9141 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
9142 | 9142 | ) (_*) \\b # 6. With trailing underscore |
9143 | 9143 | ~ux', |
9144 | 9144 | /** |
@@ -9148,7 +9148,7 @@ discard block |
||
9148 | 9148 | * |
9149 | 9149 | * @return string |
9150 | 9150 | */ |
9151 | - static function (array $matches) use ($encoding): string { |
|
9151 | + static function(array $matches) use ($encoding): string { |
|
9152 | 9152 | // preserve leading underscore |
9153 | 9153 | $str = $matches[1]; |
9154 | 9154 | if ($matches[2]) { |
@@ -9173,11 +9173,11 @@ discard block |
||
9173 | 9173 | ); |
9174 | 9174 | |
9175 | 9175 | // Exceptions for small words: capitalize at start of title... |
9176 | - $str = (string) \preg_replace_callback( |
|
9176 | + $str = (string)\preg_replace_callback( |
|
9177 | 9177 | '~( \\A [[:punct:]]* # start of title... |
9178 | 9178 | | [:.;?!][ ]+ # or of subsentence... |
9179 | 9179 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
9180 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
9180 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
9181 | 9181 | ~uxi', |
9182 | 9182 | /** |
9183 | 9183 | * @param string[] $matches |
@@ -9186,15 +9186,15 @@ discard block |
||
9186 | 9186 | * |
9187 | 9187 | * @return string |
9188 | 9188 | */ |
9189 | - static function (array $matches) use ($encoding): string { |
|
9190 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
9189 | + static function(array $matches) use ($encoding): string { |
|
9190 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
9191 | 9191 | }, |
9192 | 9192 | $str |
9193 | 9193 | ); |
9194 | 9194 | |
9195 | 9195 | // ...and end of title |
9196 | - $str = (string) \preg_replace_callback( |
|
9197 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
9196 | + $str = (string)\preg_replace_callback( |
|
9197 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
9198 | 9198 | (?= [[:punct:]]* \Z # ...at the end of the title... |
9199 | 9199 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
9200 | 9200 | ~uxi', |
@@ -9205,7 +9205,7 @@ discard block |
||
9205 | 9205 | * |
9206 | 9206 | * @return string |
9207 | 9207 | */ |
9208 | - static function (array $matches) use ($encoding): string { |
|
9208 | + static function(array $matches) use ($encoding): string { |
|
9209 | 9209 | return static::ucfirst($matches[1], $encoding); |
9210 | 9210 | }, |
9211 | 9211 | $str |
@@ -9213,10 +9213,10 @@ discard block |
||
9213 | 9213 | |
9214 | 9214 | // Exceptions for small words in hyphenated compound words. |
9215 | 9215 | // e.g. "in-flight" -> In-Flight |
9216 | - $str = (string) \preg_replace_callback( |
|
9216 | + $str = (string)\preg_replace_callback( |
|
9217 | 9217 | '~\\b |
9218 | 9218 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
9219 | - ( ' . $small_words_rx . ' ) |
|
9219 | + ( ' . $small_words_rx.' ) |
|
9220 | 9220 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
9221 | 9221 | ~uxi', |
9222 | 9222 | /** |
@@ -9226,18 +9226,18 @@ discard block |
||
9226 | 9226 | * |
9227 | 9227 | * @return string |
9228 | 9228 | */ |
9229 | - static function (array $matches) use ($encoding): string { |
|
9229 | + static function(array $matches) use ($encoding): string { |
|
9230 | 9230 | return static::ucfirst($matches[1], $encoding); |
9231 | 9231 | }, |
9232 | 9232 | $str |
9233 | 9233 | ); |
9234 | 9234 | |
9235 | 9235 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
9236 | - $str = (string) \preg_replace_callback( |
|
9236 | + $str = (string)\preg_replace_callback( |
|
9237 | 9237 | '~\\b |
9238 | 9238 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
9239 | 9239 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
9240 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
9240 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
9241 | 9241 | (?! - ) # Negative lookahead for another - |
9242 | 9242 | ~uxi', |
9243 | 9243 | /** |
@@ -9247,8 +9247,8 @@ discard block |
||
9247 | 9247 | * |
9248 | 9248 | * @return string |
9249 | 9249 | */ |
9250 | - static function (array $matches) use ($encoding): string { |
|
9251 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
9250 | + static function(array $matches) use ($encoding): string { |
|
9251 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
9252 | 9252 | }, |
9253 | 9253 | $str |
9254 | 9254 | ); |
@@ -9367,7 +9367,7 @@ discard block |
||
9367 | 9367 | ); |
9368 | 9368 | |
9369 | 9369 | foreach ($tmp_return as &$item) { |
9370 | - $item = (string) $item; |
|
9370 | + $item = (string)$item; |
|
9371 | 9371 | } |
9372 | 9372 | |
9373 | 9373 | return $tmp_return; |
@@ -9421,39 +9421,39 @@ discard block |
||
9421 | 9421 | } |
9422 | 9422 | |
9423 | 9423 | if ($encoding === 'UTF-8') { |
9424 | - if ($length >= (int) \mb_strlen($str)) { |
|
9424 | + if ($length >= (int)\mb_strlen($str)) { |
|
9425 | 9425 | return $str; |
9426 | 9426 | } |
9427 | 9427 | |
9428 | 9428 | if ($substring !== '') { |
9429 | - $length -= (int) \mb_strlen($substring); |
|
9429 | + $length -= (int)\mb_strlen($substring); |
|
9430 | 9430 | |
9431 | 9431 | /** @noinspection UnnecessaryCastingInspection */ |
9432 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
9432 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
9433 | 9433 | } |
9434 | 9434 | |
9435 | 9435 | /** @noinspection UnnecessaryCastingInspection */ |
9436 | - return (string) \mb_substr($str, 0, $length); |
|
9436 | + return (string)\mb_substr($str, 0, $length); |
|
9437 | 9437 | } |
9438 | 9438 | |
9439 | 9439 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9440 | 9440 | |
9441 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
9441 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
9442 | 9442 | return $str; |
9443 | 9443 | } |
9444 | 9444 | |
9445 | 9445 | if ($substring !== '') { |
9446 | - $length -= (int) self::strlen($substring, $encoding); |
|
9446 | + $length -= (int)self::strlen($substring, $encoding); |
|
9447 | 9447 | } |
9448 | 9448 | |
9449 | 9449 | return ( |
9450 | - (string) self::substr( |
|
9450 | + (string)self::substr( |
|
9451 | 9451 | $str, |
9452 | 9452 | 0, |
9453 | 9453 | $length, |
9454 | 9454 | $encoding |
9455 | 9455 | ) |
9456 | - ) . $substring; |
|
9456 | + ).$substring; |
|
9457 | 9457 | } |
9458 | 9458 | |
9459 | 9459 | /** |
@@ -9487,12 +9487,12 @@ discard block |
||
9487 | 9487 | } |
9488 | 9488 | |
9489 | 9489 | if ($encoding === 'UTF-8') { |
9490 | - if ($length >= (int) \mb_strlen($str)) { |
|
9490 | + if ($length >= (int)\mb_strlen($str)) { |
|
9491 | 9491 | return $str; |
9492 | 9492 | } |
9493 | 9493 | |
9494 | 9494 | // need to further trim the string so we can append the substring |
9495 | - $length -= (int) \mb_strlen($substring); |
|
9495 | + $length -= (int)\mb_strlen($substring); |
|
9496 | 9496 | if ($length <= 0) { |
9497 | 9497 | return $substring; |
9498 | 9498 | } |
@@ -9518,18 +9518,18 @@ discard block |
||
9518 | 9518 | !$ignore_do_not_split_words_for_one_word |
9519 | 9519 | ) |
9520 | 9520 | ) { |
9521 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
9521 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
9522 | 9522 | } |
9523 | 9523 | } |
9524 | 9524 | } else { |
9525 | 9525 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9526 | 9526 | |
9527 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
9527 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
9528 | 9528 | return $str; |
9529 | 9529 | } |
9530 | 9530 | |
9531 | 9531 | // need to further trim the string so we can append the substring |
9532 | - $length -= (int) self::strlen($substring, $encoding); |
|
9532 | + $length -= (int)self::strlen($substring, $encoding); |
|
9533 | 9533 | if ($length <= 0) { |
9534 | 9534 | return $substring; |
9535 | 9535 | } |
@@ -9555,12 +9555,12 @@ discard block |
||
9555 | 9555 | !$ignore_do_not_split_words_for_one_word |
9556 | 9556 | ) |
9557 | 9557 | ) { |
9558 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
9558 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
9559 | 9559 | } |
9560 | 9560 | } |
9561 | 9561 | } |
9562 | 9562 | |
9563 | - return $truncated . $substring; |
|
9563 | + return $truncated.$substring; |
|
9564 | 9564 | } |
9565 | 9565 | |
9566 | 9566 | /** |
@@ -9687,13 +9687,13 @@ discard block |
||
9687 | 9687 | } |
9688 | 9688 | } elseif ($format === 2) { |
9689 | 9689 | $number_of_words = []; |
9690 | - $offset = (int) self::strlen($str_parts[0]); |
|
9690 | + $offset = (int)self::strlen($str_parts[0]); |
|
9691 | 9691 | for ($i = 1; $i < $len; $i += 2) { |
9692 | 9692 | $number_of_words[$offset] = $str_parts[$i]; |
9693 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
9693 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
9694 | 9694 | } |
9695 | 9695 | } else { |
9696 | - $number_of_words = (int) (($len - 1) / 2); |
|
9696 | + $number_of_words = (int)(($len - 1) / 2); |
|
9697 | 9697 | } |
9698 | 9698 | |
9699 | 9699 | return $number_of_words; |
@@ -9826,7 +9826,7 @@ discard block |
||
9826 | 9826 | } |
9827 | 9827 | |
9828 | 9828 | if ($char_list === '') { |
9829 | - return (int) self::strlen($str, $encoding); |
|
9829 | + return (int)self::strlen($str, $encoding); |
|
9830 | 9830 | } |
9831 | 9831 | |
9832 | 9832 | if ($offset || $length !== null) { |
@@ -9853,7 +9853,7 @@ discard block |
||
9853 | 9853 | } |
9854 | 9854 | |
9855 | 9855 | $matches = []; |
9856 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
9856 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
9857 | 9857 | $return = self::strlen($matches[1], $encoding); |
9858 | 9858 | if ($return === false) { |
9859 | 9859 | return 0; |
@@ -9862,7 +9862,7 @@ discard block |
||
9862 | 9862 | return $return; |
9863 | 9863 | } |
9864 | 9864 | |
9865 | - return (int) self::strlen($str, $encoding); |
|
9865 | + return (int)self::strlen($str, $encoding); |
|
9866 | 9866 | } |
9867 | 9867 | |
9868 | 9868 | /** |
@@ -9925,7 +9925,7 @@ discard block |
||
9925 | 9925 | |
9926 | 9926 | $str = ''; |
9927 | 9927 | foreach ($intOrHex as $strPart) { |
9928 | - $str .= '&#' . (int) $strPart . ';'; |
|
9928 | + $str .= '&#'.(int)$strPart.';'; |
|
9929 | 9929 | } |
9930 | 9930 | |
9931 | 9931 | // We cannot use ENT_HTML5 here, as carriage return ( ) is not |
@@ -10024,7 +10024,7 @@ discard block |
||
10024 | 10024 | return ''; |
10025 | 10025 | } |
10026 | 10026 | |
10027 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
10027 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
10028 | 10028 | } |
10029 | 10029 | |
10030 | 10030 | /** |
@@ -10103,7 +10103,7 @@ discard block |
||
10103 | 10103 | // fallback for ascii only |
10104 | 10104 | // |
10105 | 10105 | |
10106 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10106 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10107 | 10107 | return \stripos($haystack, $needle, $offset); |
10108 | 10108 | } |
10109 | 10109 | |
@@ -10192,7 +10192,7 @@ discard block |
||
10192 | 10192 | /** |
10193 | 10193 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10194 | 10194 | */ |
10195 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10195 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10196 | 10196 | } |
10197 | 10197 | |
10198 | 10198 | if ( |
@@ -10206,11 +10206,11 @@ discard block |
||
10206 | 10206 | } |
10207 | 10207 | } |
10208 | 10208 | |
10209 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
10209 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
10210 | 10210 | return \stristr($haystack, $needle, $before_needle); |
10211 | 10211 | } |
10212 | 10212 | |
10213 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
10213 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
10214 | 10214 | |
10215 | 10215 | if (!isset($match[1])) { |
10216 | 10216 | return false; |
@@ -10220,7 +10220,7 @@ discard block |
||
10220 | 10220 | return $match[1]; |
10221 | 10221 | } |
10222 | 10222 | |
10223 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
10223 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
10224 | 10224 | } |
10225 | 10225 | |
10226 | 10226 | /** |
@@ -10303,7 +10303,7 @@ discard block |
||
10303 | 10303 | /** |
10304 | 10304 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10305 | 10305 | */ |
10306 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10306 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10307 | 10307 | } |
10308 | 10308 | |
10309 | 10309 | // |
@@ -10441,8 +10441,8 @@ discard block |
||
10441 | 10441 | } |
10442 | 10442 | |
10443 | 10443 | return \strnatcmp( |
10444 | - (string) self::strtonatfold($str1), |
|
10445 | - (string) self::strtonatfold($str2) |
|
10444 | + (string)self::strtonatfold($str1), |
|
10445 | + (string)self::strtonatfold($str2) |
|
10446 | 10446 | ); |
10447 | 10447 | } |
10448 | 10448 | |
@@ -10512,11 +10512,11 @@ discard block |
||
10512 | 10512 | } |
10513 | 10513 | |
10514 | 10514 | if ($encoding === 'UTF-8') { |
10515 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
10516 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
10515 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
10516 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
10517 | 10517 | } else { |
10518 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
10519 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
10518 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
10519 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
10520 | 10520 | } |
10521 | 10521 | |
10522 | 10522 | return self::strcmp($str1, $str2); |
@@ -10543,8 +10543,8 @@ discard block |
||
10543 | 10543 | return false; |
10544 | 10544 | } |
10545 | 10545 | |
10546 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
10547 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
10546 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
10547 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
10548 | 10548 | } |
10549 | 10549 | |
10550 | 10550 | return false; |
@@ -10589,10 +10589,10 @@ discard block |
||
10589 | 10589 | } |
10590 | 10590 | |
10591 | 10591 | // iconv and mbstring do not support integer $needle |
10592 | - if ((int) $needle === $needle) { |
|
10593 | - $needle = (string) self::chr($needle); |
|
10592 | + if ((int)$needle === $needle) { |
|
10593 | + $needle = (string)self::chr($needle); |
|
10594 | 10594 | } |
10595 | - $needle = (string) $needle; |
|
10595 | + $needle = (string)$needle; |
|
10596 | 10596 | |
10597 | 10597 | if ($haystack === '') { |
10598 | 10598 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -10652,7 +10652,7 @@ discard block |
||
10652 | 10652 | /** |
10653 | 10653 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10654 | 10654 | */ |
10655 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10655 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10656 | 10656 | } |
10657 | 10657 | |
10658 | 10658 | // |
@@ -10693,7 +10693,7 @@ discard block |
||
10693 | 10693 | // fallback for ascii only |
10694 | 10694 | // |
10695 | 10695 | |
10696 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10696 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10697 | 10697 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
10698 | 10698 | return @\strpos($haystack, $needle, $offset); |
10699 | 10699 | } |
@@ -10706,7 +10706,7 @@ discard block |
||
10706 | 10706 | if ($haystack_tmp === false) { |
10707 | 10707 | $haystack_tmp = ''; |
10708 | 10708 | } |
10709 | - $haystack = (string) $haystack_tmp; |
|
10709 | + $haystack = (string)$haystack_tmp; |
|
10710 | 10710 | |
10711 | 10711 | if ($offset < 0) { |
10712 | 10712 | $offset = 0; |
@@ -10718,7 +10718,7 @@ discard block |
||
10718 | 10718 | } |
10719 | 10719 | |
10720 | 10720 | if ($pos) { |
10721 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10721 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10722 | 10722 | } |
10723 | 10723 | |
10724 | 10724 | return $offset + 0; |
@@ -10873,7 +10873,7 @@ discard block |
||
10873 | 10873 | /** |
10874 | 10874 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10875 | 10875 | */ |
10876 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10876 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10877 | 10877 | } |
10878 | 10878 | |
10879 | 10879 | // |
@@ -10885,7 +10885,7 @@ discard block |
||
10885 | 10885 | if ($needle_tmp === false) { |
10886 | 10886 | return false; |
10887 | 10887 | } |
10888 | - $needle = (string) $needle_tmp; |
|
10888 | + $needle = (string)$needle_tmp; |
|
10889 | 10889 | |
10890 | 10890 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
10891 | 10891 | if ($pos === false) { |
@@ -10907,7 +10907,7 @@ discard block |
||
10907 | 10907 | if ($needle_tmp === false) { |
10908 | 10908 | return false; |
10909 | 10909 | } |
10910 | - $needle = (string) $needle_tmp; |
|
10910 | + $needle = (string)$needle_tmp; |
|
10911 | 10911 | |
10912 | 10912 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
10913 | 10913 | if ($pos === false) { |
@@ -10948,7 +10948,7 @@ discard block |
||
10948 | 10948 | if ($encoding === 'UTF-8') { |
10949 | 10949 | if (self::$SUPPORT['intl'] === true) { |
10950 | 10950 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
10951 | - $i = (int) \grapheme_strlen($str); |
|
10951 | + $i = (int)\grapheme_strlen($str); |
|
10952 | 10952 | while ($i--) { |
10953 | 10953 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
10954 | 10954 | if ($reversed_tmp !== false) { |
@@ -10956,7 +10956,7 @@ discard block |
||
10956 | 10956 | } |
10957 | 10957 | } |
10958 | 10958 | } else { |
10959 | - $i = (int) \mb_strlen($str); |
|
10959 | + $i = (int)\mb_strlen($str); |
|
10960 | 10960 | while ($i--) { |
10961 | 10961 | $reversed_tmp = \mb_substr($str, $i, 1); |
10962 | 10962 | if ($reversed_tmp !== false) { |
@@ -10967,7 +10967,7 @@ discard block |
||
10967 | 10967 | } else { |
10968 | 10968 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10969 | 10969 | |
10970 | - $i = (int) self::strlen($str, $encoding); |
|
10970 | + $i = (int)self::strlen($str, $encoding); |
|
10971 | 10971 | while ($i--) { |
10972 | 10972 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
10973 | 10973 | if ($reversed_tmp !== false) { |
@@ -11046,7 +11046,7 @@ discard block |
||
11046 | 11046 | if ($needle_tmp === false) { |
11047 | 11047 | return false; |
11048 | 11048 | } |
11049 | - $needle = (string) $needle_tmp; |
|
11049 | + $needle = (string)$needle_tmp; |
|
11050 | 11050 | |
11051 | 11051 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
11052 | 11052 | if ($pos === false) { |
@@ -11095,10 +11095,10 @@ discard block |
||
11095 | 11095 | } |
11096 | 11096 | |
11097 | 11097 | // iconv and mbstring do not support integer $needle |
11098 | - if ((int) $needle === $needle && $needle >= 0) { |
|
11099 | - $needle = (string) self::chr($needle); |
|
11098 | + if ((int)$needle === $needle && $needle >= 0) { |
|
11099 | + $needle = (string)self::chr($needle); |
|
11100 | 11100 | } |
11101 | - $needle = (string) $needle; |
|
11101 | + $needle = (string)$needle; |
|
11102 | 11102 | |
11103 | 11103 | if ($haystack === '') { |
11104 | 11104 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -11154,7 +11154,7 @@ discard block |
||
11154 | 11154 | /** |
11155 | 11155 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11156 | 11156 | */ |
11157 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11157 | + \trigger_error('UTF8::strripos() 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 \strripos($haystack, $needle, $offset); |
11183 | 11183 | } |
11184 | 11184 | |
@@ -11267,10 +11267,10 @@ discard block |
||
11267 | 11267 | } |
11268 | 11268 | |
11269 | 11269 | // iconv and mbstring do not support integer $needle |
11270 | - if ((int) $needle === $needle && $needle >= 0) { |
|
11271 | - $needle = (string) self::chr($needle); |
|
11270 | + if ((int)$needle === $needle && $needle >= 0) { |
|
11271 | + $needle = (string)self::chr($needle); |
|
11272 | 11272 | } |
11273 | - $needle = (string) $needle; |
|
11273 | + $needle = (string)$needle; |
|
11274 | 11274 | |
11275 | 11275 | if ($haystack === '') { |
11276 | 11276 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -11326,7 +11326,7 @@ discard block |
||
11326 | 11326 | /** |
11327 | 11327 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11328 | 11328 | */ |
11329 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11329 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11330 | 11330 | } |
11331 | 11331 | |
11332 | 11332 | // |
@@ -11350,7 +11350,7 @@ discard block |
||
11350 | 11350 | // fallback for ascii only |
11351 | 11351 | // |
11352 | 11352 | |
11353 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11353 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11354 | 11354 | return \strrpos($haystack, $needle, $offset); |
11355 | 11355 | } |
11356 | 11356 | |
@@ -11370,7 +11370,7 @@ discard block |
||
11370 | 11370 | if ($haystack_tmp === false) { |
11371 | 11371 | $haystack_tmp = ''; |
11372 | 11372 | } |
11373 | - $haystack = (string) $haystack_tmp; |
|
11373 | + $haystack = (string)$haystack_tmp; |
|
11374 | 11374 | } |
11375 | 11375 | |
11376 | 11376 | $pos = \strrpos($haystack, $needle); |
@@ -11384,7 +11384,7 @@ discard block |
||
11384 | 11384 | return false; |
11385 | 11385 | } |
11386 | 11386 | |
11387 | - return $offset + (int) self::strlen($str_tmp); |
|
11387 | + return $offset + (int)self::strlen($str_tmp); |
|
11388 | 11388 | } |
11389 | 11389 | |
11390 | 11390 | /** |
@@ -11452,12 +11452,12 @@ discard block |
||
11452 | 11452 | if ($offset || $length !== null) { |
11453 | 11453 | if ($encoding === 'UTF-8') { |
11454 | 11454 | if ($length === null) { |
11455 | - $str = (string) \mb_substr($str, $offset); |
|
11455 | + $str = (string)\mb_substr($str, $offset); |
|
11456 | 11456 | } else { |
11457 | - $str = (string) \mb_substr($str, $offset, $length); |
|
11457 | + $str = (string)\mb_substr($str, $offset, $length); |
|
11458 | 11458 | } |
11459 | 11459 | } else { |
11460 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
11460 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
11461 | 11461 | } |
11462 | 11462 | } |
11463 | 11463 | |
@@ -11467,7 +11467,7 @@ discard block |
||
11467 | 11467 | |
11468 | 11468 | $matches = []; |
11469 | 11469 | |
11470 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
11470 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
11471 | 11471 | } |
11472 | 11472 | |
11473 | 11473 | /** |
@@ -11561,7 +11561,7 @@ discard block |
||
11561 | 11561 | /** |
11562 | 11562 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11563 | 11563 | */ |
11564 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11564 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11565 | 11565 | } |
11566 | 11566 | |
11567 | 11567 | // |
@@ -11583,7 +11583,7 @@ discard block |
||
11583 | 11583 | // fallback for ascii only |
11584 | 11584 | // |
11585 | 11585 | |
11586 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11586 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11587 | 11587 | return \strstr($haystack, $needle, $before_needle); |
11588 | 11588 | } |
11589 | 11589 | |
@@ -11591,7 +11591,7 @@ discard block |
||
11591 | 11591 | // fallback via vanilla php |
11592 | 11592 | // |
11593 | 11593 | |
11594 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
11594 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
11595 | 11595 | |
11596 | 11596 | if (!isset($match[1])) { |
11597 | 11597 | return false; |
@@ -11601,7 +11601,7 @@ discard block |
||
11601 | 11601 | return $match[1]; |
11602 | 11602 | } |
11603 | 11603 | |
11604 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
11604 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
11605 | 11605 | } |
11606 | 11606 | |
11607 | 11607 | /** |
@@ -11731,7 +11731,7 @@ discard block |
||
11731 | 11731 | bool $try_to_keep_the_string_length = false |
11732 | 11732 | ): string { |
11733 | 11733 | // init |
11734 | - $str = (string) $str; |
|
11734 | + $str = (string)$str; |
|
11735 | 11735 | |
11736 | 11736 | if ($str === '') { |
11737 | 11737 | return ''; |
@@ -11760,25 +11760,25 @@ discard block |
||
11760 | 11760 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11761 | 11761 | } |
11762 | 11762 | |
11763 | - $language_code = $lang . '-Lower'; |
|
11763 | + $language_code = $lang.'-Lower'; |
|
11764 | 11764 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11765 | 11765 | /** |
11766 | 11766 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11767 | 11767 | */ |
11768 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11768 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11769 | 11769 | |
11770 | 11770 | $language_code = 'Any-Lower'; |
11771 | 11771 | } |
11772 | 11772 | |
11773 | 11773 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11774 | 11774 | /** @noinspection UnnecessaryCastingInspection */ |
11775 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11775 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11776 | 11776 | } |
11777 | 11777 | |
11778 | 11778 | /** |
11779 | 11779 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11780 | 11780 | */ |
11781 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
11781 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
11782 | 11782 | } |
11783 | 11783 | |
11784 | 11784 | // always fallback via symfony polyfill |
@@ -11813,7 +11813,7 @@ discard block |
||
11813 | 11813 | bool $try_to_keep_the_string_length = false |
11814 | 11814 | ): string { |
11815 | 11815 | // init |
11816 | - $str = (string) $str; |
|
11816 | + $str = (string)$str; |
|
11817 | 11817 | |
11818 | 11818 | if ($str === '') { |
11819 | 11819 | return ''; |
@@ -11842,25 +11842,25 @@ discard block |
||
11842 | 11842 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11843 | 11843 | } |
11844 | 11844 | |
11845 | - $language_code = $lang . '-Upper'; |
|
11845 | + $language_code = $lang.'-Upper'; |
|
11846 | 11846 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11847 | 11847 | /** |
11848 | 11848 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11849 | 11849 | */ |
11850 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
11850 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
11851 | 11851 | |
11852 | 11852 | $language_code = 'Any-Upper'; |
11853 | 11853 | } |
11854 | 11854 | |
11855 | 11855 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11856 | 11856 | /** @noinspection UnnecessaryCastingInspection */ |
11857 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11857 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11858 | 11858 | } |
11859 | 11859 | |
11860 | 11860 | /** |
11861 | 11861 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11862 | 11862 | */ |
11863 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
11863 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
11864 | 11864 | } |
11865 | 11865 | |
11866 | 11866 | // always fallback via symfony polyfill |
@@ -11924,7 +11924,7 @@ discard block |
||
11924 | 11924 | $from = \array_combine($from, $to); |
11925 | 11925 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
11926 | 11926 | if ($from === false) { |
11927 | - 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) . ')'); |
|
11927 | + 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).')'); |
|
11928 | 11928 | } |
11929 | 11929 | } |
11930 | 11930 | |
@@ -11990,9 +11990,9 @@ discard block |
||
11990 | 11990 | } |
11991 | 11991 | |
11992 | 11992 | $wide = 0; |
11993 | - $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); |
|
11993 | + $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); |
|
11994 | 11994 | |
11995 | - return ($wide << 1) + (int) self::strlen($str); |
|
11995 | + return ($wide << 1) + (int)self::strlen($str); |
|
11996 | 11996 | } |
11997 | 11997 | |
11998 | 11998 | /** |
@@ -12091,7 +12091,7 @@ discard block |
||
12091 | 12091 | return ''; |
12092 | 12092 | } |
12093 | 12093 | |
12094 | - $length = $length ?? (int) $str_length; |
|
12094 | + $length = $length ?? (int)$str_length; |
|
12095 | 12095 | |
12096 | 12096 | if ( |
12097 | 12097 | $encoding !== 'UTF-8' |
@@ -12101,7 +12101,7 @@ discard block |
||
12101 | 12101 | /** |
12102 | 12102 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
12103 | 12103 | */ |
12104 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
12104 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
12105 | 12105 | } |
12106 | 12106 | |
12107 | 12107 | // |
@@ -12197,16 +12197,16 @@ discard block |
||
12197 | 12197 | ) { |
12198 | 12198 | if ($encoding === 'UTF-8') { |
12199 | 12199 | if ($length === null) { |
12200 | - $str1 = (string) \mb_substr($str1, $offset); |
|
12200 | + $str1 = (string)\mb_substr($str1, $offset); |
|
12201 | 12201 | } else { |
12202 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
12202 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
12203 | 12203 | } |
12204 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
12204 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
12205 | 12205 | } else { |
12206 | 12206 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12207 | 12207 | |
12208 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
12209 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
12208 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
12209 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
12210 | 12210 | } |
12211 | 12211 | } |
12212 | 12212 | |
@@ -12281,13 +12281,13 @@ discard block |
||
12281 | 12281 | if ($length_tmp === false) { |
12282 | 12282 | return false; |
12283 | 12283 | } |
12284 | - $length = (int) $length_tmp; |
|
12284 | + $length = (int)$length_tmp; |
|
12285 | 12285 | } |
12286 | 12286 | |
12287 | 12287 | if ($encoding === 'UTF-8') { |
12288 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
12288 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
12289 | 12289 | } else { |
12290 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
12290 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
12291 | 12291 | } |
12292 | 12292 | } |
12293 | 12293 | |
@@ -12299,7 +12299,7 @@ discard block |
||
12299 | 12299 | /** |
12300 | 12300 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
12301 | 12301 | */ |
12302 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
12302 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
12303 | 12303 | } |
12304 | 12304 | |
12305 | 12305 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -12310,7 +12310,7 @@ discard block |
||
12310 | 12310 | return \mb_substr_count($haystack, $needle, $encoding); |
12311 | 12311 | } |
12312 | 12312 | |
12313 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
12313 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
12314 | 12314 | |
12315 | 12315 | return \count($matches); |
12316 | 12316 | } |
@@ -12360,7 +12360,7 @@ discard block |
||
12360 | 12360 | if ($length_tmp === false) { |
12361 | 12361 | return false; |
12362 | 12362 | } |
12363 | - $length = (int) $length_tmp; |
|
12363 | + $length = (int)$length_tmp; |
|
12364 | 12364 | } |
12365 | 12365 | |
12366 | 12366 | if ( |
@@ -12382,7 +12382,7 @@ discard block |
||
12382 | 12382 | if ($haystack_tmp === false) { |
12383 | 12383 | $haystack_tmp = ''; |
12384 | 12384 | } |
12385 | - $haystack = (string) $haystack_tmp; |
|
12385 | + $haystack = (string)$haystack_tmp; |
|
12386 | 12386 | } |
12387 | 12387 | |
12388 | 12388 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -12423,10 +12423,10 @@ discard block |
||
12423 | 12423 | |
12424 | 12424 | if ($encoding === 'UTF-8') { |
12425 | 12425 | if ($case_sensitive) { |
12426 | - return (int) \mb_substr_count($str, $substring); |
|
12426 | + return (int)\mb_substr_count($str, $substring); |
|
12427 | 12427 | } |
12428 | 12428 | |
12429 | - return (int) \mb_substr_count( |
|
12429 | + return (int)\mb_substr_count( |
|
12430 | 12430 | \mb_strtoupper($str), |
12431 | 12431 | \mb_strtoupper($substring) |
12432 | 12432 | ); |
@@ -12435,10 +12435,10 @@ discard block |
||
12435 | 12435 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12436 | 12436 | |
12437 | 12437 | if ($case_sensitive) { |
12438 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
12438 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
12439 | 12439 | } |
12440 | 12440 | |
12441 | - return (int) \mb_substr_count( |
|
12441 | + return (int)\mb_substr_count( |
|
12442 | 12442 | self::strtocasefold($str, true, false, $encoding, null, false), |
12443 | 12443 | self::strtocasefold($substring, true, false, $encoding, null, false), |
12444 | 12444 | $encoding |
@@ -12472,7 +12472,7 @@ discard block |
||
12472 | 12472 | } |
12473 | 12473 | |
12474 | 12474 | if (self::str_istarts_with($haystack, $needle)) { |
12475 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
12475 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
12476 | 12476 | } |
12477 | 12477 | |
12478 | 12478 | return $haystack; |
@@ -12539,7 +12539,7 @@ discard block |
||
12539 | 12539 | } |
12540 | 12540 | |
12541 | 12541 | if (self::str_iends_with($haystack, $needle)) { |
12542 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
12542 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
12543 | 12543 | } |
12544 | 12544 | |
12545 | 12545 | return $haystack; |
@@ -12572,7 +12572,7 @@ discard block |
||
12572 | 12572 | } |
12573 | 12573 | |
12574 | 12574 | if (self::str_starts_with($haystack, $needle)) { |
12575 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
12575 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
12576 | 12576 | } |
12577 | 12577 | |
12578 | 12578 | return $haystack; |
@@ -12629,7 +12629,7 @@ discard block |
||
12629 | 12629 | if (\is_array($offset)) { |
12630 | 12630 | $offset = \array_slice($offset, 0, $num); |
12631 | 12631 | foreach ($offset as &$value_tmp) { |
12632 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
12632 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
12633 | 12633 | } |
12634 | 12634 | unset($value_tmp); |
12635 | 12635 | } else { |
@@ -12642,7 +12642,7 @@ discard block |
||
12642 | 12642 | } elseif (\is_array($length)) { |
12643 | 12643 | $length = \array_slice($length, 0, $num); |
12644 | 12644 | foreach ($length as &$value_tmp_V2) { |
12645 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
12645 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
12646 | 12646 | } |
12647 | 12647 | unset($value_tmp_V2); |
12648 | 12648 | } else { |
@@ -12662,8 +12662,8 @@ discard block |
||
12662 | 12662 | } |
12663 | 12663 | |
12664 | 12664 | // init |
12665 | - $str = (string) $str; |
|
12666 | - $replacement = (string) $replacement; |
|
12665 | + $str = (string)$str; |
|
12666 | + $replacement = (string)$replacement; |
|
12667 | 12667 | |
12668 | 12668 | if (\is_array($length)) { |
12669 | 12669 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -12678,16 +12678,16 @@ discard block |
||
12678 | 12678 | } |
12679 | 12679 | |
12680 | 12680 | if (self::$SUPPORT['mbstring'] === true) { |
12681 | - $string_length = (int) self::strlen($str, $encoding); |
|
12681 | + $string_length = (int)self::strlen($str, $encoding); |
|
12682 | 12682 | |
12683 | 12683 | if ($offset < 0) { |
12684 | - $offset = (int) \max(0, $string_length + $offset); |
|
12684 | + $offset = (int)\max(0, $string_length + $offset); |
|
12685 | 12685 | } elseif ($offset > $string_length) { |
12686 | 12686 | $offset = $string_length; |
12687 | 12687 | } |
12688 | 12688 | |
12689 | 12689 | if ($length !== null && $length < 0) { |
12690 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
12690 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
12691 | 12691 | } elseif ($length === null || $length > $string_length) { |
12692 | 12692 | $length = $string_length; |
12693 | 12693 | } |
@@ -12698,9 +12698,9 @@ discard block |
||
12698 | 12698 | } |
12699 | 12699 | |
12700 | 12700 | /** @noinspection AdditionOperationOnArraysInspection */ |
12701 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
12702 | - $replacement . |
|
12703 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
12701 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
12702 | + $replacement. |
|
12703 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
12704 | 12704 | } |
12705 | 12705 | |
12706 | 12706 | // |
@@ -12709,8 +12709,7 @@ discard block |
||
12709 | 12709 | |
12710 | 12710 | if (ASCII::is_ascii($str)) { |
12711 | 12711 | return ($length === null) ? |
12712 | - \substr_replace($str, $replacement, $offset) : |
|
12713 | - \substr_replace($str, $replacement, $offset, $length); |
|
12712 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
12714 | 12713 | } |
12715 | 12714 | |
12716 | 12715 | // |
@@ -12726,7 +12725,7 @@ discard block |
||
12726 | 12725 | // e.g.: non mbstring support + invalid chars |
12727 | 12726 | return ''; |
12728 | 12727 | } |
12729 | - $length = (int) $length_tmp; |
|
12728 | + $length = (int)$length_tmp; |
|
12730 | 12729 | } |
12731 | 12730 | |
12732 | 12731 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12769,14 +12768,14 @@ discard block |
||
12769 | 12768 | && |
12770 | 12769 | \substr($haystack, -\strlen($needle)) === $needle |
12771 | 12770 | ) { |
12772 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
12771 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
12773 | 12772 | } |
12774 | 12773 | |
12775 | 12774 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
12776 | - return (string) self::substr( |
|
12775 | + return (string)self::substr( |
|
12777 | 12776 | $haystack, |
12778 | 12777 | 0, |
12779 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
12778 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
12780 | 12779 | $encoding |
12781 | 12780 | ); |
12782 | 12781 | } |
@@ -12811,10 +12810,10 @@ discard block |
||
12811 | 12810 | } |
12812 | 12811 | |
12813 | 12812 | if ($encoding === 'UTF-8') { |
12814 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12813 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12815 | 12814 | } |
12816 | 12815 | |
12817 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12816 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12818 | 12817 | } |
12819 | 12818 | |
12820 | 12819 | /** |
@@ -13026,7 +13025,7 @@ discard block |
||
13026 | 13025 | public static function to_boolean($str): bool |
13027 | 13026 | { |
13028 | 13027 | // init |
13029 | - $str = (string) $str; |
|
13028 | + $str = (string)$str; |
|
13030 | 13029 | |
13031 | 13030 | if ($str === '') { |
13032 | 13031 | return false; |
@@ -13054,10 +13053,10 @@ discard block |
||
13054 | 13053 | } |
13055 | 13054 | |
13056 | 13055 | if (\is_numeric($str)) { |
13057 | - return ((float) $str + 0) > 0; |
|
13056 | + return ((float)$str + 0) > 0; |
|
13058 | 13057 | } |
13059 | 13058 | |
13060 | - return (bool) \trim($str); |
|
13059 | + return (bool)\trim($str); |
|
13061 | 13060 | } |
13062 | 13061 | |
13063 | 13062 | /** |
@@ -13105,7 +13104,7 @@ discard block |
||
13105 | 13104 | return $str; |
13106 | 13105 | } |
13107 | 13106 | |
13108 | - $str = (string) $str; |
|
13107 | + $str = (string)$str; |
|
13109 | 13108 | if ($str === '') { |
13110 | 13109 | return ''; |
13111 | 13110 | } |
@@ -13213,7 +13212,7 @@ discard block |
||
13213 | 13212 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
13214 | 13213 | |
13215 | 13214 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13216 | - $buf .= $c1 . $c2; |
|
13215 | + $buf .= $c1.$c2; |
|
13217 | 13216 | ++$i; |
13218 | 13217 | } else { // not valid UTF8 - convert it |
13219 | 13218 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13224,7 +13223,7 @@ discard block |
||
13224 | 13223 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
13225 | 13224 | |
13226 | 13225 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13227 | - $buf .= $c1 . $c2 . $c3; |
|
13226 | + $buf .= $c1.$c2.$c3; |
|
13228 | 13227 | $i += 2; |
13229 | 13228 | } else { // not valid UTF8 - convert it |
13230 | 13229 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13236,7 +13235,7 @@ discard block |
||
13236 | 13235 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
13237 | 13236 | |
13238 | 13237 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13239 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
13238 | + $buf .= $c1.$c2.$c3.$c4; |
|
13240 | 13239 | $i += 3; |
13241 | 13240 | } else { // not valid UTF8 - convert it |
13242 | 13241 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13264,13 +13263,13 @@ discard block |
||
13264 | 13263 | * |
13265 | 13264 | * @return string |
13266 | 13265 | */ |
13267 | - static function (array $matches): string { |
|
13266 | + static function(array $matches): string { |
|
13268 | 13267 | if (isset($matches[3])) { |
13269 | - $cp = (int) \hexdec($matches[3]); |
|
13268 | + $cp = (int)\hexdec($matches[3]); |
|
13270 | 13269 | } else { |
13271 | 13270 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
13272 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
13273 | - + (int) \hexdec($matches[2]) |
|
13271 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
13272 | + + (int)\hexdec($matches[2]) |
|
13274 | 13273 | + 0x10000 |
13275 | 13274 | - (0xD800 << 10) |
13276 | 13275 | - 0xDC00; |
@@ -13281,12 +13280,12 @@ discard block |
||
13281 | 13280 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
13282 | 13281 | |
13283 | 13282 | if ($cp < 0x80) { |
13284 | - return (string) self::chr($cp); |
|
13283 | + return (string)self::chr($cp); |
|
13285 | 13284 | } |
13286 | 13285 | |
13287 | 13286 | if ($cp < 0xA0) { |
13288 | 13287 | /** @noinspection UnnecessaryCastingInspection */ |
13289 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
13288 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
13290 | 13289 | } |
13291 | 13290 | |
13292 | 13291 | return self::decimal_to_chr($cp); |
@@ -13319,7 +13318,7 @@ discard block |
||
13319 | 13318 | public static function to_int(string $str) |
13320 | 13319 | { |
13321 | 13320 | if (\is_numeric($str)) { |
13322 | - return (int) $str; |
|
13321 | + return (int)$str; |
|
13323 | 13322 | } |
13324 | 13323 | |
13325 | 13324 | return null; |
@@ -13354,7 +13353,7 @@ discard block |
||
13354 | 13353 | || |
13355 | 13354 | $input_type === 'double' |
13356 | 13355 | ) { |
13357 | - return (string) $input; |
|
13356 | + return (string)$input; |
|
13358 | 13357 | } |
13359 | 13358 | |
13360 | 13359 | if ($input_type === 'object') { |
@@ -13364,7 +13363,7 @@ discard block |
||
13364 | 13363 | /** @noinspection NestedPositiveIfStatementsInspection */ |
13365 | 13364 | /** @noinspection MissingOrEmptyGroupStatementInspection */ |
13366 | 13365 | if (\method_exists($input, '__toString')) { |
13367 | - return (string) $input; |
|
13366 | + return (string)$input; |
|
13368 | 13367 | } |
13369 | 13368 | } |
13370 | 13369 | |
@@ -13405,7 +13404,7 @@ discard block |
||
13405 | 13404 | } |
13406 | 13405 | |
13407 | 13406 | /** @noinspection PhpComposerExtensionStubsInspection */ |
13408 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
13407 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
13409 | 13408 | } |
13410 | 13409 | |
13411 | 13410 | if ($chars !== null) { |
@@ -13456,15 +13455,15 @@ discard block |
||
13456 | 13455 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
13457 | 13456 | |
13458 | 13457 | if ($encoding === 'UTF-8') { |
13459 | - $str_part_two = (string) \mb_substr($str, 1); |
|
13458 | + $str_part_two = (string)\mb_substr($str, 1); |
|
13460 | 13459 | |
13461 | 13460 | if ($use_mb_functions) { |
13462 | 13461 | $str_part_one = \mb_strtoupper( |
13463 | - (string) \mb_substr($str, 0, 1) |
|
13462 | + (string)\mb_substr($str, 0, 1) |
|
13464 | 13463 | ); |
13465 | 13464 | } else { |
13466 | 13465 | $str_part_one = self::strtoupper( |
13467 | - (string) \mb_substr($str, 0, 1), |
|
13466 | + (string)\mb_substr($str, 0, 1), |
|
13468 | 13467 | $encoding, |
13469 | 13468 | false, |
13470 | 13469 | $lang, |
@@ -13474,16 +13473,16 @@ discard block |
||
13474 | 13473 | } else { |
13475 | 13474 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
13476 | 13475 | |
13477 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
13476 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
13478 | 13477 | |
13479 | 13478 | if ($use_mb_functions) { |
13480 | 13479 | $str_part_one = \mb_strtoupper( |
13481 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
13480 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
13482 | 13481 | $encoding |
13483 | 13482 | ); |
13484 | 13483 | } else { |
13485 | 13484 | $str_part_one = self::strtoupper( |
13486 | - (string) self::substr($str, 0, 1, $encoding), |
|
13485 | + (string)self::substr($str, 0, 1, $encoding), |
|
13487 | 13486 | $encoding, |
13488 | 13487 | false, |
13489 | 13488 | $lang, |
@@ -13492,7 +13491,7 @@ discard block |
||
13492 | 13491 | } |
13493 | 13492 | } |
13494 | 13493 | |
13495 | - return $str_part_one . $str_part_two; |
|
13494 | + return $str_part_one.$str_part_two; |
|
13496 | 13495 | } |
13497 | 13496 | |
13498 | 13497 | /** |
@@ -13553,7 +13552,7 @@ discard block |
||
13553 | 13552 | $str = self::clean($str); |
13554 | 13553 | } |
13555 | 13554 | |
13556 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
13555 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
13557 | 13556 | |
13558 | 13557 | if ( |
13559 | 13558 | $use_php_default_functions |
@@ -13954,7 +13953,7 @@ discard block |
||
13954 | 13953 | if ( |
13955 | 13954 | $keep_utf8_chars |
13956 | 13955 | && |
13957 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
13956 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
13958 | 13957 | ) { |
13959 | 13958 | return $str_backup; |
13960 | 13959 | } |
@@ -14045,17 +14044,17 @@ discard block |
||
14045 | 14044 | return ''; |
14046 | 14045 | } |
14047 | 14046 | |
14048 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
14047 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
14049 | 14048 | |
14050 | 14049 | if ( |
14051 | 14050 | !isset($matches[0]) |
14052 | 14051 | || |
14053 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
14052 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
14054 | 14053 | ) { |
14055 | 14054 | return $str; |
14056 | 14055 | } |
14057 | 14056 | |
14058 | - return \rtrim($matches[0]) . $str_add_on; |
|
14057 | + return \rtrim($matches[0]).$str_add_on; |
|
14059 | 14058 | } |
14060 | 14059 | |
14061 | 14060 | /** |
@@ -14150,7 +14149,7 @@ discard block |
||
14150 | 14149 | } |
14151 | 14150 | } |
14152 | 14151 | |
14153 | - return $str_return . \implode('', $charsArray); |
|
14152 | + return $str_return.\implode('', $charsArray); |
|
14154 | 14153 | } |
14155 | 14154 | |
14156 | 14155 | /** |
@@ -14204,7 +14203,7 @@ discard block |
||
14204 | 14203 | $final_break = ''; |
14205 | 14204 | } |
14206 | 14205 | |
14207 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
14206 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
14208 | 14207 | } |
14209 | 14208 | |
14210 | 14209 | /** |
@@ -14446,7 +14445,7 @@ discard block |
||
14446 | 14445 | /** @noinspection PhpIncludeInspection */ |
14447 | 14446 | /** @noinspection UsingInclusionReturnValueInspection */ |
14448 | 14447 | /** @psalm-suppress UnresolvableInclude */ |
14449 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
14448 | + return include __DIR__.'/data/'.$file.'.php'; |
|
14450 | 14449 | } |
14451 | 14450 | |
14452 | 14451 | /** |
@@ -14466,7 +14465,7 @@ discard block |
||
14466 | 14465 | */ |
14467 | 14466 | \uksort( |
14468 | 14467 | self::$EMOJI, |
14469 | - static function (string $a, string $b): int { |
|
14468 | + static function(string $a, string $b): int { |
|
14470 | 14469 | return \strlen($b) <=> \strlen($a); |
14471 | 14470 | } |
14472 | 14471 | ); |
@@ -14476,7 +14475,7 @@ discard block |
||
14476 | 14475 | |
14477 | 14476 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
14478 | 14477 | $tmp_key = \crc32($key); |
14479 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
14478 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
14480 | 14479 | } |
14481 | 14480 | |
14482 | 14481 | return true; |
@@ -14504,7 +14503,7 @@ discard block |
||
14504 | 14503 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
14505 | 14504 | return \defined('MB_OVERLOAD_STRING') |
14506 | 14505 | && |
14507 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
14506 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
14508 | 14507 | } |
14509 | 14508 | |
14510 | 14509 | /** |
@@ -14570,7 +14569,7 @@ discard block |
||
14570 | 14569 | */ |
14571 | 14570 | static $RX_CLASS_CACHE = []; |
14572 | 14571 | |
14573 | - $cache_key = $s . '_' . $class; |
|
14572 | + $cache_key = $s.'_'.$class; |
|
14574 | 14573 | |
14575 | 14574 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
14576 | 14575 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -14583,7 +14582,7 @@ discard block |
||
14583 | 14582 | /** @noinspection AlterInForeachInspection */ |
14584 | 14583 | foreach (self::str_split($s) as &$s) { |
14585 | 14584 | if ($s === '-') { |
14586 | - $class_array[0] = '-' . $class_array[0]; |
|
14585 | + $class_array[0] = '-'.$class_array[0]; |
|
14587 | 14586 | } elseif (!isset($s[2])) { |
14588 | 14587 | $class_array[0] .= \preg_quote($s, '/'); |
14589 | 14588 | } elseif (self::strlen($s) === 1) { |
@@ -14594,13 +14593,13 @@ discard block |
||
14594 | 14593 | } |
14595 | 14594 | |
14596 | 14595 | if ($class_array[0]) { |
14597 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
14596 | + $class_array[0] = '['.$class_array[0].']'; |
|
14598 | 14597 | } |
14599 | 14598 | |
14600 | 14599 | if (\count($class_array) === 1) { |
14601 | 14600 | $return = $class_array[0]; |
14602 | 14601 | } else { |
14603 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
14602 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
14604 | 14603 | } |
14605 | 14604 | |
14606 | 14605 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -14681,7 +14680,7 @@ discard block |
||
14681 | 14680 | |
14682 | 14681 | if ($delimiter === '-') { |
14683 | 14682 | /** @noinspection AlterInForeachInspection */ |
14684 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
14683 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
14685 | 14684 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
14686 | 14685 | $continue = true; |
14687 | 14686 | |
@@ -14691,7 +14690,7 @@ discard block |
||
14691 | 14690 | } |
14692 | 14691 | |
14693 | 14692 | /** @noinspection AlterInForeachInspection */ |
14694 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
14693 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
14695 | 14694 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
14696 | 14695 | $continue = true; |
14697 | 14696 | |
@@ -14767,8 +14766,8 @@ discard block |
||
14767 | 14766 | } else { |
14768 | 14767 | /** @noinspection OffsetOperationsInspection */ |
14769 | 14768 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
14770 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
14771 | - $buf .= $cc1 . $cc2; |
|
14769 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
14770 | + $buf .= $cc1.$cc2; |
|
14772 | 14771 | } |
14773 | 14772 | |
14774 | 14773 | return $buf; |
@@ -14791,7 +14790,7 @@ discard block |
||
14791 | 14790 | |
14792 | 14791 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
14793 | 14792 | if (\preg_match($pattern, $str)) { |
14794 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
14793 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
14795 | 14794 | } |
14796 | 14795 | |
14797 | 14796 | return $str; |