@@ -3,17 +3,17 @@ discard block |
||
| 3 | 3 | return [ |
| 4 | 4 | 0x80 => "\xe2\x82\xac", // € |
| 5 | 5 | 0x82 => "\xe2\x80\x9a", // ‚ |
| 6 | - 0x83 => "\xc6\x92", // ƒ |
|
| 6 | + 0x83 => "\xc6\x92", // ƒ |
|
| 7 | 7 | 0x84 => "\xe2\x80\x9e", // „ |
| 8 | 8 | 0x85 => "\xe2\x80\xa6", // … |
| 9 | 9 | 0x86 => "\xe2\x80\xa0", // † |
| 10 | 10 | 0x87 => "\xe2\x80\xa1", // ‡ |
| 11 | - 0x88 => "\xcb\x86", // ˆ |
|
| 11 | + 0x88 => "\xcb\x86", // ˆ |
|
| 12 | 12 | 0x89 => "\xe2\x80\xb0", // ‰ |
| 13 | - 0x8a => "\xc5\xa0", // Š |
|
| 13 | + 0x8a => "\xc5\xa0", // Š |
|
| 14 | 14 | 0x8b => "\xe2\x80\xb9", // ‹ |
| 15 | - 0x8c => "\xc5\x92", // Œ |
|
| 16 | - 0x8e => "\xc5\xbd", // Ž |
|
| 15 | + 0x8c => "\xc5\x92", // Œ |
|
| 16 | + 0x8e => "\xc5\xbd", // Ž |
|
| 17 | 17 | 0x91 => "\xe2\x80\x98", // ‘ |
| 18 | 18 | 0x92 => "\xe2\x80\x99", // ’ |
| 19 | 19 | 0x93 => "\xe2\x80\x9c", // “ |
@@ -21,106 +21,106 @@ discard block |
||
| 21 | 21 | 0x95 => "\xe2\x80\xa2", // • |
| 22 | 22 | 0x96 => "\xe2\x80\x93", // – |
| 23 | 23 | 0x97 => "\xe2\x80\x94", // — |
| 24 | - 0x98 => "\xcb\x9c", // ˜ |
|
| 24 | + 0x98 => "\xcb\x9c", // ˜ |
|
| 25 | 25 | 0x99 => "\xe2\x84\xa2", // ™ |
| 26 | - 0x9a => "\xc5\xa1", // š |
|
| 26 | + 0x9a => "\xc5\xa1", // š |
|
| 27 | 27 | 0x9b => "\xe2\x80\xba", // › |
| 28 | - 0x9c => "\xc5\x93", // œ |
|
| 29 | - 0x9e => "\xc5\xbe", // ž |
|
| 30 | - 0x9f => "\xc5\xb8", // Ÿ |
|
| 28 | + 0x9c => "\xc5\x93", // œ |
|
| 29 | + 0x9e => "\xc5\xbe", // ž |
|
| 30 | + 0x9f => "\xc5\xb8", // Ÿ |
|
| 31 | 31 | 0xa0 => "\xc2\xa0", |
| 32 | - 0xa1 => "\xc2\xa1", // ¡ |
|
| 33 | - 0xa2 => "\xc2\xa2", // ¢ |
|
| 34 | - 0xa3 => "\xc2\xa3", // £ |
|
| 35 | - 0xa4 => "\xc2\xa4", // ¤ |
|
| 36 | - 0xa5 => "\xc2\xa5", // ¥ |
|
| 37 | - 0xa6 => "\xc2\xa6", // ¦ |
|
| 38 | - 0xa7 => "\xc2\xa7", // § |
|
| 39 | - 0xa8 => "\xc2\xa8", // ¨ |
|
| 40 | - 0xa9 => "\xc2\xa9", // © |
|
| 41 | - 0xaa => "\xc2\xaa", // ª |
|
| 42 | - 0xab => "\xc2\xab", // « |
|
| 43 | - 0xac => "\xc2\xac", // ¬ |
|
| 44 | - 0xad => "\xc2\xad", // |
|
| 45 | - 0xae => "\xc2\xae", // ® |
|
| 46 | - 0xaf => "\xc2\xaf", // ¯ |
|
| 47 | - 0xb0 => "\xc2\xb0", // ° |
|
| 48 | - 0xb1 => "\xc2\xb1", // ± |
|
| 49 | - 0xb2 => "\xc2\xb2", // ² |
|
| 50 | - 0xb3 => "\xc2\xb3", // ³ |
|
| 51 | - 0xb4 => "\xc2\xb4", // ´ |
|
| 52 | - 0xb5 => "\xc2\xb5", // µ |
|
| 53 | - 0xb6 => "\xc2\xb6", // ¶ |
|
| 54 | - 0xb7 => "\xc2\xb7", // · |
|
| 55 | - 0xb8 => "\xc2\xb8", // ¸ |
|
| 56 | - 0xb9 => "\xc2\xb9", // ¹ |
|
| 57 | - 0xba => "\xc2\xba", // º |
|
| 58 | - 0xbb => "\xc2\xbb", // » |
|
| 59 | - 0xbc => "\xc2\xbc", // ¼ |
|
| 60 | - 0xbd => "\xc2\xbd", // ½ |
|
| 61 | - 0xbe => "\xc2\xbe", // ¾ |
|
| 62 | - 0xbf => "\xc2\xbf", // ¿ |
|
| 63 | - 0xc0 => "\xc3\x80", // À |
|
| 64 | - 0xc1 => "\xc3\x81", // Á |
|
| 65 | - 0xc2 => "\xc3\x82", // Â |
|
| 66 | - 0xc3 => "\xc3\x83", // Ã |
|
| 67 | - 0xc4 => "\xc3\x84", // Ä |
|
| 68 | - 0xc5 => "\xc3\x85", // Å |
|
| 69 | - 0xc6 => "\xc3\x86", // Æ |
|
| 70 | - 0xc7 => "\xc3\x87", // Ç |
|
| 71 | - 0xc8 => "\xc3\x88", // È |
|
| 72 | - 0xc9 => "\xc3\x89", // É |
|
| 73 | - 0xca => "\xc3\x8a", // Ê |
|
| 74 | - 0xcb => "\xc3\x8b", // Ë |
|
| 75 | - 0xcc => "\xc3\x8c", // Ì |
|
| 76 | - 0xcd => "\xc3\x8d", // Í |
|
| 77 | - 0xce => "\xc3\x8e", // Î |
|
| 78 | - 0xcf => "\xc3\x8f", // Ï |
|
| 79 | - 0xd0 => "\xc3\x90", // Ð |
|
| 80 | - 0xd1 => "\xc3\x91", // Ñ |
|
| 81 | - 0xd2 => "\xc3\x92", // Ò |
|
| 82 | - 0xd3 => "\xc3\x93", // Ó |
|
| 83 | - 0xd4 => "\xc3\x94", // Ô |
|
| 84 | - 0xd5 => "\xc3\x95", // Õ |
|
| 85 | - 0xd6 => "\xc3\x96", // Ö |
|
| 86 | - 0xd7 => "\xc3\x97", // × |
|
| 87 | - 0xd8 => "\xc3\x98", // Ø |
|
| 88 | - 0xd9 => "\xc3\x99", // Ù |
|
| 89 | - 0xda => "\xc3\x9a", // Ú |
|
| 90 | - 0xdb => "\xc3\x9b", // Û |
|
| 91 | - 0xdc => "\xc3\x9c", // Ü |
|
| 92 | - 0xdd => "\xc3\x9d", // Ý |
|
| 93 | - 0xde => "\xc3\x9e", // Þ |
|
| 94 | - 0xdf => "\xc3\x9f", // ß |
|
| 95 | - 0xe0 => "\xc3\xa0", // à |
|
| 96 | - 0xe1 => "\xa1", // á |
|
| 97 | - 0xe2 => "\xc3\xa2", // â |
|
| 98 | - 0xe3 => "\xc3\xa3", // ã |
|
| 99 | - 0xe4 => "\xc3\xa4", // ä |
|
| 100 | - 0xe5 => "\xc3\xa5", // å |
|
| 101 | - 0xe6 => "\xc3\xa6", // æ |
|
| 102 | - 0xe7 => "\xc3\xa7", // ç |
|
| 103 | - 0xe8 => "\xc3\xa8", // è |
|
| 104 | - 0xe9 => "\xc3\xa9", // é |
|
| 105 | - 0xea => "\xc3\xaa", // ê |
|
| 106 | - 0xeb => "\xc3\xab", // ë |
|
| 107 | - 0xec => "\xc3\xac", // ì |
|
| 108 | - 0xed => "\xc3\xad", // í |
|
| 109 | - 0xee => "\xc3\xae", // î |
|
| 110 | - 0xef => "\xc3\xaf", // ï |
|
| 111 | - 0xf0 => "\xc3\xb0", // ð |
|
| 112 | - 0xf1 => "\xc3\xb1", // ñ |
|
| 113 | - 0xf2 => "\xc3\xb2", // ò |
|
| 114 | - 0xf3 => "\xc3\xb3", // ó |
|
| 115 | - 0xf4 => "\xc3\xb4", // ô |
|
| 116 | - 0xf5 => "\xc3\xb5", // õ |
|
| 117 | - 0xf6 => "\xc3\xb6", // ö |
|
| 118 | - 0xf7 => "\xc3\xb7", // ÷ |
|
| 119 | - 0xf8 => "\xc3\xb8", // ø |
|
| 120 | - 0xf9 => "\xc3\xb9", // ù |
|
| 121 | - 0xfa => "\xc3\xba", // ú |
|
| 122 | - 0xfb => "\xc3\xbb", // û |
|
| 123 | - 0xfc => "\xc3\xbc", // ü |
|
| 124 | - 0xfd => "\xc3\xbd", // ý |
|
| 125 | - 0xfe => "\xc3\xbe", // þ |
|
| 32 | + 0xa1 => "\xc2\xa1", // ¡ |
|
| 33 | + 0xa2 => "\xc2\xa2", // ¢ |
|
| 34 | + 0xa3 => "\xc2\xa3", // £ |
|
| 35 | + 0xa4 => "\xc2\xa4", // ¤ |
|
| 36 | + 0xa5 => "\xc2\xa5", // ¥ |
|
| 37 | + 0xa6 => "\xc2\xa6", // ¦ |
|
| 38 | + 0xa7 => "\xc2\xa7", // § |
|
| 39 | + 0xa8 => "\xc2\xa8", // ¨ |
|
| 40 | + 0xa9 => "\xc2\xa9", // © |
|
| 41 | + 0xaa => "\xc2\xaa", // ª |
|
| 42 | + 0xab => "\xc2\xab", // « |
|
| 43 | + 0xac => "\xc2\xac", // ¬ |
|
| 44 | + 0xad => "\xc2\xad", // |
|
| 45 | + 0xae => "\xc2\xae", // ® |
|
| 46 | + 0xaf => "\xc2\xaf", // ¯ |
|
| 47 | + 0xb0 => "\xc2\xb0", // ° |
|
| 48 | + 0xb1 => "\xc2\xb1", // ± |
|
| 49 | + 0xb2 => "\xc2\xb2", // ² |
|
| 50 | + 0xb3 => "\xc2\xb3", // ³ |
|
| 51 | + 0xb4 => "\xc2\xb4", // ´ |
|
| 52 | + 0xb5 => "\xc2\xb5", // µ |
|
| 53 | + 0xb6 => "\xc2\xb6", // ¶ |
|
| 54 | + 0xb7 => "\xc2\xb7", // · |
|
| 55 | + 0xb8 => "\xc2\xb8", // ¸ |
|
| 56 | + 0xb9 => "\xc2\xb9", // ¹ |
|
| 57 | + 0xba => "\xc2\xba", // º |
|
| 58 | + 0xbb => "\xc2\xbb", // » |
|
| 59 | + 0xbc => "\xc2\xbc", // ¼ |
|
| 60 | + 0xbd => "\xc2\xbd", // ½ |
|
| 61 | + 0xbe => "\xc2\xbe", // ¾ |
|
| 62 | + 0xbf => "\xc2\xbf", // ¿ |
|
| 63 | + 0xc0 => "\xc3\x80", // À |
|
| 64 | + 0xc1 => "\xc3\x81", // Á |
|
| 65 | + 0xc2 => "\xc3\x82", // Â |
|
| 66 | + 0xc3 => "\xc3\x83", // Ã |
|
| 67 | + 0xc4 => "\xc3\x84", // Ä |
|
| 68 | + 0xc5 => "\xc3\x85", // Å |
|
| 69 | + 0xc6 => "\xc3\x86", // Æ |
|
| 70 | + 0xc7 => "\xc3\x87", // Ç |
|
| 71 | + 0xc8 => "\xc3\x88", // È |
|
| 72 | + 0xc9 => "\xc3\x89", // É |
|
| 73 | + 0xca => "\xc3\x8a", // Ê |
|
| 74 | + 0xcb => "\xc3\x8b", // Ë |
|
| 75 | + 0xcc => "\xc3\x8c", // Ì |
|
| 76 | + 0xcd => "\xc3\x8d", // Í |
|
| 77 | + 0xce => "\xc3\x8e", // Î |
|
| 78 | + 0xcf => "\xc3\x8f", // Ï |
|
| 79 | + 0xd0 => "\xc3\x90", // Ð |
|
| 80 | + 0xd1 => "\xc3\x91", // Ñ |
|
| 81 | + 0xd2 => "\xc3\x92", // Ò |
|
| 82 | + 0xd3 => "\xc3\x93", // Ó |
|
| 83 | + 0xd4 => "\xc3\x94", // Ô |
|
| 84 | + 0xd5 => "\xc3\x95", // Õ |
|
| 85 | + 0xd6 => "\xc3\x96", // Ö |
|
| 86 | + 0xd7 => "\xc3\x97", // × |
|
| 87 | + 0xd8 => "\xc3\x98", // Ø |
|
| 88 | + 0xd9 => "\xc3\x99", // Ù |
|
| 89 | + 0xda => "\xc3\x9a", // Ú |
|
| 90 | + 0xdb => "\xc3\x9b", // Û |
|
| 91 | + 0xdc => "\xc3\x9c", // Ü |
|
| 92 | + 0xdd => "\xc3\x9d", // Ý |
|
| 93 | + 0xde => "\xc3\x9e", // Þ |
|
| 94 | + 0xdf => "\xc3\x9f", // ß |
|
| 95 | + 0xe0 => "\xc3\xa0", // à |
|
| 96 | + 0xe1 => "\xa1", // á |
|
| 97 | + 0xe2 => "\xc3\xa2", // â |
|
| 98 | + 0xe3 => "\xc3\xa3", // ã |
|
| 99 | + 0xe4 => "\xc3\xa4", // ä |
|
| 100 | + 0xe5 => "\xc3\xa5", // å |
|
| 101 | + 0xe6 => "\xc3\xa6", // æ |
|
| 102 | + 0xe7 => "\xc3\xa7", // ç |
|
| 103 | + 0xe8 => "\xc3\xa8", // è |
|
| 104 | + 0xe9 => "\xc3\xa9", // é |
|
| 105 | + 0xea => "\xc3\xaa", // ê |
|
| 106 | + 0xeb => "\xc3\xab", // ë |
|
| 107 | + 0xec => "\xc3\xac", // ì |
|
| 108 | + 0xed => "\xc3\xad", // í |
|
| 109 | + 0xee => "\xc3\xae", // î |
|
| 110 | + 0xef => "\xc3\xaf", // ï |
|
| 111 | + 0xf0 => "\xc3\xb0", // ð |
|
| 112 | + 0xf1 => "\xc3\xb1", // ñ |
|
| 113 | + 0xf2 => "\xc3\xb2", // ò |
|
| 114 | + 0xf3 => "\xc3\xb3", // ó |
|
| 115 | + 0xf4 => "\xc3\xb4", // ô |
|
| 116 | + 0xf5 => "\xc3\xb5", // õ |
|
| 117 | + 0xf6 => "\xc3\xb6", // ö |
|
| 118 | + 0xf7 => "\xc3\xb7", // ÷ |
|
| 119 | + 0xf8 => "\xc3\xb8", // ø |
|
| 120 | + 0xf9 => "\xc3\xb9", // ù |
|
| 121 | + 0xfa => "\xc3\xba", // ú |
|
| 122 | + 0xfb => "\xc3\xbb", // û |
|
| 123 | + 0xfc => "\xc3\xbc", // ü |
|
| 124 | + 0xfd => "\xc3\xbd", // ý |
|
| 125 | + 0xfe => "\xc3\xbe", // þ |
|
| 126 | 126 | ]; |
@@ -541,22 +541,22 @@ discard block |
||
| 541 | 541 | * @psalm-suppress PossiblyNullArrayAccess |
| 542 | 542 | */ |
| 543 | 543 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
| 544 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 544 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 545 | 545 | } elseif ($code_point <= 0xFFFF) { |
| 546 | 546 | /** |
| 547 | 547 | * @psalm-suppress PossiblyNullArrayAccess |
| 548 | 548 | */ |
| 549 | 549 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
| 550 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 551 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 550 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 551 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 552 | 552 | } else { |
| 553 | 553 | /** |
| 554 | 554 | * @psalm-suppress PossiblyNullArrayAccess |
| 555 | 555 | */ |
| 556 | 556 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
| 557 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 558 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 559 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 557 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 558 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 559 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | if ($encoding !== 'UTF-8') { |
@@ -3133,10 +3133,10 @@ discard block |
||
| 3133 | 3133 | |
| 3134 | 3134 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 3135 | 3135 | return ( |
| 3136 | - \is_object($json) === true |
|
| 3136 | + \is_object($json) === true |
|
| 3137 | 3137 | || |
| 3138 | 3138 | \is_array($json) === true |
| 3139 | - ) |
|
| 3139 | + ) |
|
| 3140 | 3140 | && |
| 3141 | 3141 | \json_last_error() === \JSON_ERROR_NONE; |
| 3142 | 3142 | } |
@@ -5419,8 +5419,8 @@ discard block |
||
| 5419 | 5419 | } |
| 5420 | 5420 | |
| 5421 | 5421 | return (string) self::substr($str, 0, $index, $encoding) . |
| 5422 | - $substring . |
|
| 5423 | - (string) self::substr($str, $index, $len, $encoding); |
|
| 5422 | + $substring . |
|
| 5423 | + (string) self::substr($str, $index, $len, $encoding); |
|
| 5424 | 5424 | } |
| 5425 | 5425 | |
| 5426 | 5426 | /** |
@@ -9653,8 +9653,8 @@ discard block |
||
| 9653 | 9653 | |
| 9654 | 9654 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 9655 | 9655 | return (string) self::substr($str, 0, $offset, $encoding) . |
| 9656 | - $replacement . |
|
| 9657 | - (string) self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
| 9656 | + $replacement . |
|
| 9657 | + (string) self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
| 9658 | 9658 | } |
| 9659 | 9659 | |
| 9660 | 9660 | \preg_match_all('/./us', $str, $smatches); |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | return ''; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - return (string) self::substr($str, $pos, 1); |
|
| 246 | + return (string)self::substr($str, $pos, 1); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | public static function add_bom_to_string(string $str): string |
| 259 | 259 | { |
| 260 | 260 | if (self::string_has_bom($str) === false) { |
| 261 | - $str = self::bom() . $str; |
|
| 261 | + $str = self::bom().$str; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | return $str; |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | return ''; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - $substrIndex = $posStart + (int) self::strlen($start, $encoding); |
|
| 318 | + $substrIndex = $posStart + (int)self::strlen($start, $encoding); |
|
| 319 | 319 | $posEnd = self::strpos($str, $end, $substrIndex, $encoding); |
| 320 | 320 | if ( |
| 321 | 321 | $posEnd === false |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | return ''; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - return (string) self::substr($str, $substrIndex, $posEnd - $substrIndex, $encoding); |
|
| 328 | + return (string)self::substr($str, $substrIndex, $posEnd - $substrIndex, $encoding); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | */ |
| 388 | 388 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
| 389 | 389 | { |
| 390 | - return (string) self::substr($str, $index, 1, $encoding); |
|
| 390 | + return (string)self::substr($str, $index, 1, $encoding); |
|
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | /** |
@@ -483,10 +483,10 @@ discard block |
||
| 483 | 483 | && |
| 484 | 484 | self::$SUPPORT['mbstring'] === false |
| 485 | 485 | ) { |
| 486 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 486 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | - $cacheKey = $code_point . $encoding; |
|
| 489 | + $cacheKey = $code_point.$encoding; |
|
| 490 | 490 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 491 | 491 | return $CHAR_CACHE[$cacheKey]; |
| 492 | 492 | } |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | if (self::$CHR === null) { |
| 497 | 497 | $chrTmp = self::getData('chr'); |
| 498 | 498 | if ($chrTmp) { |
| 499 | - self::$CHR = (array) $chrTmp; |
|
| 499 | + self::$CHR = (array)$chrTmp; |
|
| 500 | 500 | } |
| 501 | 501 | } |
| 502 | 502 | |
@@ -526,11 +526,11 @@ discard block |
||
| 526 | 526 | if (self::$CHR === null) { |
| 527 | 527 | $chrTmp = self::getData('chr'); |
| 528 | 528 | if ($chrTmp) { |
| 529 | - self::$CHR = (array) $chrTmp; |
|
| 529 | + self::$CHR = (array)$chrTmp; |
|
| 530 | 530 | } |
| 531 | 531 | } |
| 532 | 532 | |
| 533 | - $code_point = (int) $code_point; |
|
| 533 | + $code_point = (int)$code_point; |
|
| 534 | 534 | if ($code_point <= 0x7F) { |
| 535 | 535 | /** |
| 536 | 536 | * @psalm-suppress PossiblyNullArrayAccess |
@@ -540,22 +540,22 @@ discard block |
||
| 540 | 540 | /** |
| 541 | 541 | * @psalm-suppress PossiblyNullArrayAccess |
| 542 | 542 | */ |
| 543 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
| 543 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
| 544 | 544 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 545 | 545 | } elseif ($code_point <= 0xFFFF) { |
| 546 | 546 | /** |
| 547 | 547 | * @psalm-suppress PossiblyNullArrayAccess |
| 548 | 548 | */ |
| 549 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
| 550 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 549 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
| 550 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 551 | 551 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 552 | 552 | } else { |
| 553 | 553 | /** |
| 554 | 554 | * @psalm-suppress PossiblyNullArrayAccess |
| 555 | 555 | */ |
| 556 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
| 557 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
| 558 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
| 556 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
| 557 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
| 558 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
| 559 | 559 | self::$CHR[($code_point & 0x3F) + 0x80]; |
| 560 | 560 | } |
| 561 | 561 | |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | |
| 608 | 608 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
| 609 | 609 | return \array_map( |
| 610 | - static function (string $data): int { |
|
| 610 | + static function(string $data): int { |
|
| 611 | 611 | return self::strlen_in_byte($data); |
| 612 | 612 | }, |
| 613 | 613 | $strSplit |
@@ -674,7 +674,7 @@ discard block |
||
| 674 | 674 | $char = ''; |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | - return self::int_to_hex(self::ord((string) $char), $pfix); |
|
| 677 | + return self::int_to_hex(self::ord((string)$char), $pfix); |
|
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | /** |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | | ( [\x80-\xBF] ) # invalid byte in range 10000000 - 10111111 |
| 749 | 749 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
| 750 | 750 | /x'; |
| 751 | - $str = (string) \preg_replace($regx, '$1', $str); |
|
| 751 | + $str = (string)\preg_replace($regx, '$1', $str); |
|
| 752 | 752 | |
| 753 | 753 | if ($replace_diamond_question_mark === true) { |
| 754 | 754 | $str = self::replace_diamond_question_mark($str, ''); |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | public static function cleanup($str): string |
| 784 | 784 | { |
| 785 | 785 | // init |
| 786 | - $str = (string) $str; |
|
| 786 | + $str = (string)$str; |
|
| 787 | 787 | |
| 788 | 788 | if ($str === '') { |
| 789 | 789 | return ''; |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | */ |
| 893 | 893 | public static function css_stripe_media_queries(string $str): string |
| 894 | 894 | { |
| 895 | - return (string) \preg_replace( |
|
| 895 | + return (string)\preg_replace( |
|
| 896 | 896 | '#@media\\s+(?:only\\s)?(?:[\\s{\\(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#misU', |
| 897 | 897 | '', |
| 898 | 898 | $str |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | */ |
| 920 | 920 | public static function decimal_to_chr($int): string |
| 921 | 921 | { |
| 922 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
| 922 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | /** |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | if ($toEncoding === 'JSON') { |
| 997 | 997 | $return = self::json_encode($str); |
| 998 | 998 | if ($return === false) { |
| 999 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
| 999 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | 1002 | return $return; |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | && |
| 1083 | 1083 | self::$SUPPORT['mbstring'] === false |
| 1084 | 1084 | ) { |
| 1085 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $toEncoding . '" encoding', \E_USER_WARNING); |
|
| 1085 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$toEncoding.'" encoding', \E_USER_WARNING); |
|
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -1171,18 +1171,18 @@ discard block |
||
| 1171 | 1171 | $trimChars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
| 1172 | 1172 | |
| 1173 | 1173 | if ($length === null) { |
| 1174 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2, 0); |
|
| 1174 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2, 0); |
|
| 1175 | 1175 | } |
| 1176 | 1176 | |
| 1177 | 1177 | if (empty($search)) { |
| 1178 | 1178 | if ($length > 0) { |
| 1179 | - $stringLength = (int) self::strlen($str, $encoding); |
|
| 1179 | + $stringLength = (int)self::strlen($str, $encoding); |
|
| 1180 | 1180 | $end = ($length - 1) > $stringLength ? $stringLength : ($length - 1); |
| 1181 | 1181 | } else { |
| 1182 | 1182 | $end = 0; |
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | - $pos = (int) \min( |
|
| 1185 | + $pos = (int)\min( |
|
| 1186 | 1186 | self::strpos($str, ' ', $end, $encoding), |
| 1187 | 1187 | self::strpos($str, '.', $end, $encoding) |
| 1188 | 1188 | ); |
@@ -1193,20 +1193,20 @@ discard block |
||
| 1193 | 1193 | return ''; |
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | - return \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1196 | + return \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | return $str; |
| 1200 | 1200 | } |
| 1201 | 1201 | |
| 1202 | - $wordPos = (int) self::stripos($str, $search, 0, $encoding); |
|
| 1203 | - $halfSide = (int) ($wordPos - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
| 1202 | + $wordPos = (int)self::stripos($str, $search, 0, $encoding); |
|
| 1203 | + $halfSide = (int)($wordPos - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
| 1204 | 1204 | |
| 1205 | 1205 | $pos_start = 0; |
| 1206 | 1206 | if ($halfSide > 0) { |
| 1207 | 1207 | $halfText = self::substr($str, 0, $halfSide, $encoding); |
| 1208 | 1208 | if ($halfText !== false) { |
| 1209 | - $pos_start = (int) \max( |
|
| 1209 | + $pos_start = (int)\max( |
|
| 1210 | 1210 | self::strrpos($halfText, ' ', 0, $encoding), |
| 1211 | 1211 | self::strrpos($halfText, '.', 0, $encoding) |
| 1212 | 1212 | ); |
@@ -1215,35 +1215,35 @@ discard block |
||
| 1215 | 1215 | |
| 1216 | 1216 | if ($wordPos && $halfSide > 0) { |
| 1217 | 1217 | $offset = $pos_start + $length - 1; |
| 1218 | - $realLength = (int) self::strlen($str, $encoding); |
|
| 1218 | + $realLength = (int)self::strlen($str, $encoding); |
|
| 1219 | 1219 | |
| 1220 | 1220 | if ($offset > $realLength) { |
| 1221 | 1221 | $offset = $realLength; |
| 1222 | 1222 | } |
| 1223 | 1223 | |
| 1224 | - $pos_end = (int) \min( |
|
| 1224 | + $pos_end = (int)\min( |
|
| 1225 | 1225 | self::strpos($str, ' ', $offset, $encoding), |
| 1226 | 1226 | self::strpos($str, '.', $offset, $encoding) |
| 1227 | 1227 | ) - $pos_start; |
| 1228 | 1228 | |
| 1229 | 1229 | if (!$pos_end || $pos_end <= 0) { |
| 1230 | - $strSub = self::substr($str, $pos_start, (int) self::strlen($str), $encoding); |
|
| 1230 | + $strSub = self::substr($str, $pos_start, (int)self::strlen($str), $encoding); |
|
| 1231 | 1231 | if ($strSub !== false) { |
| 1232 | - $extract = $replacerForSkippedText . \ltrim($strSub, $trimChars); |
|
| 1232 | + $extract = $replacerForSkippedText.\ltrim($strSub, $trimChars); |
|
| 1233 | 1233 | } else { |
| 1234 | 1234 | $extract = ''; |
| 1235 | 1235 | } |
| 1236 | 1236 | } else { |
| 1237 | 1237 | $strSub = self::substr($str, $pos_start, $pos_end, $encoding); |
| 1238 | 1238 | if ($strSub !== false) { |
| 1239 | - $extract = $replacerForSkippedText . \trim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1239 | + $extract = $replacerForSkippedText.\trim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1240 | 1240 | } else { |
| 1241 | 1241 | $extract = ''; |
| 1242 | 1242 | } |
| 1243 | 1243 | } |
| 1244 | 1244 | } else { |
| 1245 | 1245 | $offset = $length - 1; |
| 1246 | - $trueLength = (int) self::strlen($str, $encoding); |
|
| 1246 | + $trueLength = (int)self::strlen($str, $encoding); |
|
| 1247 | 1247 | |
| 1248 | 1248 | if ($offset > $trueLength) { |
| 1249 | 1249 | $offset = $trueLength; |
@@ -1257,7 +1257,7 @@ discard block |
||
| 1257 | 1257 | if ($pos_end) { |
| 1258 | 1258 | $strSub = self::substr($str, 0, $pos_end, $encoding); |
| 1259 | 1259 | if ($strSub !== false) { |
| 1260 | - $extract = \rtrim($strSub, $trimChars) . $replacerForSkippedText; |
|
| 1260 | + $extract = \rtrim($strSub, $trimChars).$replacerForSkippedText; |
|
| 1261 | 1261 | } else { |
| 1262 | 1262 | $extract = ''; |
| 1263 | 1263 | } |
@@ -1377,7 +1377,7 @@ discard block |
||
| 1377 | 1377 | { |
| 1378 | 1378 | $file_content = \file_get_contents($file_path); |
| 1379 | 1379 | if ($file_content === false) { |
| 1380 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
| 1380 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
| 1381 | 1381 | } |
| 1382 | 1382 | |
| 1383 | 1383 | return self::string_has_bom($file_content); |
@@ -1440,7 +1440,7 @@ discard block |
||
| 1440 | 1440 | ) { |
| 1441 | 1441 | // Prevent leading combining chars |
| 1442 | 1442 | // for NFC-safe concatenations. |
| 1443 | - $var = $leading_combining . $var; |
|
| 1443 | + $var = $leading_combining.$var; |
|
| 1444 | 1444 | } |
| 1445 | 1445 | } |
| 1446 | 1446 | |
@@ -1674,7 +1674,7 @@ discard block |
||
| 1674 | 1674 | return ''; |
| 1675 | 1675 | } |
| 1676 | 1676 | |
| 1677 | - return (string) self::substr($str, 0, $n, $encoding); |
|
| 1677 | + return (string)self::substr($str, 0, $n, $encoding); |
|
| 1678 | 1678 | } |
| 1679 | 1679 | |
| 1680 | 1680 | /** |
@@ -1749,7 +1749,7 @@ discard block |
||
| 1749 | 1749 | return $str; |
| 1750 | 1750 | } |
| 1751 | 1751 | |
| 1752 | - $str = (string) $str; |
|
| 1752 | + $str = (string)$str; |
|
| 1753 | 1753 | $last = ''; |
| 1754 | 1754 | while ($last !== $str) { |
| 1755 | 1755 | $last = $str; |
@@ -1940,7 +1940,7 @@ discard block |
||
| 1940 | 1940 | } |
| 1941 | 1941 | |
| 1942 | 1942 | $str_info = \unpack('C2chars', $str_info); |
| 1943 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
| 1943 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
| 1944 | 1944 | |
| 1945 | 1945 | // DEBUG |
| 1946 | 1946 | //var_dump($type_code); |
@@ -2023,7 +2023,7 @@ discard block |
||
| 2023 | 2023 | // init |
| 2024 | 2024 | $i = 0; |
| 2025 | 2025 | $str = ''; |
| 2026 | - $maxlength = (int) self::strlen($possibleChars, $encoding); |
|
| 2026 | + $maxlength = (int)self::strlen($possibleChars, $encoding); |
|
| 2027 | 2027 | |
| 2028 | 2028 | if ($maxlength === 0) { |
| 2029 | 2029 | return ''; |
@@ -2055,16 +2055,16 @@ discard block |
||
| 2055 | 2055 | */ |
| 2056 | 2056 | public static function get_unique_string($entropyExtra = '', bool $md5 = true): string |
| 2057 | 2057 | { |
| 2058 | - $uniqueHelper = \random_int(0, \mt_getrandmax()) . |
|
| 2059 | - \session_id() . |
|
| 2060 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
| 2061 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
| 2058 | + $uniqueHelper = \random_int(0, \mt_getrandmax()). |
|
| 2059 | + \session_id(). |
|
| 2060 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
| 2061 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
| 2062 | 2062 | $entropyExtra; |
| 2063 | 2063 | |
| 2064 | 2064 | $uniqueString = \uniqid($uniqueHelper, true); |
| 2065 | 2065 | |
| 2066 | 2066 | if ($md5) { |
| 2067 | - $uniqueString = \md5($uniqueString . $uniqueHelper); |
|
| 2067 | + $uniqueString = \md5($uniqueString.$uniqueHelper); |
|
| 2068 | 2068 | } |
| 2069 | 2069 | |
| 2070 | 2070 | return $uniqueString; |
@@ -2134,7 +2134,7 @@ discard block |
||
| 2134 | 2134 | public static function hex_to_int($hexDec) |
| 2135 | 2135 | { |
| 2136 | 2136 | // init |
| 2137 | - $hexDec = (string) $hexDec; |
|
| 2137 | + $hexDec = (string)$hexDec; |
|
| 2138 | 2138 | |
| 2139 | 2139 | if ($hexDec === '') { |
| 2140 | 2140 | return false; |
@@ -2209,7 +2209,7 @@ discard block |
||
| 2209 | 2209 | return \implode( |
| 2210 | 2210 | '', |
| 2211 | 2211 | \array_map( |
| 2212 | - static function (string $chr) use ($keepAsciiChars, $encoding): string { |
|
| 2212 | + static function(string $chr) use ($keepAsciiChars, $encoding): string { |
|
| 2213 | 2213 | return self::single_chr_html_encode($chr, $keepAsciiChars, $encoding); |
| 2214 | 2214 | }, |
| 2215 | 2215 | self::split($str) |
@@ -2325,7 +2325,7 @@ discard block |
||
| 2325 | 2325 | && |
| 2326 | 2326 | self::$SUPPORT['mbstring'] === false |
| 2327 | 2327 | ) { |
| 2328 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 2328 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 2329 | 2329 | } |
| 2330 | 2330 | |
| 2331 | 2331 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -2343,14 +2343,14 @@ discard block |
||
| 2343 | 2343 | $encoding |
| 2344 | 2344 | ); |
| 2345 | 2345 | } else { |
| 2346 | - $str = (string) \preg_replace_callback( |
|
| 2346 | + $str = (string)\preg_replace_callback( |
|
| 2347 | 2347 | "/&#\d{2,6};/", |
| 2348 | 2348 | /** |
| 2349 | 2349 | * @param string[] $matches |
| 2350 | 2350 | * |
| 2351 | 2351 | * @return string |
| 2352 | 2352 | */ |
| 2353 | - static function (array $matches) use ($encoding): string { |
|
| 2353 | + static function(array $matches) use ($encoding): string { |
|
| 2354 | 2354 | // always fallback via symfony polyfill |
| 2355 | 2355 | $returnTmp = \mb_convert_encoding($matches[0], $encoding, 'HTML-ENTITIES'); |
| 2356 | 2356 | |
@@ -2366,7 +2366,7 @@ discard block |
||
| 2366 | 2366 | |
| 2367 | 2367 | // decode numeric & UTF16 two byte entities |
| 2368 | 2368 | $str = \html_entity_decode( |
| 2369 | - (string) \preg_replace('/(&#(?:x0*[0-9a-f]{2,6}(?![0-9a-f;])|(?:0*\d{2,6}(?![0-9;]))))/iS', '$1;', $str), |
|
| 2369 | + (string)\preg_replace('/(&#(?:x0*[0-9a-f]{2,6}(?![0-9a-f;])|(?:0*\d{2,6}(?![0-9;]))))/iS', '$1;', $str), |
|
| 2370 | 2370 | $flags, |
| 2371 | 2371 | $encoding |
| 2372 | 2372 | ); |
@@ -2403,7 +2403,7 @@ discard block |
||
| 2403 | 2403 | */ |
| 2404 | 2404 | public static function html_stripe_empty_tags(string $str): string |
| 2405 | 2405 | { |
| 2406 | - return (string) \preg_replace( |
|
| 2406 | + return (string)\preg_replace( |
|
| 2407 | 2407 | "/<[^\/>]*>(([\s]?)*|)<\/[^>]*>/iu", |
| 2408 | 2408 | '', |
| 2409 | 2409 | $str |
@@ -2692,9 +2692,9 @@ discard block |
||
| 2692 | 2692 | { |
| 2693 | 2693 | $hex = \dechex($int); |
| 2694 | 2694 | |
| 2695 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
| 2695 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
| 2696 | 2696 | |
| 2697 | - return $pfix . $hex . ''; |
|
| 2697 | + return $pfix.$hex.''; |
|
| 2698 | 2698 | } |
| 2699 | 2699 | |
| 2700 | 2700 | /** |
@@ -2951,7 +2951,7 @@ discard block |
||
| 2951 | 2951 | */ |
| 2952 | 2952 | public static function is_binary($input, bool $strict = false): bool |
| 2953 | 2953 | { |
| 2954 | - $input = (string) $input; |
|
| 2954 | + $input = (string)$input; |
|
| 2955 | 2955 | if ($input === '') { |
| 2956 | 2956 | return false; |
| 2957 | 2957 | } |
@@ -3200,7 +3200,7 @@ discard block |
||
| 3200 | 3200 | public static function is_utf16($str, $checkIfStringIsBinary = true) |
| 3201 | 3201 | { |
| 3202 | 3202 | // init |
| 3203 | - $str = (string) $str; |
|
| 3203 | + $str = (string)$str; |
|
| 3204 | 3204 | $strChars = []; |
| 3205 | 3205 | |
| 3206 | 3206 | if ( |
@@ -3278,7 +3278,7 @@ discard block |
||
| 3278 | 3278 | public static function is_utf32($str, $checkIfStringIsBinary = true) |
| 3279 | 3279 | { |
| 3280 | 3280 | // init |
| 3281 | - $str = (string) $str; |
|
| 3281 | + $str = (string)$str; |
|
| 3282 | 3282 | $strChars = []; |
| 3283 | 3283 | |
| 3284 | 3284 | if ( |
@@ -3402,7 +3402,7 @@ discard block |
||
| 3402 | 3402 | self::$ORD = self::getData('ord'); |
| 3403 | 3403 | } |
| 3404 | 3404 | |
| 3405 | - $len = self::strlen_in_byte((string) $str); |
|
| 3405 | + $len = self::strlen_in_byte((string)$str); |
|
| 3406 | 3406 | /** @noinspection ForeachInvariantsInspection */ |
| 3407 | 3407 | for ($i = 0; $i < $len; ++$i) { |
| 3408 | 3408 | $in = self::$ORD[$str[$i]]; |
@@ -3631,17 +3631,17 @@ discard block |
||
| 3631 | 3631 | */ |
| 3632 | 3632 | public static function lcfirst(string $str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
| 3633 | 3633 | { |
| 3634 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding, $cleanUtf8); |
|
| 3634 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding, $cleanUtf8); |
|
| 3635 | 3635 | |
| 3636 | 3636 | $strPartOne = self::strtolower( |
| 3637 | - (string) self::substr($str, 0, 1, $encoding, $cleanUtf8), |
|
| 3637 | + (string)self::substr($str, 0, 1, $encoding, $cleanUtf8), |
|
| 3638 | 3638 | $encoding, |
| 3639 | 3639 | $cleanUtf8, |
| 3640 | 3640 | $lang, |
| 3641 | 3641 | $tryToKeepStringLength |
| 3642 | 3642 | ); |
| 3643 | 3643 | |
| 3644 | - return $strPartOne . $strPartTwo; |
|
| 3644 | + return $strPartOne.$strPartTwo; |
|
| 3645 | 3645 | } |
| 3646 | 3646 | |
| 3647 | 3647 | /** |
@@ -3797,7 +3797,7 @@ discard block |
||
| 3797 | 3797 | { |
| 3798 | 3798 | $bytes = self::chr_size_list($str); |
| 3799 | 3799 | if (\count($bytes) > 0) { |
| 3800 | - return (int) \max($bytes); |
|
| 3800 | + return (int)\max($bytes); |
|
| 3801 | 3801 | } |
| 3802 | 3802 | |
| 3803 | 3803 | return 0; |
@@ -3872,7 +3872,7 @@ discard block |
||
| 3872 | 3872 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
| 3873 | 3873 | |
| 3874 | 3874 | // init |
| 3875 | - $encoding = (string) $encoding; |
|
| 3875 | + $encoding = (string)$encoding; |
|
| 3876 | 3876 | |
| 3877 | 3877 | if ( |
| 3878 | 3878 | !$encoding |
@@ -3924,7 +3924,7 @@ discard block |
||
| 3924 | 3924 | |
| 3925 | 3925 | $encodingOrig = $encoding; |
| 3926 | 3926 | $encoding = \strtoupper($encoding); |
| 3927 | - $encodingUpperHelper = (string) \preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
| 3927 | + $encodingUpperHelper = (string)\preg_replace('/[^a-zA-Z0-9\s]/', '', $encoding); |
|
| 3928 | 3928 | |
| 3929 | 3929 | $equivalences = [ |
| 3930 | 3930 | 'ISO8859' => 'ISO-8859-1', |
@@ -4010,7 +4010,7 @@ discard block |
||
| 4010 | 4010 | */ |
| 4011 | 4011 | public static function normalize_line_ending(string $str): string |
| 4012 | 4012 | { |
| 4013 | - return (string) \str_replace(["\r\n", "\r"], "\n", $str); |
|
| 4013 | + return (string)\str_replace(["\r\n", "\r"], "\n", $str); |
|
| 4014 | 4014 | } |
| 4015 | 4015 | |
| 4016 | 4016 | /** |
@@ -4058,7 +4058,7 @@ discard block |
||
| 4058 | 4058 | } |
| 4059 | 4059 | |
| 4060 | 4060 | static $WHITESPACE_CACHE = []; |
| 4061 | - $cacheKey = (int) $keepNonBreakingSpace; |
|
| 4061 | + $cacheKey = (int)$keepNonBreakingSpace; |
|
| 4062 | 4062 | |
| 4063 | 4063 | if (!isset($WHITESPACE_CACHE[$cacheKey])) { |
| 4064 | 4064 | $WHITESPACE_CACHE[$cacheKey] = self::$WHITESPACE_TABLE; |
@@ -4098,7 +4098,7 @@ discard block |
||
| 4098 | 4098 | public static function ord($chr, string $encoding = 'UTF-8'): int |
| 4099 | 4099 | { |
| 4100 | 4100 | // init |
| 4101 | - $chr = (string) $chr; |
|
| 4101 | + $chr = (string)$chr; |
|
| 4102 | 4102 | |
| 4103 | 4103 | static $CHAR_CACHE = []; |
| 4104 | 4104 | |
@@ -4109,7 +4109,7 @@ discard block |
||
| 4109 | 4109 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4110 | 4110 | } |
| 4111 | 4111 | |
| 4112 | - $cacheKey = $chr_orig . $encoding; |
|
| 4112 | + $cacheKey = $chr_orig.$encoding; |
|
| 4113 | 4113 | if (isset($CHAR_CACHE[$cacheKey]) === true) { |
| 4114 | 4114 | return $CHAR_CACHE[$cacheKey]; |
| 4115 | 4115 | } |
@@ -4140,22 +4140,22 @@ discard block |
||
| 4140 | 4140 | } |
| 4141 | 4141 | |
| 4142 | 4142 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
| 4143 | - $chr = \unpack('C*', (string) self::substr($chr, 0, 4, 'CP850')); |
|
| 4143 | + $chr = \unpack('C*', (string)self::substr($chr, 0, 4, 'CP850')); |
|
| 4144 | 4144 | $code = $chr ? $chr[1] : 0; |
| 4145 | 4145 | |
| 4146 | 4146 | if ($code >= 0xF0 && isset($chr[4])) { |
| 4147 | 4147 | /** @noinspection UnnecessaryCastingInspection */ |
| 4148 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4148 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
| 4149 | 4149 | } |
| 4150 | 4150 | |
| 4151 | 4151 | if ($code >= 0xE0 && isset($chr[3])) { |
| 4152 | 4152 | /** @noinspection UnnecessaryCastingInspection */ |
| 4153 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4153 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
| 4154 | 4154 | } |
| 4155 | 4155 | |
| 4156 | 4156 | if ($code >= 0xC0 && isset($chr[2])) { |
| 4157 | 4157 | /** @noinspection UnnecessaryCastingInspection */ |
| 4158 | - return $CHAR_CACHE[$cacheKey] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4158 | + return $CHAR_CACHE[$cacheKey] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
| 4159 | 4159 | } |
| 4160 | 4160 | |
| 4161 | 4161 | return $CHAR_CACHE[$cacheKey] = $code; |
@@ -4208,7 +4208,7 @@ discard block |
||
| 4208 | 4208 | public static function pcre_utf8_support(): bool |
| 4209 | 4209 | { |
| 4210 | 4210 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 4211 | - return (bool) @\preg_match('//u', ''); |
|
| 4211 | + return (bool)@\preg_match('//u', ''); |
|
| 4212 | 4212 | } |
| 4213 | 4213 | |
| 4214 | 4214 | /** |
@@ -4234,10 +4234,10 @@ discard block |
||
| 4234 | 4234 | } |
| 4235 | 4235 | |
| 4236 | 4236 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4237 | - if (\ctype_digit((string) $var1)) { |
|
| 4238 | - $start = (int) $var1; |
|
| 4237 | + if (\ctype_digit((string)$var1)) { |
|
| 4238 | + $start = (int)$var1; |
|
| 4239 | 4239 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var1)) { |
| 4240 | - $start = (int) self::hex_to_int($var1); |
|
| 4240 | + $start = (int)self::hex_to_int($var1); |
|
| 4241 | 4241 | } else { |
| 4242 | 4242 | $start = self::ord($var1); |
| 4243 | 4243 | } |
@@ -4247,10 +4247,10 @@ discard block |
||
| 4247 | 4247 | } |
| 4248 | 4248 | |
| 4249 | 4249 | /** @noinspection PhpComposerExtensionStubsInspection */ |
| 4250 | - if (\ctype_digit((string) $var2)) { |
|
| 4251 | - $end = (int) $var2; |
|
| 4250 | + if (\ctype_digit((string)$var2)) { |
|
| 4251 | + $end = (int)$var2; |
|
| 4252 | 4252 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif (\ctype_xdigit($var2)) { |
| 4253 | - $end = (int) self::hex_to_int($var2); |
|
| 4253 | + $end = (int)self::hex_to_int($var2); |
|
| 4254 | 4254 | } else { |
| 4255 | 4255 | $end = self::ord($var2); |
| 4256 | 4256 | } |
@@ -4260,8 +4260,8 @@ discard block |
||
| 4260 | 4260 | } |
| 4261 | 4261 | |
| 4262 | 4262 | return \array_map( |
| 4263 | - static function (int $i): string { |
|
| 4264 | - return (string) self::chr($i); |
|
| 4263 | + static function(int $i): string { |
|
| 4264 | + return (string)self::chr($i); |
|
| 4265 | 4265 | }, |
| 4266 | 4266 | \range($start, $end) |
| 4267 | 4267 | ); |
@@ -4294,7 +4294,7 @@ discard block |
||
| 4294 | 4294 | |
| 4295 | 4295 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
| 4296 | 4296 | if (\preg_match($pattern, $str)) { |
| 4297 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
| 4297 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \rawurldecode($str)); |
|
| 4298 | 4298 | } |
| 4299 | 4299 | |
| 4300 | 4300 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -4342,8 +4342,8 @@ discard block |
||
| 4342 | 4342 | $delimiter = '/'; |
| 4343 | 4343 | } |
| 4344 | 4344 | |
| 4345 | - return (string) \preg_replace( |
|
| 4346 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
| 4345 | + return (string)\preg_replace( |
|
| 4346 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
| 4347 | 4347 | $replacement, |
| 4348 | 4348 | $str |
| 4349 | 4349 | ); |
@@ -4386,9 +4386,9 @@ discard block |
||
| 4386 | 4386 | return ''; |
| 4387 | 4387 | } |
| 4388 | 4388 | |
| 4389 | - $strLength -= (int) $bomByteLength; |
|
| 4389 | + $strLength -= (int)$bomByteLength; |
|
| 4390 | 4390 | |
| 4391 | - $str = (string) $strTmp; |
|
| 4391 | + $str = (string)$strTmp; |
|
| 4392 | 4392 | } |
| 4393 | 4393 | } |
| 4394 | 4394 | |
@@ -4412,7 +4412,7 @@ discard block |
||
| 4412 | 4412 | if (\is_array($what) === true) { |
| 4413 | 4413 | /** @noinspection ForeachSourceInspection */ |
| 4414 | 4414 | foreach ($what as $item) { |
| 4415 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/', $item, $str); |
|
| 4415 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/', $item, $str); |
|
| 4416 | 4416 | } |
| 4417 | 4417 | } |
| 4418 | 4418 | |
@@ -4444,7 +4444,7 @@ discard block |
||
| 4444 | 4444 | */ |
| 4445 | 4445 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
| 4446 | 4446 | { |
| 4447 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 4447 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
| 4448 | 4448 | } |
| 4449 | 4449 | |
| 4450 | 4450 | /** |
@@ -4475,7 +4475,7 @@ discard block |
||
| 4475 | 4475 | $non_displayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
| 4476 | 4476 | |
| 4477 | 4477 | do { |
| 4478 | - $str = (string) \preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
| 4478 | + $str = (string)\preg_replace($non_displayables, $replacement, $str, -1, $count); |
|
| 4479 | 4479 | } while ($count !== 0); |
| 4480 | 4480 | |
| 4481 | 4481 | return $str; |
@@ -4493,9 +4493,9 @@ discard block |
||
| 4493 | 4493 | public static function remove_left(string $str, string $substring, string $encoding = 'UTF-8'): string |
| 4494 | 4494 | { |
| 4495 | 4495 | if (self::str_starts_with($str, $substring)) { |
| 4496 | - return (string) self::substr( |
|
| 4496 | + return (string)self::substr( |
|
| 4497 | 4497 | $str, |
| 4498 | - (int) self::strlen($substring, $encoding), |
|
| 4498 | + (int)self::strlen($substring, $encoding), |
|
| 4499 | 4499 | null, |
| 4500 | 4500 | $encoding |
| 4501 | 4501 | ); |
@@ -4516,10 +4516,10 @@ discard block |
||
| 4516 | 4516 | public static function remove_right(string $str, string $substring, string $encoding = 'UTF-8'): string |
| 4517 | 4517 | { |
| 4518 | 4518 | if (self::str_ends_with($str, $substring)) { |
| 4519 | - return (string) self::substr( |
|
| 4519 | + return (string)self::substr( |
|
| 4520 | 4520 | $str, |
| 4521 | 4521 | 0, |
| 4522 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding) |
|
| 4522 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding) |
|
| 4523 | 4523 | ); |
| 4524 | 4524 | } |
| 4525 | 4525 | |
@@ -4655,7 +4655,7 @@ discard block |
||
| 4655 | 4655 | |
| 4656 | 4656 | echo '<pre>'; |
| 4657 | 4657 | foreach (self::$SUPPORT as $key => &$value) { |
| 4658 | - echo $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
| 4658 | + echo $key.' - '.\print_r($value, true)."\n<br>"; |
|
| 4659 | 4659 | } |
| 4660 | 4660 | unset($value); |
| 4661 | 4661 | echo '</pre>'; |
@@ -4688,7 +4688,7 @@ discard block |
||
| 4688 | 4688 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
| 4689 | 4689 | } |
| 4690 | 4690 | |
| 4691 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
| 4691 | + return '&#'.self::ord($char, $encoding).';'; |
|
| 4692 | 4692 | } |
| 4693 | 4693 | |
| 4694 | 4694 | /** |
@@ -4727,7 +4727,7 @@ discard block |
||
| 4727 | 4727 | } |
| 4728 | 4728 | |
| 4729 | 4729 | // init |
| 4730 | - $str = (string) $str; |
|
| 4730 | + $str = (string)$str; |
|
| 4731 | 4731 | |
| 4732 | 4732 | if ($str === '') { |
| 4733 | 4733 | return []; |
@@ -4770,7 +4770,7 @@ discard block |
||
| 4770 | 4770 | ($str[$i] & "\xE0") === "\xC0" |
| 4771 | 4771 | ) { |
| 4772 | 4772 | if (($str[$i + 1] & "\xC0") === "\x80") { |
| 4773 | - $ret[] = $str[$i] . $str[$i + 1]; |
|
| 4773 | + $ret[] = $str[$i].$str[$i + 1]; |
|
| 4774 | 4774 | |
| 4775 | 4775 | ++$i; |
| 4776 | 4776 | } |
@@ -4784,7 +4784,7 @@ discard block |
||
| 4784 | 4784 | && |
| 4785 | 4785 | ($str[$i + 2] & "\xC0") === "\x80" |
| 4786 | 4786 | ) { |
| 4787 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2]; |
|
| 4787 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2]; |
|
| 4788 | 4788 | |
| 4789 | 4789 | $i += 2; |
| 4790 | 4790 | } |
@@ -4800,7 +4800,7 @@ discard block |
||
| 4800 | 4800 | && |
| 4801 | 4801 | ($str[$i + 3] & "\xC0") === "\x80" |
| 4802 | 4802 | ) { |
| 4803 | - $ret[] = $str[$i] . $str[$i + 1] . $str[$i + 2] . $str[$i + 3]; |
|
| 4803 | + $ret[] = $str[$i].$str[$i + 1].$str[$i + 2].$str[$i + 3]; |
|
| 4804 | 4804 | |
| 4805 | 4805 | $i += 3; |
| 4806 | 4806 | } |
@@ -4812,7 +4812,7 @@ discard block |
||
| 4812 | 4812 | $ret = \array_chunk($ret, $length); |
| 4813 | 4813 | |
| 4814 | 4814 | return \array_map( |
| 4815 | - static function (array $item): string { |
|
| 4815 | + static function(array $item): string { |
|
| 4816 | 4816 | return \implode('', $item); |
| 4817 | 4817 | }, |
| 4818 | 4818 | $ret |
@@ -4842,16 +4842,16 @@ discard block |
||
| 4842 | 4842 | public static function str_camelize(string $str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
| 4843 | 4843 | { |
| 4844 | 4844 | $str = self::lcfirst(self::trim($str), $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 4845 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
| 4845 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
| 4846 | 4846 | |
| 4847 | - $str = (string) \preg_replace_callback( |
|
| 4847 | + $str = (string)\preg_replace_callback( |
|
| 4848 | 4848 | '/[-_\s]+(.)?/u', |
| 4849 | 4849 | /** |
| 4850 | 4850 | * @param array $match |
| 4851 | 4851 | * |
| 4852 | 4852 | * @return string |
| 4853 | 4853 | */ |
| 4854 | - static function (array $match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 4854 | + static function(array $match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 4855 | 4855 | if (isset($match[1])) { |
| 4856 | 4856 | return self::strtoupper($match[1], $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 4857 | 4857 | } |
@@ -4861,14 +4861,14 @@ discard block |
||
| 4861 | 4861 | $str |
| 4862 | 4862 | ); |
| 4863 | 4863 | |
| 4864 | - return (string) \preg_replace_callback( |
|
| 4864 | + return (string)\preg_replace_callback( |
|
| 4865 | 4865 | '/[\d]+(.)?/u', |
| 4866 | 4866 | /** |
| 4867 | 4867 | * @param array $match |
| 4868 | 4868 | * |
| 4869 | 4869 | * @return string |
| 4870 | 4870 | */ |
| 4871 | - static function (array $match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 4871 | + static function(array $match) use ($encoding, $cleanUtf8, $lang, $tryToKeepStringLength): string { |
|
| 4872 | 4872 | return self::strtoupper($match[0], $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 4873 | 4873 | }, |
| 4874 | 4874 | $str |
@@ -4913,7 +4913,7 @@ discard block |
||
| 4913 | 4913 | // only a fallback to prevent BC in the api ... |
| 4914 | 4914 | /** @psalm-suppress RedundantConditionGivenDocblockType */ |
| 4915 | 4915 | if ($caseSensitive !== false && $caseSensitive !== true) { |
| 4916 | - $encoding = (string) $caseSensitive; |
|
| 4916 | + $encoding = (string)$caseSensitive; |
|
| 4917 | 4917 | } |
| 4918 | 4918 | |
| 4919 | 4919 | if ($caseSensitive) { |
@@ -4948,7 +4948,7 @@ discard block |
||
| 4948 | 4948 | // only a fallback to prevent BC in the api ... |
| 4949 | 4949 | /** @psalm-suppress RedundantConditionGivenDocblockType */ |
| 4950 | 4950 | if ($caseSensitive !== false && $caseSensitive !== true) { |
| 4951 | - $encoding = (string) $caseSensitive; |
|
| 4951 | + $encoding = (string)$caseSensitive; |
|
| 4952 | 4952 | } |
| 4953 | 4953 | |
| 4954 | 4954 | foreach ($needles as &$needle) { |
@@ -5030,11 +5030,11 @@ discard block |
||
| 5030 | 5030 | ): string { |
| 5031 | 5031 | $str = self::trim($str); |
| 5032 | 5032 | |
| 5033 | - $str = (string) \preg_replace('/\B([A-Z])/u', '-\1', $str); |
|
| 5033 | + $str = (string)\preg_replace('/\B([A-Z])/u', '-\1', $str); |
|
| 5034 | 5034 | |
| 5035 | 5035 | $str = self::strtolower($str, $encoding, $cleanUtf8, $lang, $tryToKeepStringLength); |
| 5036 | 5036 | |
| 5037 | - return (string) \preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
| 5037 | + return (string)\preg_replace('/[-_\s]+/u', $delimiter, $str); |
|
| 5038 | 5038 | } |
| 5039 | 5039 | |
| 5040 | 5040 | /** |
@@ -5049,7 +5049,7 @@ discard block |
||
| 5049 | 5049 | public static function str_detect_encoding($str) |
| 5050 | 5050 | { |
| 5051 | 5051 | // init |
| 5052 | - $str = (string) $str; |
|
| 5052 | + $str = (string)$str; |
|
| 5053 | 5053 | |
| 5054 | 5054 | // |
| 5055 | 5055 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -5155,7 +5155,7 @@ discard block |
||
| 5155 | 5155 | foreach (self::$ENCODINGS as $encodingTmp) { |
| 5156 | 5156 | // INFO: //IGNORE but still throw notice |
| 5157 | 5157 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 5158 | - if ((string) @\iconv($encodingTmp, $encodingTmp . '//IGNORE', $str) === $str) { |
|
| 5158 | + if ((string)@\iconv($encodingTmp, $encodingTmp.'//IGNORE', $str) === $str) { |
|
| 5159 | 5159 | return $encodingTmp; |
| 5160 | 5160 | } |
| 5161 | 5161 | } |
@@ -5217,7 +5217,7 @@ discard block |
||
| 5217 | 5217 | public static function str_ensure_left(string $str, string $substring): string |
| 5218 | 5218 | { |
| 5219 | 5219 | if (!self::str_starts_with($str, $substring)) { |
| 5220 | - $str = $substring . $str; |
|
| 5220 | + $str = $substring.$str; |
|
| 5221 | 5221 | } |
| 5222 | 5222 | |
| 5223 | 5223 | return $str; |
@@ -5413,15 +5413,15 @@ discard block |
||
| 5413 | 5413 | */ |
| 5414 | 5414 | public static function str_insert(string $str, string $substring, int $index, string $encoding = 'UTF-8'): string |
| 5415 | 5415 | { |
| 5416 | - $len = (int) self::strlen($str, $encoding); |
|
| 5416 | + $len = (int)self::strlen($str, $encoding); |
|
| 5417 | 5417 | |
| 5418 | 5418 | if ($index > $len) { |
| 5419 | 5419 | return $str; |
| 5420 | 5420 | } |
| 5421 | 5421 | |
| 5422 | - return (string) self::substr($str, 0, $index, $encoding) . |
|
| 5423 | - $substring . |
|
| 5424 | - (string) self::substr($str, $index, $len, $encoding); |
|
| 5422 | + return (string)self::substr($str, 0, $index, $encoding). |
|
| 5423 | + $substring. |
|
| 5424 | + (string)self::substr($str, $index, $len, $encoding); |
|
| 5425 | 5425 | } |
| 5426 | 5426 | |
| 5427 | 5427 | /** |
@@ -5451,15 +5451,15 @@ discard block |
||
| 5451 | 5451 | */ |
| 5452 | 5452 | public static function str_ireplace($search, $replace, $subject, &$count = null) |
| 5453 | 5453 | { |
| 5454 | - $search = (array) $search; |
|
| 5454 | + $search = (array)$search; |
|
| 5455 | 5455 | |
| 5456 | 5456 | /** @noinspection AlterInForeachInspection */ |
| 5457 | 5457 | foreach ($search as &$s) { |
| 5458 | - $s = (string) $s; |
|
| 5458 | + $s = (string)$s; |
|
| 5459 | 5459 | if ($s === '') { |
| 5460 | 5460 | $s = '/^(?<=.)$/'; |
| 5461 | 5461 | } else { |
| 5462 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
| 5462 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
| 5463 | 5463 | } |
| 5464 | 5464 | } |
| 5465 | 5465 | |
@@ -5491,11 +5491,11 @@ discard block |
||
| 5491 | 5491 | } |
| 5492 | 5492 | |
| 5493 | 5493 | if ($search === '') { |
| 5494 | - return $str . $replacement; |
|
| 5494 | + return $str.$replacement; |
|
| 5495 | 5495 | } |
| 5496 | 5496 | |
| 5497 | 5497 | if (\stripos($str, $search) === 0) { |
| 5498 | - return $replacement . \substr($str, \strlen($search)); |
|
| 5498 | + return $replacement.\substr($str, \strlen($search)); |
|
| 5499 | 5499 | } |
| 5500 | 5500 | |
| 5501 | 5501 | return $str; |
@@ -5523,11 +5523,11 @@ discard block |
||
| 5523 | 5523 | } |
| 5524 | 5524 | |
| 5525 | 5525 | if ($search === '') { |
| 5526 | - return $str . $replacement; |
|
| 5526 | + return $str.$replacement; |
|
| 5527 | 5527 | } |
| 5528 | 5528 | |
| 5529 | 5529 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 5530 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 5530 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 5531 | 5531 | } |
| 5532 | 5532 | |
| 5533 | 5533 | return $str; |
@@ -5603,9 +5603,9 @@ discard block |
||
| 5603 | 5603 | return ''; |
| 5604 | 5604 | } |
| 5605 | 5605 | |
| 5606 | - return (string) self::substr( |
|
| 5606 | + return (string)self::substr( |
|
| 5607 | 5607 | $str, |
| 5608 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 5608 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 5609 | 5609 | null, |
| 5610 | 5610 | $encoding |
| 5611 | 5611 | ); |
@@ -5635,9 +5635,9 @@ discard block |
||
| 5635 | 5635 | return ''; |
| 5636 | 5636 | } |
| 5637 | 5637 | |
| 5638 | - return (string) self::substr( |
|
| 5638 | + return (string)self::substr( |
|
| 5639 | 5639 | $str, |
| 5640 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 5640 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 5641 | 5641 | null, |
| 5642 | 5642 | $encoding |
| 5643 | 5643 | ); |
@@ -5667,7 +5667,7 @@ discard block |
||
| 5667 | 5667 | return ''; |
| 5668 | 5668 | } |
| 5669 | 5669 | |
| 5670 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 5670 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 5671 | 5671 | } |
| 5672 | 5672 | |
| 5673 | 5673 | /** |
@@ -5694,7 +5694,7 @@ discard block |
||
| 5694 | 5694 | return ''; |
| 5695 | 5695 | } |
| 5696 | 5696 | |
| 5697 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
| 5697 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
| 5698 | 5698 | } |
| 5699 | 5699 | |
| 5700 | 5700 | /** |
@@ -5773,7 +5773,7 @@ discard block |
||
| 5773 | 5773 | return ''; |
| 5774 | 5774 | } |
| 5775 | 5775 | |
| 5776 | - return (string) self::substr($str, -$n, null, $encoding); |
|
| 5776 | + return (string)self::substr($str, -$n, null, $encoding); |
|
| 5777 | 5777 | } |
| 5778 | 5778 | |
| 5779 | 5779 | /** |
@@ -5796,11 +5796,11 @@ discard block |
||
| 5796 | 5796 | return ''; |
| 5797 | 5797 | } |
| 5798 | 5798 | |
| 5799 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 5799 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 5800 | 5800 | return $str; |
| 5801 | 5801 | } |
| 5802 | 5802 | |
| 5803 | - return (string) self::substr($str, 0, $length - (int) self::strlen($strAddOn), $encoding) . $strAddOn; |
|
| 5803 | + return (string)self::substr($str, 0, $length - (int)self::strlen($strAddOn), $encoding).$strAddOn; |
|
| 5804 | 5804 | } |
| 5805 | 5805 | |
| 5806 | 5806 | /** |
@@ -5823,17 +5823,17 @@ discard block |
||
| 5823 | 5823 | return ''; |
| 5824 | 5824 | } |
| 5825 | 5825 | |
| 5826 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
| 5826 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
| 5827 | 5827 | return $str; |
| 5828 | 5828 | } |
| 5829 | 5829 | |
| 5830 | 5830 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
| 5831 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
| 5831 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
| 5832 | 5832 | } |
| 5833 | 5833 | |
| 5834 | 5834 | $str = self::substr($str, 0, $length, $encoding); |
| 5835 | 5835 | if ($str === false) { |
| 5836 | - return '' . $strAddOn; |
|
| 5836 | + return ''.$strAddOn; |
|
| 5837 | 5837 | } |
| 5838 | 5838 | |
| 5839 | 5839 | $array = \explode(' ', $str); |
@@ -5841,10 +5841,10 @@ discard block |
||
| 5841 | 5841 | $new_str = \implode(' ', $array); |
| 5842 | 5842 | |
| 5843 | 5843 | if ($new_str === '') { |
| 5844 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $strAddOn; |
|
| 5844 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$strAddOn; |
|
| 5845 | 5845 | } |
| 5846 | 5846 | |
| 5847 | - return $new_str . $strAddOn; |
|
| 5847 | + return $new_str.$strAddOn; |
|
| 5848 | 5848 | } |
| 5849 | 5849 | |
| 5850 | 5850 | /** |
@@ -5858,7 +5858,7 @@ discard block |
||
| 5858 | 5858 | */ |
| 5859 | 5859 | public static function str_longest_common_prefix(string $str, string $otherStr, string $encoding = 'UTF-8'): string |
| 5860 | 5860 | { |
| 5861 | - $maxLength = \min(self::strlen($str, $encoding), (int) self::strlen($otherStr, $encoding)); |
|
| 5861 | + $maxLength = \min(self::strlen($str, $encoding), (int)self::strlen($otherStr, $encoding)); |
|
| 5862 | 5862 | |
| 5863 | 5863 | $longestCommonPrefix = ''; |
| 5864 | 5864 | for ($i = 0; $i < $maxLength; ++$i) { |
@@ -5892,8 +5892,8 @@ discard block |
||
| 5892 | 5892 | { |
| 5893 | 5893 | // Uses dynamic programming to solve |
| 5894 | 5894 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
| 5895 | - $strLength = (int) self::strlen($str, $encoding); |
|
| 5896 | - $otherLength = (int) self::strlen($otherStr, $encoding); |
|
| 5895 | + $strLength = (int)self::strlen($str, $encoding); |
|
| 5896 | + $otherLength = (int)self::strlen($otherStr, $encoding); |
|
| 5897 | 5897 | |
| 5898 | 5898 | // Return if either string is empty |
| 5899 | 5899 | if ($strLength === 0 || $otherLength === 0) { |
@@ -5925,7 +5925,7 @@ discard block |
||
| 5925 | 5925 | } |
| 5926 | 5926 | } |
| 5927 | 5927 | |
| 5928 | - return (string) self::substr($str, $end - $len, $len, $encoding); |
|
| 5928 | + return (string)self::substr($str, $end - $len, $len, $encoding); |
|
| 5929 | 5929 | } |
| 5930 | 5930 | |
| 5931 | 5931 | /** |
@@ -5939,7 +5939,7 @@ discard block |
||
| 5939 | 5939 | */ |
| 5940 | 5940 | public static function str_longest_common_suffix(string $str, string $otherStr, string $encoding = 'UTF-8'): string |
| 5941 | 5941 | { |
| 5942 | - $maxLength = \min(self::strlen($str, $encoding), (int) self::strlen($otherStr, $encoding)); |
|
| 5942 | + $maxLength = \min(self::strlen($str, $encoding), (int)self::strlen($otherStr, $encoding)); |
|
| 5943 | 5943 | |
| 5944 | 5944 | $longestCommonSuffix = ''; |
| 5945 | 5945 | for ($i = 1; $i <= $maxLength; ++$i) { |
@@ -5950,7 +5950,7 @@ discard block |
||
| 5950 | 5950 | && |
| 5951 | 5951 | $char === self::substr($otherStr, -$i, 1, $encoding) |
| 5952 | 5952 | ) { |
| 5953 | - $longestCommonSuffix = $char . $longestCommonSuffix; |
|
| 5953 | + $longestCommonSuffix = $char.$longestCommonSuffix; |
|
| 5954 | 5954 | } else { |
| 5955 | 5955 | break; |
| 5956 | 5956 | } |
@@ -5969,7 +5969,7 @@ discard block |
||
| 5969 | 5969 | */ |
| 5970 | 5970 | public static function str_matches_pattern(string $str, string $pattern): bool |
| 5971 | 5971 | { |
| 5972 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
| 5972 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
| 5973 | 5973 | } |
| 5974 | 5974 | |
| 5975 | 5975 | /** |
@@ -5986,7 +5986,7 @@ discard block |
||
| 5986 | 5986 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
| 5987 | 5987 | { |
| 5988 | 5988 | // init |
| 5989 | - $length = (int) self::strlen($str, $encoding); |
|
| 5989 | + $length = (int)self::strlen($str, $encoding); |
|
| 5990 | 5990 | |
| 5991 | 5991 | if ($offset >= 0) { |
| 5992 | 5992 | return $length > $offset; |
@@ -6012,7 +6012,7 @@ discard block |
||
| 6012 | 6012 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
| 6013 | 6013 | { |
| 6014 | 6014 | // init |
| 6015 | - $length = (int) self::strlen($str); |
|
| 6015 | + $length = (int)self::strlen($str); |
|
| 6016 | 6016 | |
| 6017 | 6017 | if ( |
| 6018 | 6018 | ($index >= 0 && $length <= $index) |
@@ -6046,7 +6046,7 @@ discard block |
||
| 6046 | 6046 | return ''; |
| 6047 | 6047 | } |
| 6048 | 6048 | |
| 6049 | - if ($pad_type !== (int) $pad_type) { |
|
| 6049 | + if ($pad_type !== (int)$pad_type) { |
|
| 6050 | 6050 | if ($pad_type === 'left') { |
| 6051 | 6051 | $pad_type = \STR_PAD_LEFT; |
| 6052 | 6052 | } elseif ($pad_type === 'right') { |
@@ -6055,46 +6055,46 @@ discard block |
||
| 6055 | 6055 | $pad_type = \STR_PAD_BOTH; |
| 6056 | 6056 | } else { |
| 6057 | 6057 | throw new \InvalidArgumentException( |
| 6058 | - 'Pad expects $padType to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
| 6058 | + 'Pad expects $padType to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
| 6059 | 6059 | ); |
| 6060 | 6060 | } |
| 6061 | 6061 | } |
| 6062 | 6062 | |
| 6063 | - $str_length = (int) self::strlen($str, $encoding); |
|
| 6063 | + $str_length = (int)self::strlen($str, $encoding); |
|
| 6064 | 6064 | |
| 6065 | 6065 | if ( |
| 6066 | 6066 | $pad_length > 0 |
| 6067 | 6067 | && |
| 6068 | 6068 | $pad_length >= $str_length |
| 6069 | 6069 | ) { |
| 6070 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
| 6070 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
| 6071 | 6071 | |
| 6072 | 6072 | $diff = ($pad_length - $str_length); |
| 6073 | 6073 | |
| 6074 | 6074 | switch ($pad_type) { |
| 6075 | 6075 | case \STR_PAD_LEFT: |
| 6076 | - $pre = \str_repeat($pad_string, (int) \ceil($diff / $ps_length)); |
|
| 6077 | - $pre = (string) self::substr($pre, 0, $diff, $encoding); |
|
| 6076 | + $pre = \str_repeat($pad_string, (int)\ceil($diff / $ps_length)); |
|
| 6077 | + $pre = (string)self::substr($pre, 0, $diff, $encoding); |
|
| 6078 | 6078 | $post = ''; |
| 6079 | 6079 | |
| 6080 | 6080 | break; |
| 6081 | 6081 | |
| 6082 | 6082 | case \STR_PAD_BOTH: |
| 6083 | - $pre = \str_repeat($pad_string, (int) \ceil($diff / $ps_length / 2)); |
|
| 6084 | - $pre = (string) self::substr($pre, 0, (int) \floor($diff / 2), $encoding); |
|
| 6085 | - $post = \str_repeat($pad_string, (int) \ceil($diff / $ps_length / 2)); |
|
| 6086 | - $post = (string) self::substr($post, 0, (int) \ceil($diff / 2), $encoding); |
|
| 6083 | + $pre = \str_repeat($pad_string, (int)\ceil($diff / $ps_length / 2)); |
|
| 6084 | + $pre = (string)self::substr($pre, 0, (int)\floor($diff / 2), $encoding); |
|
| 6085 | + $post = \str_repeat($pad_string, (int)\ceil($diff / $ps_length / 2)); |
|
| 6086 | + $post = (string)self::substr($post, 0, (int)\ceil($diff / 2), $encoding); |
|
| 6087 | 6087 | |
| 6088 | 6088 | break; |
| 6089 | 6089 | |
| 6090 | 6090 | case \STR_PAD_RIGHT: |
| 6091 | 6091 | default: |
| 6092 | - $post = \str_repeat($pad_string, (int) \ceil($diff / $ps_length)); |
|
| 6093 | - $post = (string) self::substr($post, 0, $diff, $encoding); |
|
| 6092 | + $post = \str_repeat($pad_string, (int)\ceil($diff / $ps_length)); |
|
| 6093 | + $post = (string)self::substr($post, 0, $diff, $encoding); |
|
| 6094 | 6094 | $pre = ''; |
| 6095 | 6095 | } |
| 6096 | 6096 | |
| 6097 | - return $pre . $str . $post; |
|
| 6097 | + return $pre.$str.$post; |
|
| 6098 | 6098 | } |
| 6099 | 6099 | |
| 6100 | 6100 | return $str; |
@@ -6113,9 +6113,9 @@ discard block |
||
| 6113 | 6113 | */ |
| 6114 | 6114 | public static function str_pad_both(string $str, int $length, string $padStr = ' ', string $encoding = 'UTF-8'): string |
| 6115 | 6115 | { |
| 6116 | - $padding = $length - (int) self::strlen($str, $encoding); |
|
| 6116 | + $padding = $length - (int)self::strlen($str, $encoding); |
|
| 6117 | 6117 | |
| 6118 | - return self::apply_padding($str, (int) \floor($padding / 2), (int) \ceil($padding / 2), $padStr, $encoding); |
|
| 6118 | + return self::apply_padding($str, (int)\floor($padding / 2), (int)\ceil($padding / 2), $padStr, $encoding); |
|
| 6119 | 6119 | } |
| 6120 | 6120 | |
| 6121 | 6121 | /** |
@@ -6131,7 +6131,7 @@ discard block |
||
| 6131 | 6131 | */ |
| 6132 | 6132 | public static function str_pad_left(string $str, int $length, string $padStr = ' ', string $encoding = 'UTF-8'): string |
| 6133 | 6133 | { |
| 6134 | - return self::apply_padding($str, $length - (int) self::strlen($str), 0, $padStr, $encoding); |
|
| 6134 | + return self::apply_padding($str, $length - (int)self::strlen($str), 0, $padStr, $encoding); |
|
| 6135 | 6135 | } |
| 6136 | 6136 | |
| 6137 | 6137 | /** |
@@ -6147,7 +6147,7 @@ discard block |
||
| 6147 | 6147 | */ |
| 6148 | 6148 | public static function str_pad_right(string $str, int $length, string $padStr = ' ', string $encoding = 'UTF-8'): string |
| 6149 | 6149 | { |
| 6150 | - return self::apply_padding($str, 0, $length - (int) self::strlen($str), $padStr, $encoding); |
|
| 6150 | + return self::apply_padding($str, 0, $length - (int)self::strlen($str), $padStr, $encoding); |
|
| 6151 | 6151 | } |
| 6152 | 6152 | |
| 6153 | 6153 | /** |
@@ -6232,11 +6232,11 @@ discard block |
||
| 6232 | 6232 | } |
| 6233 | 6233 | |
| 6234 | 6234 | if ($search === '') { |
| 6235 | - return $str . $replacement; |
|
| 6235 | + return $str.$replacement; |
|
| 6236 | 6236 | } |
| 6237 | 6237 | |
| 6238 | 6238 | if (\strpos($str, $search) === 0) { |
| 6239 | - return $replacement . \substr($str, \strlen($search)); |
|
| 6239 | + return $replacement.\substr($str, \strlen($search)); |
|
| 6240 | 6240 | } |
| 6241 | 6241 | |
| 6242 | 6242 | return $str; |
@@ -6264,11 +6264,11 @@ discard block |
||
| 6264 | 6264 | } |
| 6265 | 6265 | |
| 6266 | 6266 | if ($search === '') { |
| 6267 | - return $str . $replacement; |
|
| 6267 | + return $str.$replacement; |
|
| 6268 | 6268 | } |
| 6269 | 6269 | |
| 6270 | 6270 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
| 6271 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
| 6271 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
| 6272 | 6272 | } |
| 6273 | 6273 | |
| 6274 | 6274 | return $str; |
@@ -6290,7 +6290,7 @@ discard block |
||
| 6290 | 6290 | $pos = self::strpos($subject, $search); |
| 6291 | 6291 | if ($pos !== false) { |
| 6292 | 6292 | /** @psalm-suppress InvalidReturnStatement */ |
| 6293 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
| 6293 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
| 6294 | 6294 | } |
| 6295 | 6295 | |
| 6296 | 6296 | return $subject; |
@@ -6312,7 +6312,7 @@ discard block |
||
| 6312 | 6312 | $pos = self::strrpos($subject, $search); |
| 6313 | 6313 | if ($pos !== false) { |
| 6314 | 6314 | /** @psalm-suppress InvalidReturnStatement */ |
| 6315 | - return self::substr_replace($subject, $replace, $pos, (int) self::strlen($search)); |
|
| 6315 | + return self::substr_replace($subject, $replace, $pos, (int)self::strlen($search)); |
|
| 6316 | 6316 | } |
| 6317 | 6317 | |
| 6318 | 6318 | return $subject; |
@@ -6329,7 +6329,7 @@ discard block |
||
| 6329 | 6329 | */ |
| 6330 | 6330 | public static function str_shuffle(string $str): string |
| 6331 | 6331 | { |
| 6332 | - $indexes = \range(0, (int) self::strlen($str) - 1); |
|
| 6332 | + $indexes = \range(0, (int)self::strlen($str) - 1); |
|
| 6333 | 6333 | /** @noinspection NonSecureShuffleUsageInspection */ |
| 6334 | 6334 | \shuffle($indexes); |
| 6335 | 6335 | |
@@ -6362,11 +6362,11 @@ discard block |
||
| 6362 | 6362 | public static function str_slice(string $str, int $start, int $end = null, string $encoding = 'UTF-8') |
| 6363 | 6363 | { |
| 6364 | 6364 | if ($end === null) { |
| 6365 | - $length = (int) self::strlen($str); |
|
| 6365 | + $length = (int)self::strlen($str); |
|
| 6366 | 6366 | } elseif ($end >= 0 && $end <= $start) { |
| 6367 | 6367 | return ''; |
| 6368 | 6368 | } elseif ($end < 0) { |
| 6369 | - $length = (int) self::strlen($str) + $end - $start; |
|
| 6369 | + $length = (int)self::strlen($str) + $end - $start; |
|
| 6370 | 6370 | } else { |
| 6371 | 6371 | $length = $end - $start; |
| 6372 | 6372 | } |
@@ -6387,31 +6387,31 @@ discard block |
||
| 6387 | 6387 | $str = self::normalize_whitespace($str); |
| 6388 | 6388 | $str = \str_replace('-', '_', $str); |
| 6389 | 6389 | |
| 6390 | - $str = (string) \preg_replace_callback( |
|
| 6390 | + $str = (string)\preg_replace_callback( |
|
| 6391 | 6391 | '/([\d|A-Z])/u', |
| 6392 | 6392 | /** |
| 6393 | 6393 | * @param string[] $matches |
| 6394 | 6394 | * |
| 6395 | 6395 | * @return string |
| 6396 | 6396 | */ |
| 6397 | - static function (array $matches) use ($encoding): string { |
|
| 6397 | + static function(array $matches) use ($encoding): string { |
|
| 6398 | 6398 | $match = $matches[1]; |
| 6399 | - $matchInt = (int) $match; |
|
| 6399 | + $matchInt = (int)$match; |
|
| 6400 | 6400 | |
| 6401 | - if ((string) $matchInt === $match) { |
|
| 6402 | - return '_' . $match . '_'; |
|
| 6401 | + if ((string)$matchInt === $match) { |
|
| 6402 | + return '_'.$match.'_'; |
|
| 6403 | 6403 | } |
| 6404 | 6404 | |
| 6405 | - return '_' . self::strtolower($match, $encoding); |
|
| 6405 | + return '_'.self::strtolower($match, $encoding); |
|
| 6406 | 6406 | }, |
| 6407 | 6407 | $str |
| 6408 | 6408 | ); |
| 6409 | 6409 | |
| 6410 | - $str = (string) \preg_replace( |
|
| 6410 | + $str = (string)\preg_replace( |
|
| 6411 | 6411 | [ |
| 6412 | - '/\s+/', // convert spaces to "_" |
|
| 6413 | - '/^\s+|\s+$/', // trim leading & trailing spaces |
|
| 6414 | - '/_+/', // remove double "_" |
|
| 6412 | + '/\s+/', // convert spaces to "_" |
|
| 6413 | + '/^\s+|\s+$/', // trim leading & trailing spaces |
|
| 6414 | + '/_+/', // remove double "_" |
|
| 6415 | 6415 | ], |
| 6416 | 6416 | [ |
| 6417 | 6417 | '_', |
@@ -6498,7 +6498,7 @@ discard block |
||
| 6498 | 6498 | $limit = -1; |
| 6499 | 6499 | } |
| 6500 | 6500 | |
| 6501 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
| 6501 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
| 6502 | 6502 | |
| 6503 | 6503 | if ($array === false) { |
| 6504 | 6504 | return []; |
@@ -6581,9 +6581,9 @@ discard block |
||
| 6581 | 6581 | return ''; |
| 6582 | 6582 | } |
| 6583 | 6583 | |
| 6584 | - return (string) self::substr( |
|
| 6584 | + return (string)self::substr( |
|
| 6585 | 6585 | $str, |
| 6586 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6586 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6587 | 6587 | null, |
| 6588 | 6588 | $encoding |
| 6589 | 6589 | ); |
@@ -6613,9 +6613,9 @@ discard block |
||
| 6613 | 6613 | return ''; |
| 6614 | 6614 | } |
| 6615 | 6615 | |
| 6616 | - return (string) self::substr( |
|
| 6616 | + return (string)self::substr( |
|
| 6617 | 6617 | $str, |
| 6618 | - $offset + (int) self::strlen($separator, $encoding), |
|
| 6618 | + $offset + (int)self::strlen($separator, $encoding), |
|
| 6619 | 6619 | null, |
| 6620 | 6620 | $encoding |
| 6621 | 6621 | ); |
@@ -6645,7 +6645,7 @@ discard block |
||
| 6645 | 6645 | return ''; |
| 6646 | 6646 | } |
| 6647 | 6647 | |
| 6648 | - return (string) self::substr( |
|
| 6648 | + return (string)self::substr( |
|
| 6649 | 6649 | $str, |
| 6650 | 6650 | 0, |
| 6651 | 6651 | $offset, |
@@ -6677,7 +6677,7 @@ discard block |
||
| 6677 | 6677 | return ''; |
| 6678 | 6678 | } |
| 6679 | 6679 | |
| 6680 | - return (string) self::substr( |
|
| 6680 | + return (string)self::substr( |
|
| 6681 | 6681 | $str, |
| 6682 | 6682 | 0, |
| 6683 | 6683 | $offset, |
@@ -6868,16 +6868,16 @@ discard block |
||
| 6868 | 6868 | } |
| 6869 | 6869 | |
| 6870 | 6870 | // the main substitutions |
| 6871 | - $str = (string) \preg_replace_callback( |
|
| 6871 | + $str = (string)\preg_replace_callback( |
|
| 6872 | 6872 | '~\b (_*) (?: # 1. Leading underscore and |
| 6873 | 6873 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
| 6874 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx . ' ) # URL, domain, or email |
|
| 6874 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostropheRx.' ) # URL, domain, or email |
|
| 6875 | 6875 | | |
| 6876 | - ( (?i: ' . $smallWordsRx . ' ) ' . $apostropheRx . ' ) # 3. or small word (case-insensitive) |
|
| 6876 | + ( (?i: ' . $smallWordsRx.' ) '.$apostropheRx.' ) # 3. or small word (case-insensitive) |
|
| 6877 | 6877 | | |
| 6878 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 4. or word w/o internal caps |
|
| 6878 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 4. or word w/o internal caps |
|
| 6879 | 6879 | | |
| 6880 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx . ' ) # 5. or some other word |
|
| 6880 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostropheRx.' ) # 5. or some other word |
|
| 6881 | 6881 | ) (_*) \b # 6. With trailing underscore |
| 6882 | 6882 | ~ux', |
| 6883 | 6883 | /** |
@@ -6885,7 +6885,7 @@ discard block |
||
| 6885 | 6885 | * |
| 6886 | 6886 | * @return string |
| 6887 | 6887 | */ |
| 6888 | - static function (array $matches) use ($encoding): string { |
|
| 6888 | + static function(array $matches) use ($encoding): string { |
|
| 6889 | 6889 | // preserve leading underscore |
| 6890 | 6890 | $str = $matches[1]; |
| 6891 | 6891 | if ($matches[2]) { |
@@ -6910,26 +6910,26 @@ discard block |
||
| 6910 | 6910 | ); |
| 6911 | 6911 | |
| 6912 | 6912 | // Exceptions for small words: capitalize at start of title... |
| 6913 | - $str = (string) \preg_replace_callback( |
|
| 6913 | + $str = (string)\preg_replace_callback( |
|
| 6914 | 6914 | '~( \A [[:punct:]]* # start of title... |
| 6915 | 6915 | | [:.;?!][ ]+ # or of subsentence... |
| 6916 | 6916 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
| 6917 | - ( ' . $smallWordsRx . ' ) \b # ...followed by small word |
|
| 6917 | + ( ' . $smallWordsRx.' ) \b # ...followed by small word |
|
| 6918 | 6918 | ~uxi', |
| 6919 | 6919 | /** |
| 6920 | 6920 | * @param string[] $matches |
| 6921 | 6921 | * |
| 6922 | 6922 | * @return string |
| 6923 | 6923 | */ |
| 6924 | - static function (array $matches) use ($encoding): string { |
|
| 6925 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
| 6924 | + static function(array $matches) use ($encoding): string { |
|
| 6925 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
| 6926 | 6926 | }, |
| 6927 | 6927 | $str |
| 6928 | 6928 | ); |
| 6929 | 6929 | |
| 6930 | 6930 | // ...and end of title |
| 6931 | - $str = (string) \preg_replace_callback( |
|
| 6932 | - '~\b ( ' . $smallWordsRx . ' ) # small word... |
|
| 6931 | + $str = (string)\preg_replace_callback( |
|
| 6932 | + '~\b ( '.$smallWordsRx.' ) # small word... |
|
| 6933 | 6933 | (?= [[:punct:]]* \Z # ...at the end of the title... |
| 6934 | 6934 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
| 6935 | 6935 | ~uxi', |
@@ -6938,7 +6938,7 @@ discard block |
||
| 6938 | 6938 | * |
| 6939 | 6939 | * @return string |
| 6940 | 6940 | */ |
| 6941 | - static function (array $matches) use ($encoding): string { |
|
| 6941 | + static function(array $matches) use ($encoding): string { |
|
| 6942 | 6942 | return static::str_upper_first($matches[1], $encoding); |
| 6943 | 6943 | }, |
| 6944 | 6944 | $str |
@@ -6946,10 +6946,10 @@ discard block |
||
| 6946 | 6946 | |
| 6947 | 6947 | // Exceptions for small words in hyphenated compound words. |
| 6948 | 6948 | // e.g. "in-flight" -> In-Flight |
| 6949 | - $str = (string) \preg_replace_callback( |
|
| 6949 | + $str = (string)\preg_replace_callback( |
|
| 6950 | 6950 | '~\b |
| 6951 | 6951 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
| 6952 | - ( ' . $smallWordsRx . ' ) |
|
| 6952 | + ( ' . $smallWordsRx.' ) |
|
| 6953 | 6953 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
| 6954 | 6954 | ~uxi', |
| 6955 | 6955 | /** |
@@ -6957,18 +6957,18 @@ discard block |
||
| 6957 | 6957 | * |
| 6958 | 6958 | * @return string |
| 6959 | 6959 | */ |
| 6960 | - static function (array $matches) use ($encoding): string { |
|
| 6960 | + static function(array $matches) use ($encoding): string { |
|
| 6961 | 6961 | return static::str_upper_first($matches[1], $encoding); |
| 6962 | 6962 | }, |
| 6963 | 6963 | $str |
| 6964 | 6964 | ); |
| 6965 | 6965 | |
| 6966 | 6966 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
| 6967 | - $str = (string) \preg_replace_callback( |
|
| 6967 | + $str = (string)\preg_replace_callback( |
|
| 6968 | 6968 | '~\b |
| 6969 | 6969 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
| 6970 | 6970 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
| 6971 | - ( ' . $smallWordsRx . ' ) # ...followed by small word |
|
| 6971 | + ( ' . $smallWordsRx.' ) # ...followed by small word |
|
| 6972 | 6972 | (?! - ) # Negative lookahead for another - |
| 6973 | 6973 | ~uxi', |
| 6974 | 6974 | /** |
@@ -6976,8 +6976,8 @@ discard block |
||
| 6976 | 6976 | * |
| 6977 | 6977 | * @return string |
| 6978 | 6978 | */ |
| 6979 | - static function (array $matches) use ($encoding): string { |
|
| 6980 | - return $matches[1] . static::str_upper_first($matches[2], $encoding); |
|
| 6979 | + static function(array $matches) use ($encoding): string { |
|
| 6980 | + return $matches[1].static::str_upper_first($matches[2], $encoding); |
|
| 6981 | 6981 | }, |
| 6982 | 6982 | $str |
| 6983 | 6983 | ); |
@@ -7070,7 +7070,7 @@ discard block |
||
| 7070 | 7070 | ); |
| 7071 | 7071 | |
| 7072 | 7072 | foreach ($tmpReturn as &$item) { |
| 7073 | - $item = (string) $item; |
|
| 7073 | + $item = (string)$item; |
|
| 7074 | 7074 | } |
| 7075 | 7075 | |
| 7076 | 7076 | return $tmpReturn; |
@@ -7107,21 +7107,21 @@ discard block |
||
| 7107 | 7107 | public static function str_truncate($str, int $length, string $substring = '', string $encoding = 'UTF-8'): string |
| 7108 | 7108 | { |
| 7109 | 7109 | // init |
| 7110 | - $str = (string) $str; |
|
| 7110 | + $str = (string)$str; |
|
| 7111 | 7111 | |
| 7112 | 7112 | if ($str === '') { |
| 7113 | 7113 | return ''; |
| 7114 | 7114 | } |
| 7115 | 7115 | |
| 7116 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 7116 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 7117 | 7117 | return $str; |
| 7118 | 7118 | } |
| 7119 | 7119 | |
| 7120 | 7120 | // Need to further trim the string so we can append the substring |
| 7121 | - $substringLength = (int) self::strlen($substring, $encoding); |
|
| 7121 | + $substringLength = (int)self::strlen($substring, $encoding); |
|
| 7122 | 7122 | $length -= $substringLength; |
| 7123 | 7123 | |
| 7124 | - return ((string) self::substr($str, 0, $length, $encoding)) . $substring; |
|
| 7124 | + return ((string)self::substr($str, 0, $length, $encoding)).$substring; |
|
| 7125 | 7125 | } |
| 7126 | 7126 | |
| 7127 | 7127 | /** |
@@ -7145,12 +7145,12 @@ discard block |
||
| 7145 | 7145 | string $encoding = 'UTF-8', |
| 7146 | 7146 | bool $ignoreDoNotSplitWordsForOneWord = false |
| 7147 | 7147 | ): string { |
| 7148 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
| 7148 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
| 7149 | 7149 | return $str; |
| 7150 | 7150 | } |
| 7151 | 7151 | |
| 7152 | 7152 | // need to further trim the string so we can append the substring |
| 7153 | - $substringLength = (int) self::strlen($substring, $encoding); |
|
| 7153 | + $substringLength = (int)self::strlen($substring, $encoding); |
|
| 7154 | 7154 | $length -= $substringLength; |
| 7155 | 7155 | |
| 7156 | 7156 | $truncated = self::substr($str, 0, $length, $encoding); |
@@ -7169,11 +7169,11 @@ discard block |
||
| 7169 | 7169 | || |
| 7170 | 7170 | ($strPosSpace !== false && $ignoreDoNotSplitWordsForOneWord === false) |
| 7171 | 7171 | ) { |
| 7172 | - $truncated = (string) self::substr($truncated, 0, (int) $lastPos, $encoding); |
|
| 7172 | + $truncated = (string)self::substr($truncated, 0, (int)$lastPos, $encoding); |
|
| 7173 | 7173 | } |
| 7174 | 7174 | } |
| 7175 | 7175 | |
| 7176 | - return $truncated . $substring; |
|
| 7176 | + return $truncated.$substring; |
|
| 7177 | 7177 | } |
| 7178 | 7178 | |
| 7179 | 7179 | /** |
@@ -7253,13 +7253,13 @@ discard block |
||
| 7253 | 7253 | } |
| 7254 | 7254 | } elseif ($format === 2) { |
| 7255 | 7255 | $numberOfWords = []; |
| 7256 | - $offset = (int) self::strlen($strParts[0]); |
|
| 7256 | + $offset = (int)self::strlen($strParts[0]); |
|
| 7257 | 7257 | for ($i = 1; $i < $len; $i += 2) { |
| 7258 | 7258 | $numberOfWords[$offset] = $strParts[$i]; |
| 7259 | - $offset += (int) self::strlen($strParts[$i]) + (int) self::strlen($strParts[$i + 1]); |
|
| 7259 | + $offset += (int)self::strlen($strParts[$i]) + (int)self::strlen($strParts[$i + 1]); |
|
| 7260 | 7260 | } |
| 7261 | 7261 | } else { |
| 7262 | - $numberOfWords = (int) (($len - 1) / 2); |
|
| 7262 | + $numberOfWords = (int)(($len - 1) / 2); |
|
| 7263 | 7263 | } |
| 7264 | 7264 | |
| 7265 | 7265 | return $numberOfWords; |
@@ -7319,7 +7319,7 @@ discard block |
||
| 7319 | 7319 | public static function strcmp(string $str1, string $str2): int |
| 7320 | 7320 | { |
| 7321 | 7321 | /** @noinspection PhpUndefinedClassInspection */ |
| 7322 | - return $str1 . '' === $str2 . '' ? 0 : \strcmp( |
|
| 7322 | + return $str1.'' === $str2.'' ? 0 : \strcmp( |
|
| 7323 | 7323 | \Normalizer::normalize($str1, \Normalizer::NFD), |
| 7324 | 7324 | \Normalizer::normalize($str2, \Normalizer::NFD) |
| 7325 | 7325 | ); |
@@ -7338,12 +7338,12 @@ discard block |
||
| 7338 | 7338 | public static function strcspn(string $str, string $charList, int $offset = null, int $length = null): int |
| 7339 | 7339 | { |
| 7340 | 7340 | if ($charList === '') { |
| 7341 | - return (int) self::strlen($str); |
|
| 7341 | + return (int)self::strlen($str); |
|
| 7342 | 7342 | } |
| 7343 | 7343 | |
| 7344 | 7344 | if ($offset !== null || $length !== null) { |
| 7345 | 7345 | /** @noinspection UnnecessaryCastingInspection */ |
| 7346 | - $strTmp = self::substr($str, (int) $offset, $length); |
|
| 7346 | + $strTmp = self::substr($str, (int)$offset, $length); |
|
| 7347 | 7347 | if ($strTmp === false) { |
| 7348 | 7348 | return 0; |
| 7349 | 7349 | } |
@@ -7355,7 +7355,7 @@ discard block |
||
| 7355 | 7355 | } |
| 7356 | 7356 | |
| 7357 | 7357 | $matches = []; |
| 7358 | - if (\preg_match('/^(.*?)' . self::rxClass($charList) . '/us', $str, $matches)) { |
|
| 7358 | + if (\preg_match('/^(.*?)'.self::rxClass($charList).'/us', $str, $matches)) { |
|
| 7359 | 7359 | $return = self::strlen($matches[1]); |
| 7360 | 7360 | if ($return === false) { |
| 7361 | 7361 | return 0; |
@@ -7364,7 +7364,7 @@ discard block |
||
| 7364 | 7364 | return $return; |
| 7365 | 7365 | } |
| 7366 | 7366 | |
| 7367 | - return (int) self::strlen($str); |
|
| 7367 | + return (int)self::strlen($str); |
|
| 7368 | 7368 | } |
| 7369 | 7369 | |
| 7370 | 7370 | /** |
@@ -7460,7 +7460,7 @@ discard block |
||
| 7460 | 7460 | } |
| 7461 | 7461 | |
| 7462 | 7462 | /** @noinspection UnnecessaryCastingInspection */ |
| 7463 | - return \strip_tags($str, (string) $allowable_tags); |
|
| 7463 | + return \strip_tags($str, (string)$allowable_tags); |
|
| 7464 | 7464 | } |
| 7465 | 7465 | |
| 7466 | 7466 | /** |
@@ -7478,7 +7478,7 @@ discard block |
||
| 7478 | 7478 | return ''; |
| 7479 | 7479 | } |
| 7480 | 7480 | |
| 7481 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
| 7481 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
| 7482 | 7482 | } |
| 7483 | 7483 | |
| 7484 | 7484 | /** |
@@ -7599,7 +7599,7 @@ discard block |
||
| 7599 | 7599 | && |
| 7600 | 7600 | self::$SUPPORT['mbstring'] === false |
| 7601 | 7601 | ) { |
| 7602 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 7602 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 7603 | 7603 | } |
| 7604 | 7604 | |
| 7605 | 7605 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -7621,7 +7621,7 @@ discard block |
||
| 7621 | 7621 | return \stristr($haystack, $needle, $before_needle); |
| 7622 | 7622 | } |
| 7623 | 7623 | |
| 7624 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
| 7624 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
| 7625 | 7625 | |
| 7626 | 7626 | if (!isset($match[1])) { |
| 7627 | 7627 | return false; |
@@ -7631,7 +7631,7 @@ discard block |
||
| 7631 | 7631 | return $match[1]; |
| 7632 | 7632 | } |
| 7633 | 7633 | |
| 7634 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 7634 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 7635 | 7635 | } |
| 7636 | 7636 | |
| 7637 | 7637 | /** |
@@ -7690,7 +7690,7 @@ discard block |
||
| 7690 | 7690 | && |
| 7691 | 7691 | self::$SUPPORT['iconv'] === false |
| 7692 | 7692 | ) { |
| 7693 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 7693 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 7694 | 7694 | } |
| 7695 | 7695 | |
| 7696 | 7696 | // |
@@ -7816,7 +7816,7 @@ discard block |
||
| 7816 | 7816 | */ |
| 7817 | 7817 | public static function strnatcmp(string $str1, string $str2): int |
| 7818 | 7818 | { |
| 7819 | - return $str1 . '' === $str2 . '' ? 0 : \strnatcmp((string) self::strtonatfold($str1), (string) self::strtonatfold($str2)); |
|
| 7819 | + return $str1.'' === $str2.'' ? 0 : \strnatcmp((string)self::strtonatfold($str1), (string)self::strtonatfold($str2)); |
|
| 7820 | 7820 | } |
| 7821 | 7821 | |
| 7822 | 7822 | /** |
@@ -7859,8 +7859,8 @@ discard block |
||
| 7859 | 7859 | */ |
| 7860 | 7860 | public static function strncmp(string $str1, string $str2, int $len): int |
| 7861 | 7861 | { |
| 7862 | - $str1 = (string) self::substr($str1, 0, $len); |
|
| 7863 | - $str2 = (string) self::substr($str2, 0, $len); |
|
| 7862 | + $str1 = (string)self::substr($str1, 0, $len); |
|
| 7863 | + $str2 = (string)self::substr($str2, 0, $len); |
|
| 7864 | 7864 | |
| 7865 | 7865 | return self::strcmp($str1, $str2); |
| 7866 | 7866 | } |
@@ -7881,8 +7881,8 @@ discard block |
||
| 7881 | 7881 | return false; |
| 7882 | 7882 | } |
| 7883 | 7883 | |
| 7884 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
| 7885 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
| 7884 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
| 7885 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
| 7886 | 7886 | } |
| 7887 | 7887 | |
| 7888 | 7888 | return false; |
@@ -7910,10 +7910,10 @@ discard block |
||
| 7910 | 7910 | } |
| 7911 | 7911 | |
| 7912 | 7912 | // iconv and mbstring do not support integer $needle |
| 7913 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 7914 | - $needle = (string) self::chr($needle); |
|
| 7913 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 7914 | + $needle = (string)self::chr($needle); |
|
| 7915 | 7915 | } |
| 7916 | - $needle = (string) $needle; |
|
| 7916 | + $needle = (string)$needle; |
|
| 7917 | 7917 | |
| 7918 | 7918 | if ($needle === '') { |
| 7919 | 7919 | return false; |
@@ -7953,7 +7953,7 @@ discard block |
||
| 7953 | 7953 | && |
| 7954 | 7954 | self::$SUPPORT['mbstring'] === false |
| 7955 | 7955 | ) { |
| 7956 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 7956 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 7957 | 7957 | } |
| 7958 | 7958 | |
| 7959 | 7959 | // |
@@ -8021,7 +8021,7 @@ discard block |
||
| 8021 | 8021 | if ($haystackTmp === false) { |
| 8022 | 8022 | $haystackTmp = ''; |
| 8023 | 8023 | } |
| 8024 | - $haystack = (string) $haystackTmp; |
|
| 8024 | + $haystack = (string)$haystackTmp; |
|
| 8025 | 8025 | |
| 8026 | 8026 | if ($offset < 0) { |
| 8027 | 8027 | $offset = 0; |
@@ -8033,7 +8033,7 @@ discard block |
||
| 8033 | 8033 | } |
| 8034 | 8034 | |
| 8035 | 8035 | if ($pos) { |
| 8036 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 8036 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
| 8037 | 8037 | } |
| 8038 | 8038 | |
| 8039 | 8039 | return $offset + 0; |
@@ -8119,7 +8119,7 @@ discard block |
||
| 8119 | 8119 | && |
| 8120 | 8120 | self::$SUPPORT['mbstring'] === false |
| 8121 | 8121 | ) { |
| 8122 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8122 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8123 | 8123 | } |
| 8124 | 8124 | |
| 8125 | 8125 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -8151,7 +8151,7 @@ discard block |
||
| 8151 | 8151 | if ($needleTmp === false) { |
| 8152 | 8152 | return false; |
| 8153 | 8153 | } |
| 8154 | - $needle = (string) $needleTmp; |
|
| 8154 | + $needle = (string)$needleTmp; |
|
| 8155 | 8155 | |
| 8156 | 8156 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
| 8157 | 8157 | if ($pos === false) { |
@@ -8173,7 +8173,7 @@ discard block |
||
| 8173 | 8173 | if ($needleTmp === false) { |
| 8174 | 8174 | return false; |
| 8175 | 8175 | } |
| 8176 | - $needle = (string) $needleTmp; |
|
| 8176 | + $needle = (string)$needleTmp; |
|
| 8177 | 8177 | |
| 8178 | 8178 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
| 8179 | 8179 | if ($pos === false) { |
@@ -8201,7 +8201,7 @@ discard block |
||
| 8201 | 8201 | } |
| 8202 | 8202 | |
| 8203 | 8203 | $reversed = ''; |
| 8204 | - $i = (int) self::strlen($str); |
|
| 8204 | + $i = (int)self::strlen($str); |
|
| 8205 | 8205 | while ($i--) { |
| 8206 | 8206 | $reversedTmp = self::substr($str, $i, 1); |
| 8207 | 8207 | if ($reversedTmp !== false) { |
@@ -8269,7 +8269,7 @@ discard block |
||
| 8269 | 8269 | if ($needleTmp === false) { |
| 8270 | 8270 | return false; |
| 8271 | 8271 | } |
| 8272 | - $needle = (string) $needleTmp; |
|
| 8272 | + $needle = (string)$needleTmp; |
|
| 8273 | 8273 | |
| 8274 | 8274 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
| 8275 | 8275 | if ($pos === false) { |
@@ -8303,10 +8303,10 @@ discard block |
||
| 8303 | 8303 | } |
| 8304 | 8304 | |
| 8305 | 8305 | // iconv and mbstring do not support integer $needle |
| 8306 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 8307 | - $needle = (string) self::chr($needle); |
|
| 8306 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 8307 | + $needle = (string)self::chr($needle); |
|
| 8308 | 8308 | } |
| 8309 | - $needle = (string) $needle; |
|
| 8309 | + $needle = (string)$needle; |
|
| 8310 | 8310 | |
| 8311 | 8311 | if ($needle === '') { |
| 8312 | 8312 | return false; |
@@ -8343,7 +8343,7 @@ discard block |
||
| 8343 | 8343 | && |
| 8344 | 8344 | self::$SUPPORT['mbstring'] === false |
| 8345 | 8345 | ) { |
| 8346 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8346 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8347 | 8347 | } |
| 8348 | 8348 | |
| 8349 | 8349 | // |
@@ -8450,10 +8450,10 @@ discard block |
||
| 8450 | 8450 | } |
| 8451 | 8451 | |
| 8452 | 8452 | // iconv and mbstring do not support integer $needle |
| 8453 | - if ((int) $needle === $needle && $needle >= 0) { |
|
| 8454 | - $needle = (string) self::chr($needle); |
|
| 8453 | + if ((int)$needle === $needle && $needle >= 0) { |
|
| 8454 | + $needle = (string)self::chr($needle); |
|
| 8455 | 8455 | } |
| 8456 | - $needle = (string) $needle; |
|
| 8456 | + $needle = (string)$needle; |
|
| 8457 | 8457 | |
| 8458 | 8458 | if ($needle === '') { |
| 8459 | 8459 | return false; |
@@ -8490,7 +8490,7 @@ discard block |
||
| 8490 | 8490 | && |
| 8491 | 8491 | self::$SUPPORT['mbstring'] === false |
| 8492 | 8492 | ) { |
| 8493 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8493 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8494 | 8494 | } |
| 8495 | 8495 | |
| 8496 | 8496 | // |
@@ -8550,7 +8550,7 @@ discard block |
||
| 8550 | 8550 | if ($haystackTmp === false) { |
| 8551 | 8551 | $haystackTmp = ''; |
| 8552 | 8552 | } |
| 8553 | - $haystack = (string) $haystackTmp; |
|
| 8553 | + $haystack = (string)$haystackTmp; |
|
| 8554 | 8554 | } |
| 8555 | 8555 | |
| 8556 | 8556 | $pos = self::strrpos_in_byte($haystack, $needle); |
@@ -8563,7 +8563,7 @@ discard block |
||
| 8563 | 8563 | return false; |
| 8564 | 8564 | } |
| 8565 | 8565 | |
| 8566 | - return $offset + (int) self::strlen($strTmp); |
|
| 8566 | + return $offset + (int)self::strlen($strTmp); |
|
| 8567 | 8567 | } |
| 8568 | 8568 | |
| 8569 | 8569 | /** |
@@ -8615,7 +8615,7 @@ discard block |
||
| 8615 | 8615 | public static function strspn(string $str, string $mask, int $offset = 0, int $length = null) |
| 8616 | 8616 | { |
| 8617 | 8617 | if ($offset || $length !== null) { |
| 8618 | - $str = (string) self::substr($str, $offset, $length); |
|
| 8618 | + $str = (string)self::substr($str, $offset, $length); |
|
| 8619 | 8619 | } |
| 8620 | 8620 | |
| 8621 | 8621 | if ($str === '' || $mask === '') { |
@@ -8624,7 +8624,7 @@ discard block |
||
| 8624 | 8624 | |
| 8625 | 8625 | $matches = []; |
| 8626 | 8626 | |
| 8627 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0]) : 0; |
|
| 8627 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0]) : 0; |
|
| 8628 | 8628 | } |
| 8629 | 8629 | |
| 8630 | 8630 | /** |
@@ -8680,7 +8680,7 @@ discard block |
||
| 8680 | 8680 | && |
| 8681 | 8681 | self::$SUPPORT['mbstring'] === false |
| 8682 | 8682 | ) { |
| 8683 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 8683 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 8684 | 8684 | } |
| 8685 | 8685 | |
| 8686 | 8686 | // |
@@ -8718,7 +8718,7 @@ discard block |
||
| 8718 | 8718 | // fallback via vanilla php |
| 8719 | 8719 | // |
| 8720 | 8720 | |
| 8721 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
| 8721 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
| 8722 | 8722 | |
| 8723 | 8723 | if (!isset($match[1])) { |
| 8724 | 8724 | return false; |
@@ -8728,7 +8728,7 @@ discard block |
||
| 8728 | 8728 | return $match[1]; |
| 8729 | 8729 | } |
| 8730 | 8730 | |
| 8731 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
| 8731 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
| 8732 | 8732 | } |
| 8733 | 8733 | |
| 8734 | 8734 | /** |
@@ -8827,7 +8827,7 @@ discard block |
||
| 8827 | 8827 | public static function strtolower($str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
| 8828 | 8828 | { |
| 8829 | 8829 | // init |
| 8830 | - $str = (string) $str; |
|
| 8830 | + $str = (string)$str; |
|
| 8831 | 8831 | |
| 8832 | 8832 | if ($str === '') { |
| 8833 | 8833 | return ''; |
@@ -8854,9 +8854,9 @@ discard block |
||
| 8854 | 8854 | } |
| 8855 | 8855 | |
| 8856 | 8856 | if (self::$SUPPORT['intl'] === true) { |
| 8857 | - $langCode = $lang . '-Lower'; |
|
| 8857 | + $langCode = $lang.'-Lower'; |
|
| 8858 | 8858 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
| 8859 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang, \E_USER_WARNING); |
|
| 8859 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang, \E_USER_WARNING); |
|
| 8860 | 8860 | |
| 8861 | 8861 | $langCode = 'Any-Lower'; |
| 8862 | 8862 | } |
@@ -8865,7 +8865,7 @@ discard block |
||
| 8865 | 8865 | return \transliterator_transliterate($langCode, $str); |
| 8866 | 8866 | } |
| 8867 | 8867 | |
| 8868 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
| 8868 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
| 8869 | 8869 | } |
| 8870 | 8870 | |
| 8871 | 8871 | // always fallback via symfony polyfill |
@@ -8889,7 +8889,7 @@ discard block |
||
| 8889 | 8889 | public static function strtoupper($str, string $encoding = 'UTF-8', bool $cleanUtf8 = false, string $lang = null, bool $tryToKeepStringLength = false): string |
| 8890 | 8890 | { |
| 8891 | 8891 | // init |
| 8892 | - $str = (string) $str; |
|
| 8892 | + $str = (string)$str; |
|
| 8893 | 8893 | |
| 8894 | 8894 | if ($str === '') { |
| 8895 | 8895 | return ''; |
@@ -8916,9 +8916,9 @@ discard block |
||
| 8916 | 8916 | } |
| 8917 | 8917 | |
| 8918 | 8918 | if (self::$SUPPORT['intl'] === true) { |
| 8919 | - $langCode = $lang . '-Upper'; |
|
| 8919 | + $langCode = $lang.'-Upper'; |
|
| 8920 | 8920 | if (!\in_array($langCode, self::$SUPPORT['intl__transliterator_list_ids'], true)) { |
| 8921 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
| 8921 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
| 8922 | 8922 | |
| 8923 | 8923 | $langCode = 'Any-Upper'; |
| 8924 | 8924 | } |
@@ -8927,7 +8927,7 @@ discard block |
||
| 8927 | 8927 | return \transliterator_transliterate($langCode, $str); |
| 8928 | 8928 | } |
| 8929 | 8929 | |
| 8930 | - \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
| 8930 | + \trigger_error('UTF8::strtolower() without intl + PHP >= 5.4 cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
| 8931 | 8931 | } |
| 8932 | 8932 | |
| 8933 | 8933 | // always fallback via symfony polyfill |
@@ -8971,7 +8971,7 @@ discard block |
||
| 8971 | 8971 | |
| 8972 | 8972 | $from = \array_combine($from, $to); |
| 8973 | 8973 | if ($from === false) { |
| 8974 | - 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) . ')'); |
|
| 8974 | + 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).')'); |
|
| 8975 | 8975 | } |
| 8976 | 8976 | } |
| 8977 | 8977 | |
@@ -9028,9 +9028,9 @@ discard block |
||
| 9028 | 9028 | } |
| 9029 | 9029 | |
| 9030 | 9030 | $wide = 0; |
| 9031 | - $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); |
|
| 9031 | + $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); |
|
| 9032 | 9032 | |
| 9033 | - return ($wide << 1) + (int) self::strlen($str, 'UTF-8'); |
|
| 9033 | + return ($wide << 1) + (int)self::strlen($str, 'UTF-8'); |
|
| 9034 | 9034 | } |
| 9035 | 9035 | |
| 9036 | 9036 | /** |
@@ -9126,9 +9126,9 @@ discard block |
||
| 9126 | 9126 | } |
| 9127 | 9127 | |
| 9128 | 9128 | if ($length === null) { |
| 9129 | - $length = (int) $str_length; |
|
| 9129 | + $length = (int)$str_length; |
|
| 9130 | 9130 | } else { |
| 9131 | - $length = (int) $length; |
|
| 9131 | + $length = (int)$length; |
|
| 9132 | 9132 | } |
| 9133 | 9133 | |
| 9134 | 9134 | if ( |
@@ -9136,7 +9136,7 @@ discard block |
||
| 9136 | 9136 | && |
| 9137 | 9137 | self::$SUPPORT['mbstring'] === false |
| 9138 | 9138 | ) { |
| 9139 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9139 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9140 | 9140 | } |
| 9141 | 9141 | |
| 9142 | 9142 | // |
@@ -9215,8 +9215,8 @@ discard block |
||
| 9215 | 9215 | || |
| 9216 | 9216 | $length !== null |
| 9217 | 9217 | ) { |
| 9218 | - $str1 = (string) self::substr($str1, $offset, $length); |
|
| 9219 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1)); |
|
| 9218 | + $str1 = (string)self::substr($str1, $offset, $length); |
|
| 9219 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1)); |
|
| 9220 | 9220 | } |
| 9221 | 9221 | |
| 9222 | 9222 | if ($case_insensitivity === true) { |
@@ -9262,7 +9262,7 @@ discard block |
||
| 9262 | 9262 | if ($lengthTmp === false) { |
| 9263 | 9263 | return false; |
| 9264 | 9264 | } |
| 9265 | - $length = (int) $lengthTmp; |
|
| 9265 | + $length = (int)$lengthTmp; |
|
| 9266 | 9266 | } |
| 9267 | 9267 | |
| 9268 | 9268 | if ( |
@@ -9279,7 +9279,7 @@ discard block |
||
| 9279 | 9279 | return false; |
| 9280 | 9280 | } |
| 9281 | 9281 | |
| 9282 | - $haystack = (string) self::substr($haystack, $offset, $length, $encoding); |
|
| 9282 | + $haystack = (string)self::substr($haystack, $offset, $length, $encoding); |
|
| 9283 | 9283 | } |
| 9284 | 9284 | |
| 9285 | 9285 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
@@ -9302,14 +9302,14 @@ discard block |
||
| 9302 | 9302 | && |
| 9303 | 9303 | self::$SUPPORT['mbstring'] === false |
| 9304 | 9304 | ) { |
| 9305 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
| 9305 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
| 9306 | 9306 | } |
| 9307 | 9307 | |
| 9308 | 9308 | if (self::$SUPPORT['mbstring'] === true) { |
| 9309 | 9309 | return \mb_substr_count($haystack, $needle, $encoding); |
| 9310 | 9310 | } |
| 9311 | 9311 | |
| 9312 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 9312 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
| 9313 | 9313 | |
| 9314 | 9314 | return \count($matches); |
| 9315 | 9315 | } |
@@ -9356,7 +9356,7 @@ discard block |
||
| 9356 | 9356 | if ($lengthTmp === false) { |
| 9357 | 9357 | return false; |
| 9358 | 9358 | } |
| 9359 | - $length = (int) $lengthTmp; |
|
| 9359 | + $length = (int)$lengthTmp; |
|
| 9360 | 9360 | } |
| 9361 | 9361 | |
| 9362 | 9362 | if ( |
@@ -9377,7 +9377,7 @@ discard block |
||
| 9377 | 9377 | if ($haystackTmp === false) { |
| 9378 | 9378 | $haystackTmp = ''; |
| 9379 | 9379 | } |
| 9380 | - $haystack = (string) $haystackTmp; |
|
| 9380 | + $haystack = (string)$haystackTmp; |
|
| 9381 | 9381 | } |
| 9382 | 9382 | |
| 9383 | 9383 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -9413,7 +9413,7 @@ discard block |
||
| 9413 | 9413 | // only a fallback to prevent BC in the api ... |
| 9414 | 9414 | /** @psalm-suppress RedundantConditionGivenDocblockType */ |
| 9415 | 9415 | if ($caseSensitive !== false && $caseSensitive !== true) { |
| 9416 | - $encoding = (string) $caseSensitive; |
|
| 9416 | + $encoding = (string)$caseSensitive; |
|
| 9417 | 9417 | } |
| 9418 | 9418 | |
| 9419 | 9419 | if (!$caseSensitive) { |
@@ -9421,7 +9421,7 @@ discard block |
||
| 9421 | 9421 | $substring = self::strtocasefold($substring, true, false, $encoding, null, false); |
| 9422 | 9422 | } |
| 9423 | 9423 | |
| 9424 | - return (int) self::substr_count($str, $substring, 0, null, $encoding); |
|
| 9424 | + return (int)self::substr_count($str, $substring, 0, null, $encoding); |
|
| 9425 | 9425 | } |
| 9426 | 9426 | |
| 9427 | 9427 | /** |
@@ -9443,7 +9443,7 @@ discard block |
||
| 9443 | 9443 | } |
| 9444 | 9444 | |
| 9445 | 9445 | if (self::str_istarts_with($haystack, $needle) === true) { |
| 9446 | - $haystack = (string) self::substr($haystack, (int) self::strlen($needle)); |
|
| 9446 | + $haystack = (string)self::substr($haystack, (int)self::strlen($needle)); |
|
| 9447 | 9447 | } |
| 9448 | 9448 | |
| 9449 | 9449 | return $haystack; |
@@ -9508,7 +9508,7 @@ discard block |
||
| 9508 | 9508 | } |
| 9509 | 9509 | |
| 9510 | 9510 | if (self::str_iends_with($haystack, $needle) === true) { |
| 9511 | - $haystack = (string) self::substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 9511 | + $haystack = (string)self::substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 9512 | 9512 | } |
| 9513 | 9513 | |
| 9514 | 9514 | return $haystack; |
@@ -9533,7 +9533,7 @@ discard block |
||
| 9533 | 9533 | } |
| 9534 | 9534 | |
| 9535 | 9535 | if (self::str_starts_with($haystack, $needle) === true) { |
| 9536 | - $haystack = (string) self::substr($haystack, (int) self::strlen($needle)); |
|
| 9536 | + $haystack = (string)self::substr($haystack, (int)self::strlen($needle)); |
|
| 9537 | 9537 | } |
| 9538 | 9538 | |
| 9539 | 9539 | return $haystack; |
@@ -9580,7 +9580,7 @@ discard block |
||
| 9580 | 9580 | if (\is_array($offset) === true) { |
| 9581 | 9581 | $offset = \array_slice($offset, 0, $num); |
| 9582 | 9582 | foreach ($offset as &$valueTmp) { |
| 9583 | - $valueTmp = (int) $valueTmp === $valueTmp ? $valueTmp : 0; |
|
| 9583 | + $valueTmp = (int)$valueTmp === $valueTmp ? $valueTmp : 0; |
|
| 9584 | 9584 | } |
| 9585 | 9585 | unset($valueTmp); |
| 9586 | 9586 | } else { |
@@ -9594,7 +9594,7 @@ discard block |
||
| 9594 | 9594 | $length = \array_slice($length, 0, $num); |
| 9595 | 9595 | foreach ($length as &$valueTmpV2) { |
| 9596 | 9596 | if ($valueTmpV2 !== null) { |
| 9597 | - $valueTmpV2 = (int) $valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
| 9597 | + $valueTmpV2 = (int)$valueTmpV2 === $valueTmpV2 ? $valueTmpV2 : $num; |
|
| 9598 | 9598 | } else { |
| 9599 | 9599 | $valueTmpV2 = 0; |
| 9600 | 9600 | } |
@@ -9617,8 +9617,8 @@ discard block |
||
| 9617 | 9617 | } |
| 9618 | 9618 | |
| 9619 | 9619 | // init |
| 9620 | - $str = (string) $str; |
|
| 9621 | - $replacement = (string) $replacement; |
|
| 9620 | + $str = (string)$str; |
|
| 9621 | + $replacement = (string)$replacement; |
|
| 9622 | 9622 | |
| 9623 | 9623 | if (\is_array($length) === true) { |
| 9624 | 9624 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -9634,8 +9634,7 @@ discard block |
||
| 9634 | 9634 | |
| 9635 | 9635 | if (self::is_ascii($str)) { |
| 9636 | 9636 | return ($length === null) ? |
| 9637 | - \substr_replace($str, $replacement, $offset) : |
|
| 9638 | - \substr_replace($str, $replacement, $offset, $length); |
|
| 9637 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
| 9639 | 9638 | } |
| 9640 | 9639 | |
| 9641 | 9640 | if (!isset(self::$SUPPORT['already_checked_via_portable_utf8'])) { |
@@ -9643,16 +9642,16 @@ discard block |
||
| 9643 | 9642 | } |
| 9644 | 9643 | |
| 9645 | 9644 | if (self::$SUPPORT['mbstring'] === true) { |
| 9646 | - $string_length = (int) self::strlen($str, $encoding); |
|
| 9645 | + $string_length = (int)self::strlen($str, $encoding); |
|
| 9647 | 9646 | |
| 9648 | 9647 | if ($offset < 0) { |
| 9649 | - $offset = (int) \max(0, $string_length + $offset); |
|
| 9648 | + $offset = (int)\max(0, $string_length + $offset); |
|
| 9650 | 9649 | } elseif ($offset > $string_length) { |
| 9651 | 9650 | $offset = $string_length; |
| 9652 | 9651 | } |
| 9653 | 9652 | |
| 9654 | 9653 | if ($length !== null && $length < 0) { |
| 9655 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
| 9654 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
| 9656 | 9655 | } elseif ($length === null || $length > $string_length) { |
| 9657 | 9656 | $length = $string_length; |
| 9658 | 9657 | } |
@@ -9663,9 +9662,9 @@ discard block |
||
| 9663 | 9662 | } |
| 9664 | 9663 | |
| 9665 | 9664 | /** @noinspection AdditionOperationOnArraysInspection */ |
| 9666 | - return (string) self::substr($str, 0, $offset, $encoding) . |
|
| 9667 | - $replacement . |
|
| 9668 | - (string) self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
| 9665 | + return (string)self::substr($str, 0, $offset, $encoding). |
|
| 9666 | + $replacement. |
|
| 9667 | + (string)self::substr($str, $offset + $length, $string_length - $offset - $length, $encoding); |
|
| 9669 | 9668 | } |
| 9670 | 9669 | |
| 9671 | 9670 | \preg_match_all('/./us', $str, $smatches); |
@@ -9677,7 +9676,7 @@ discard block |
||
| 9677 | 9676 | // e.g.: non mbstring support + invalid chars |
| 9678 | 9677 | return ''; |
| 9679 | 9678 | } |
| 9680 | - $length = (int) $lengthTmp; |
|
| 9679 | + $length = (int)$lengthTmp; |
|
| 9681 | 9680 | } |
| 9682 | 9681 | |
| 9683 | 9682 | \array_splice($smatches[0], $offset, $length, $rmatches[0]); |
@@ -9704,7 +9703,7 @@ discard block |
||
| 9704 | 9703 | } |
| 9705 | 9704 | |
| 9706 | 9705 | if (self::str_ends_with($haystack, $needle) === true) { |
| 9707 | - $haystack = (string) self::substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
| 9706 | + $haystack = (string)self::substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
| 9708 | 9707 | } |
| 9709 | 9708 | |
| 9710 | 9709 | return $haystack; |
@@ -9735,7 +9734,7 @@ discard block |
||
| 9735 | 9734 | $str = self::clean($str); |
| 9736 | 9735 | } |
| 9737 | 9736 | |
| 9738 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 9737 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
| 9739 | 9738 | } |
| 9740 | 9739 | |
| 9741 | 9740 | /** |
@@ -10030,7 +10029,7 @@ discard block |
||
| 10030 | 10029 | public static function to_boolean($str): bool |
| 10031 | 10030 | { |
| 10032 | 10031 | // init |
| 10033 | - $str = (string) $str; |
|
| 10032 | + $str = (string)$str; |
|
| 10034 | 10033 | |
| 10035 | 10034 | if ($str === '') { |
| 10036 | 10035 | return false; |
@@ -10056,10 +10055,10 @@ discard block |
||
| 10056 | 10055 | |
| 10057 | 10056 | /** @noinspection CallableParameterUseCaseInTypeContextInspection */ |
| 10058 | 10057 | if (\is_numeric($str)) { |
| 10059 | - return ((float) $str + 0) > 0; |
|
| 10058 | + return ((float)$str + 0) > 0; |
|
| 10060 | 10059 | } |
| 10061 | 10060 | |
| 10062 | - return (bool) self::trim($str); |
|
| 10061 | + return (bool)self::trim($str); |
|
| 10063 | 10062 | } |
| 10064 | 10063 | |
| 10065 | 10064 | /** |
@@ -10080,11 +10079,11 @@ discard block |
||
| 10080 | 10079 | |
| 10081 | 10080 | $fallback_char_escaped = \preg_quote($fallback_char, '/'); |
| 10082 | 10081 | |
| 10083 | - $string = (string) \preg_replace( |
|
| 10082 | + $string = (string)\preg_replace( |
|
| 10084 | 10083 | [ |
| 10085 | - '/[^' . $fallback_char_escaped . '\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
| 10086 | - '/[\s]+/', // 2) convert spaces to $fallback_char |
|
| 10087 | - '/[' . $fallback_char_escaped . ']+/', // 3) remove double $fallback_char's |
|
| 10084 | + '/[^'.$fallback_char_escaped.'\.\-a-zA-Z0-9\s]/', // 1) remove un-needed chars |
|
| 10085 | + '/[\s]+/', // 2) convert spaces to $fallback_char |
|
| 10086 | + '/['.$fallback_char_escaped.']+/', // 3) remove double $fallback_char's |
|
| 10088 | 10087 | ], |
| 10089 | 10088 | [ |
| 10090 | 10089 | '', |
@@ -10115,7 +10114,7 @@ discard block |
||
| 10115 | 10114 | return $str; |
| 10116 | 10115 | } |
| 10117 | 10116 | |
| 10118 | - $str = (string) $str; |
|
| 10117 | + $str = (string)$str; |
|
| 10119 | 10118 | if ($str === '') { |
| 10120 | 10119 | return ''; |
| 10121 | 10120 | } |
@@ -10162,7 +10161,7 @@ discard block |
||
| 10162 | 10161 | return $str; |
| 10163 | 10162 | } |
| 10164 | 10163 | |
| 10165 | - $str = (string) $str; |
|
| 10164 | + $str = (string)$str; |
|
| 10166 | 10165 | if ($str === '') { |
| 10167 | 10166 | return $str; |
| 10168 | 10167 | } |
@@ -10184,7 +10183,7 @@ discard block |
||
| 10184 | 10183 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
| 10185 | 10184 | |
| 10186 | 10185 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 10187 | - $buf .= $c1 . $c2; |
|
| 10186 | + $buf .= $c1.$c2; |
|
| 10188 | 10187 | ++$i; |
| 10189 | 10188 | } else { // not valid UTF8 - convert it |
| 10190 | 10189 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10195,7 +10194,7 @@ discard block |
||
| 10195 | 10194 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
| 10196 | 10195 | |
| 10197 | 10196 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 10198 | - $buf .= $c1 . $c2 . $c3; |
|
| 10197 | + $buf .= $c1.$c2.$c3; |
|
| 10199 | 10198 | $i += 2; |
| 10200 | 10199 | } else { // not valid UTF8 - convert it |
| 10201 | 10200 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10207,7 +10206,7 @@ discard block |
||
| 10207 | 10206 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
| 10208 | 10207 | |
| 10209 | 10208 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
| 10210 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
| 10209 | + $buf .= $c1.$c2.$c3.$c4; |
|
| 10211 | 10210 | $i += 3; |
| 10212 | 10211 | } else { // not valid UTF8 - convert it |
| 10213 | 10212 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -10231,7 +10230,7 @@ discard block |
||
| 10231 | 10230 | * |
| 10232 | 10231 | * @return string |
| 10233 | 10232 | */ |
| 10234 | - static function (array $match): string { |
|
| 10233 | + static function(array $match): string { |
|
| 10235 | 10234 | // always fallback via symfony polyfill |
| 10236 | 10235 | return \mb_convert_encoding(\pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); |
| 10237 | 10236 | }, |
@@ -10299,17 +10298,17 @@ discard block |
||
| 10299 | 10298 | $str = self::clean($str); |
| 10300 | 10299 | } |
| 10301 | 10300 | |
| 10302 | - $strPartTwo = (string) self::substr($str, 1, null, $encoding); |
|
| 10301 | + $strPartTwo = (string)self::substr($str, 1, null, $encoding); |
|
| 10303 | 10302 | |
| 10304 | 10303 | $strPartOne = self::strtoupper( |
| 10305 | - (string) self::substr($str, 0, 1, $encoding), |
|
| 10304 | + (string)self::substr($str, 0, 1, $encoding), |
|
| 10306 | 10305 | $encoding, |
| 10307 | 10306 | $cleanUtf8, |
| 10308 | 10307 | $lang, |
| 10309 | 10308 | $tryToKeepStringLength |
| 10310 | 10309 | ); |
| 10311 | 10310 | |
| 10312 | - return $strPartOne . $strPartTwo; |
|
| 10311 | + return $strPartOne.$strPartTwo; |
|
| 10313 | 10312 | } |
| 10314 | 10313 | |
| 10315 | 10314 | /** |
@@ -10355,7 +10354,7 @@ discard block |
||
| 10355 | 10354 | $str = self::clean($str); |
| 10356 | 10355 | } |
| 10357 | 10356 | |
| 10358 | - $usePhpDefaultFunctions = !(bool) ($charlist . \implode('', $exceptions)); |
|
| 10357 | + $usePhpDefaultFunctions = !(bool)($charlist.\implode('', $exceptions)); |
|
| 10359 | 10358 | |
| 10360 | 10359 | if ( |
| 10361 | 10360 | $usePhpDefaultFunctions === true |
@@ -10412,7 +10411,7 @@ discard block |
||
| 10412 | 10411 | |
| 10413 | 10412 | $pattern = '/%u([0-9a-f]{3,4})/i'; |
| 10414 | 10413 | if (\preg_match($pattern, $str)) { |
| 10415 | - $str = (string) \preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
| 10414 | + $str = (string)\preg_replace($pattern, '&#x\\1;', \urldecode($str)); |
|
| 10416 | 10415 | } |
| 10417 | 10416 | |
| 10418 | 10417 | $flags = \ENT_QUOTES | \ENT_HTML5; |
@@ -10756,7 +10755,7 @@ discard block |
||
| 10756 | 10755 | if ( |
| 10757 | 10756 | $keepUtf8Chars === true |
| 10758 | 10757 | && |
| 10759 | - self::strlen($return) >= (int) self::strlen($str_backup) |
|
| 10758 | + self::strlen($return) >= (int)self::strlen($str_backup) |
|
| 10760 | 10759 | ) { |
| 10761 | 10760 | return $str_backup; |
| 10762 | 10761 | } |
@@ -10854,17 +10853,17 @@ discard block |
||
| 10854 | 10853 | return ''; |
| 10855 | 10854 | } |
| 10856 | 10855 | |
| 10857 | - \preg_match('/^\s*+(?:\S++\s*+){1,' . $limit . '}/u', $str, $matches); |
|
| 10856 | + \preg_match('/^\s*+(?:\S++\s*+){1,'.$limit.'}/u', $str, $matches); |
|
| 10858 | 10857 | |
| 10859 | 10858 | if ( |
| 10860 | 10859 | !isset($matches[0]) |
| 10861 | 10860 | || |
| 10862 | - self::strlen($str) === (int) self::strlen($matches[0]) |
|
| 10861 | + self::strlen($str) === (int)self::strlen($matches[0]) |
|
| 10863 | 10862 | ) { |
| 10864 | 10863 | return $str; |
| 10865 | 10864 | } |
| 10866 | 10865 | |
| 10867 | - return self::rtrim($matches[0]) . $strAddOn; |
|
| 10866 | + return self::rtrim($matches[0]).$strAddOn; |
|
| 10868 | 10867 | } |
| 10869 | 10868 | |
| 10870 | 10869 | /** |
@@ -10930,7 +10929,7 @@ discard block |
||
| 10930 | 10929 | $strReturn .= $break; |
| 10931 | 10930 | } |
| 10932 | 10931 | |
| 10933 | - return $strReturn . \implode('', $chars); |
|
| 10932 | + return $strReturn.\implode('', $chars); |
|
| 10934 | 10933 | } |
| 10935 | 10934 | |
| 10936 | 10935 | /** |
@@ -10943,7 +10942,7 @@ discard block |
||
| 10943 | 10942 | */ |
| 10944 | 10943 | public static function wordwrap_per_line(string $str, int $limit): string |
| 10945 | 10944 | { |
| 10946 | - $strings = (array) \preg_split('/\\r\\n|\\r|\\n/', $str); |
|
| 10945 | + $strings = (array)\preg_split('/\\r\\n|\\r|\\n/', $str); |
|
| 10947 | 10946 | |
| 10948 | 10947 | $string = ''; |
| 10949 | 10948 | foreach ($strings as &$value) { |
@@ -10982,7 +10981,7 @@ discard block |
||
| 10982 | 10981 | */ |
| 10983 | 10982 | private static function apply_padding(string $str, int $left = 0, int $right = 0, string $padStr = ' ', string $encoding = 'UTF-8'): string |
| 10984 | 10983 | { |
| 10985 | - $strlen = (int) self::strlen($str, $encoding); |
|
| 10984 | + $strlen = (int)self::strlen($str, $encoding); |
|
| 10986 | 10985 | |
| 10987 | 10986 | if ($left && $right) { |
| 10988 | 10987 | $length = ($left + $right) + $strlen; |
@@ -11014,13 +11013,13 @@ discard block |
||
| 11014 | 11013 | $lower = self::$COMMON_CASE_FOLD['lower']; |
| 11015 | 11014 | |
| 11016 | 11015 | if ($useLower === true) { |
| 11017 | - $str = (string) \str_replace( |
|
| 11016 | + $str = (string)\str_replace( |
|
| 11018 | 11017 | $upper, |
| 11019 | 11018 | $lower, |
| 11020 | 11019 | $str |
| 11021 | 11020 | ); |
| 11022 | 11021 | } else { |
| 11023 | - $str = (string) \str_replace( |
|
| 11022 | + $str = (string)\str_replace( |
|
| 11024 | 11023 | $lower, |
| 11025 | 11024 | $upper, |
| 11026 | 11025 | $str |
@@ -11034,9 +11033,9 @@ discard block |
||
| 11034 | 11033 | } |
| 11035 | 11034 | |
| 11036 | 11035 | if ($useLower === true) { |
| 11037 | - $str = (string) \str_replace($FULL_CASE_FOLD[0], $FULL_CASE_FOLD[1], $str); |
|
| 11036 | + $str = (string)\str_replace($FULL_CASE_FOLD[0], $FULL_CASE_FOLD[1], $str); |
|
| 11038 | 11037 | } else { |
| 11039 | - $str = (string) \str_replace($FULL_CASE_FOLD[1], $FULL_CASE_FOLD[0], $str); |
|
| 11038 | + $str = (string)\str_replace($FULL_CASE_FOLD[1], $FULL_CASE_FOLD[0], $str); |
|
| 11040 | 11039 | } |
| 11041 | 11040 | } |
| 11042 | 11041 | |
@@ -11054,7 +11053,7 @@ discard block |
||
| 11054 | 11053 | { |
| 11055 | 11054 | /** @noinspection PhpIncludeInspection */ |
| 11056 | 11055 | /** @psalm-suppress UnresolvableInclude */ |
| 11057 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
| 11056 | + return include __DIR__.'/data/'.$file.'.php'; |
|
| 11058 | 11057 | } |
| 11059 | 11058 | |
| 11060 | 11059 | /** |
@@ -11066,7 +11065,7 @@ discard block |
||
| 11066 | 11065 | */ |
| 11067 | 11066 | private static function getDataIfExists(string $file) |
| 11068 | 11067 | { |
| 11069 | - $file = __DIR__ . '/data/' . $file . '.php'; |
|
| 11068 | + $file = __DIR__.'/data/'.$file.'.php'; |
|
| 11070 | 11069 | if (\file_exists($file)) { |
| 11071 | 11070 | /** @noinspection PhpIncludeInspection */ |
| 11072 | 11071 | return include $file; |
@@ -11090,7 +11089,7 @@ discard block |
||
| 11090 | 11089 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
| 11091 | 11090 | return \defined('MB_OVERLOAD_STRING') |
| 11092 | 11091 | && |
| 11093 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 11092 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
| 11094 | 11093 | } |
| 11095 | 11094 | |
| 11096 | 11095 | /** |
@@ -11140,7 +11139,7 @@ discard block |
||
| 11140 | 11139 | { |
| 11141 | 11140 | static $RX_CLASSS_CACHE = []; |
| 11142 | 11141 | |
| 11143 | - $cacheKey = $s . $class; |
|
| 11142 | + $cacheKey = $s.$class; |
|
| 11144 | 11143 | |
| 11145 | 11144 | if (isset($RX_CLASSS_CACHE[$cacheKey])) { |
| 11146 | 11145 | return $RX_CLASSS_CACHE[$cacheKey]; |
@@ -11151,7 +11150,7 @@ discard block |
||
| 11151 | 11150 | /** @noinspection SuspiciousLoopInspection */ |
| 11152 | 11151 | foreach (self::str_split($s) as &$s) { |
| 11153 | 11152 | if ($s === '-') { |
| 11154 | - $class[0] = '-' . $class[0]; |
|
| 11153 | + $class[0] = '-'.$class[0]; |
|
| 11155 | 11154 | } elseif (!isset($s[2])) { |
| 11156 | 11155 | $class[0] .= \preg_quote($s, '/'); |
| 11157 | 11156 | } elseif (self::strlen($s) === 1) { |
@@ -11163,13 +11162,13 @@ discard block |
||
| 11163 | 11162 | unset($s); |
| 11164 | 11163 | |
| 11165 | 11164 | if ($class[0]) { |
| 11166 | - $class[0] = '[' . $class[0] . ']'; |
|
| 11165 | + $class[0] = '['.$class[0].']'; |
|
| 11167 | 11166 | } |
| 11168 | 11167 | |
| 11169 | 11168 | if (\count($class) === 1) { |
| 11170 | 11169 | $return = $class[0]; |
| 11171 | 11170 | } else { |
| 11172 | - $return = '(?:' . \implode('|', $class) . ')'; |
|
| 11171 | + $return = '(?:'.\implode('|', $class).')'; |
|
| 11173 | 11172 | } |
| 11174 | 11173 | |
| 11175 | 11174 | $RX_CLASSS_CACHE[$cacheKey] = $return; |
@@ -11308,8 +11307,8 @@ discard block |
||
| 11308 | 11307 | $buf .= self::$WIN1252_TO_UTF8[$ordC1]; |
| 11309 | 11308 | } else { |
| 11310 | 11309 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
| 11311 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
| 11312 | - $buf .= $cc1 . $cc2; |
|
| 11310 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
| 11311 | + $buf .= $cc1.$cc2; |
|
| 11313 | 11312 | } |
| 11314 | 11313 | |
| 11315 | 11314 | return $buf; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
| 73 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $uriOrig = $uri; |
@@ -87,27 +87,27 @@ discard block |
||
| 87 | 87 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
| 88 | 88 | // |
| 89 | 89 | |
| 90 | - $uri = (string) \preg_replace_callback( |
|
| 90 | + $uri = (string)\preg_replace_callback( |
|
| 91 | 91 | '/[\x80-\xFF]+/', |
| 92 | 92 | /** |
| 93 | 93 | * @param array $m |
| 94 | 94 | * |
| 95 | 95 | * @return string |
| 96 | 96 | */ |
| 97 | - static function (array $m): string { |
|
| 97 | + static function(array $m): string { |
|
| 98 | 98 | return \rawurlencode($m[0]); |
| 99 | 99 | }, |
| 100 | 100 | $uri |
| 101 | 101 | ); |
| 102 | 102 | |
| 103 | - $uri = (string) \preg_replace_callback( |
|
| 103 | + $uri = (string)\preg_replace_callback( |
|
| 104 | 104 | '/(?:%[89A-F][0-9A-F])+/i', |
| 105 | 105 | /** |
| 106 | 106 | * @param array $m |
| 107 | 107 | * |
| 108 | 108 | * @return string |
| 109 | 109 | */ |
| 110 | - static function (array $m): string { |
|
| 110 | + static function(array $m): string { |
|
| 111 | 111 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
| 112 | 112 | }, |
| 113 | 113 | $uri |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | ) { |
| 123 | 123 | // Use ob_start() to buffer content and avoid problem of headers already sent... |
| 124 | 124 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
| 125 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
| 126 | - \header('Location: ' . $uri); |
|
| 125 | + \header($severProtocol.' 301 Moved Permanently'); |
|
| 126 | + \header('Location: '.$uri); |
|
| 127 | 127 | exit(); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | return false; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $length = (int) $length; |
|
| 163 | + $length = (int)$length; |
|
| 164 | 164 | |
| 165 | 165 | if ($length <= 0) { |
| 166 | 166 | return false; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | { |
| 192 | 192 | static $_IS_PHP; |
| 193 | 193 | |
| 194 | - $version = (string) $version; |
|
| 194 | + $version = (string)$version; |
|
| 195 | 195 | |
| 196 | 196 | if (!isset($_IS_PHP[$version])) { |
| 197 | 197 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |