@@ -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 => "\xc3\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 => "\xc3\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 | ]; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | return false; |
84 | 84 | } |
85 | 85 | |
86 | - $uri = (string) $_SERVER['REQUEST_URI']; |
|
86 | + $uri = (string)$_SERVER['REQUEST_URI']; |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | $uriOrig = $uri; |
@@ -100,27 +100,27 @@ discard block |
||
100 | 100 | // When not, assumes Windows-1252 and redirects to the corresponding UTF-8 encoded URL |
101 | 101 | // |
102 | 102 | |
103 | - $uri = (string) \preg_replace_callback( |
|
103 | + $uri = (string)\preg_replace_callback( |
|
104 | 104 | '/[\x80-\xFF]+/', |
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($m[0]); |
112 | 112 | }, |
113 | 113 | $uri |
114 | 114 | ); |
115 | 115 | |
116 | - $uri = (string) \preg_replace_callback( |
|
116 | + $uri = (string)\preg_replace_callback( |
|
117 | 117 | '/(?:%[89A-F][0-9A-F])+/i', |
118 | 118 | /** |
119 | 119 | * @param array $m |
120 | 120 | * |
121 | 121 | * @return string |
122 | 122 | */ |
123 | - static function (array $m): string { |
|
123 | + static function(array $m): string { |
|
124 | 124 | return \rawurlencode(UTF8::rawurldecode($m[0])); |
125 | 125 | }, |
126 | 126 | $uri |
@@ -134,19 +134,19 @@ discard block |
||
134 | 134 | \headers_sent() === false |
135 | 135 | ) { |
136 | 136 | $severProtocol = ($_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.1'); |
137 | - \header($severProtocol . ' 301 Moved Permanently'); |
|
137 | + \header($severProtocol.' 301 Moved Permanently'); |
|
138 | 138 | |
139 | 139 | if (\strncmp($uri, '/', 1) === 0) { |
140 | - \header('Location: /' . \ltrim($uri, '/')); |
|
140 | + \header('Location: /'.\ltrim($uri, '/')); |
|
141 | 141 | } else { |
142 | - \header('Location: ' . $uri); |
|
142 | + \header('Location: '.$uri); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | exit(); |
146 | 146 | } |
147 | 147 | |
148 | 148 | if (\strncmp($uri, '/', 1) === 0) { |
149 | - $uri = '/' . \ltrim($uri, '/'); |
|
149 | + $uri = '/'.\ltrim($uri, '/'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | return $uri; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | return false; |
190 | 190 | } |
191 | 191 | |
192 | - $length = (int) $length; |
|
192 | + $length = (int)$length; |
|
193 | 193 | |
194 | 194 | if ($length <= 0) { |
195 | 195 | return false; |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | static $_IS_PHP; |
231 | 231 | |
232 | - $version = (string) $version; |
|
232 | + $version = (string)$version; |
|
233 | 233 | |
234 | 234 | if (!isset($_IS_PHP[$version])) { |
235 | 235 | $_IS_PHP[$version] = \version_compare(\PHP_VERSION, $version, '>='); |
@@ -629,22 +629,22 @@ discard block |
||
629 | 629 | * @psalm-suppress PossiblyNullArrayAccess |
630 | 630 | */ |
631 | 631 | $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
632 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
632 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
633 | 633 | } elseif ($code_point <= 0xFFFF) { |
634 | 634 | /** |
635 | 635 | * @psalm-suppress PossiblyNullArrayAccess |
636 | 636 | */ |
637 | 637 | $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
638 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
639 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
638 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
639 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
640 | 640 | } else { |
641 | 641 | /** |
642 | 642 | * @psalm-suppress PossiblyNullArrayAccess |
643 | 643 | */ |
644 | 644 | $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
645 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
646 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
647 | - self::$CHR[($code_point & 0x3F) + 0x80]; |
|
645 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
646 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
647 | + self::$CHR[($code_point & 0x3F) + 0x80]; |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | if ($encoding !== 'UTF-8') { |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | $asciiOffset = 0x41; |
1132 | 1132 | |
1133 | 1133 | return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
1134 | - (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
|
1134 | + (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
|
1135 | 1135 | } |
1136 | 1136 | |
1137 | 1137 | /** |
@@ -2484,10 +2484,10 @@ discard block |
||
2484 | 2484 | } |
2485 | 2485 | |
2486 | 2486 | $unique_helper = $rand_int . |
2487 | - \session_id() . |
|
2488 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2489 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2490 | - $extra_entropy; |
|
2487 | + \session_id() . |
|
2488 | + ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2489 | + ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2490 | + $extra_entropy; |
|
2491 | 2491 | |
2492 | 2492 | $unique_string = \uniqid($unique_helper, true); |
2493 | 2493 | |
@@ -6346,8 +6346,8 @@ discard block |
||
6346 | 6346 | |
6347 | 6347 | /** @noinspection UnnecessaryCastingInspection */ |
6348 | 6348 | return (string) \mb_substr($str, 0, $index) . |
6349 | - $substring . |
|
6350 | - (string) \mb_substr($str, $index, $len); |
|
6349 | + $substring . |
|
6350 | + (string) \mb_substr($str, $index, $len); |
|
6351 | 6351 | } |
6352 | 6352 | |
6353 | 6353 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -6358,8 +6358,8 @@ discard block |
||
6358 | 6358 | } |
6359 | 6359 | |
6360 | 6360 | return ((string) self::substr($str, 0, $index, $encoding)) . |
6361 | - $substring . |
|
6362 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6361 | + $substring . |
|
6362 | + ((string) self::substr($str, $index, $len, $encoding)); |
|
6363 | 6363 | } |
6364 | 6364 | |
6365 | 6365 | /** |
@@ -8532,11 +8532,11 @@ discard block |
||
8532 | 8532 | if ($use_mb_functions) { |
8533 | 8533 | if ($encoding === 'UTF-8') { |
8534 | 8534 | return \mb_strtoupper(\mb_substr($match[0], 0, 1)) |
8535 | - . \mb_strtolower(\mb_substr($match[0], 1)); |
|
8535 | + . \mb_strtolower(\mb_substr($match[0], 1)); |
|
8536 | 8536 | } |
8537 | 8537 | |
8538 | 8538 | return \mb_strtoupper(\mb_substr($match[0], 0, 1, $encoding), $encoding) |
8539 | - . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
8539 | + . \mb_strtolower(\mb_substr($match[0], 1, null, $encoding), $encoding); |
|
8540 | 8540 | } |
8541 | 8541 | |
8542 | 8542 | return self::ucfirst( |
@@ -8938,13 +8938,13 @@ discard block |
||
8938 | 8938 | } |
8939 | 8939 | |
8940 | 8940 | return ( |
8941 | - (string) self::substr( |
|
8942 | - $str, |
|
8943 | - 0, |
|
8944 | - $length, |
|
8945 | - $encoding |
|
8946 | - ) |
|
8947 | - ) . $substring; |
|
8941 | + (string) self::substr( |
|
8942 | + $str, |
|
8943 | + 0, |
|
8944 | + $length, |
|
8945 | + $encoding |
|
8946 | + ) |
|
8947 | + ) . $substring; |
|
8948 | 8948 | } |
8949 | 8949 | |
8950 | 8950 | /** |
@@ -11979,8 +11979,8 @@ discard block |
||
11979 | 11979 | |
11980 | 11980 | /** @noinspection AdditionOperationOnArraysInspection */ |
11981 | 11981 | return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
11982 | - $replacement . |
|
11983 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11982 | + $replacement . |
|
11983 | + ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
11984 | 11984 | } |
11985 | 11985 | |
11986 | 11986 | // |
@@ -271,10 +271,10 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | if ($encoding === 'UTF-8') { |
274 | - return (string) \mb_substr($str, $pos, 1); |
|
274 | + return (string)\mb_substr($str, $pos, 1); |
|
275 | 275 | } |
276 | 276 | |
277 | - return (string) self::substr($str, $pos, 1, $encoding); |
|
277 | + return (string)self::substr($str, $pos, 1, $encoding); |
|
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | public static function add_bom_to_string(string $str): string |
295 | 295 | { |
296 | 296 | if (!self::string_has_bom($str)) { |
297 | - $str = self::bom() . $str; |
|
297 | + $str = self::bom().$str; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | return $str; |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | $return = []; |
330 | 330 | foreach ($array as $key => &$value) { |
331 | 331 | $key = $case === \CASE_LOWER |
332 | - ? self::strtolower((string) $key, $encoding) |
|
333 | - : self::strtoupper((string) $key, $encoding); |
|
332 | + ? self::strtolower((string)$key, $encoding) |
|
333 | + : self::strtoupper((string)$key, $encoding); |
|
334 | 334 | |
335 | 335 | $return[$key] = $value; |
336 | 336 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | return ''; |
367 | 367 | } |
368 | 368 | |
369 | - $substr_index = $start_position + (int) \mb_strlen($start); |
|
369 | + $substr_index = $start_position + (int)\mb_strlen($start); |
|
370 | 370 | $end_position = \mb_strpos($str, $end, $substr_index); |
371 | 371 | if ( |
372 | 372 | $end_position === false |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | return ''; |
377 | 377 | } |
378 | 378 | |
379 | - return (string) \mb_substr($str, $substr_index, $end_position - $substr_index); |
|
379 | + return (string)\mb_substr($str, $substr_index, $end_position - $substr_index); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | return ''; |
387 | 387 | } |
388 | 388 | |
389 | - $substr_index = $start_position + (int) self::strlen($start, $encoding); |
|
389 | + $substr_index = $start_position + (int)self::strlen($start, $encoding); |
|
390 | 390 | $end_position = self::strpos($str, $end, $substr_index, $encoding); |
391 | 391 | if ( |
392 | 392 | $end_position === false |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | return ''; |
397 | 397 | } |
398 | 398 | |
399 | - return (string) self::substr( |
|
399 | + return (string)self::substr( |
|
400 | 400 | $str, |
401 | 401 | $substr_index, |
402 | 402 | $end_position - $substr_index, |
@@ -480,10 +480,10 @@ discard block |
||
480 | 480 | public static function char_at(string $str, int $index, string $encoding = 'UTF-8'): string |
481 | 481 | { |
482 | 482 | if ($encoding === 'UTF-8') { |
483 | - return (string) \mb_substr($str, $index, 1); |
|
483 | + return (string)\mb_substr($str, $index, 1); |
|
484 | 484 | } |
485 | 485 | |
486 | - return (string) self::substr($str, $index, 1, $encoding); |
|
486 | + return (string)self::substr($str, $index, 1, $encoding); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | /** |
@@ -601,14 +601,14 @@ discard block |
||
601 | 601 | /** |
602 | 602 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
603 | 603 | */ |
604 | - \trigger_error('UTF8::chr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
604 | + \trigger_error('UTF8::chr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
605 | 605 | } |
606 | 606 | |
607 | 607 | if (!\is_int($code_point) || $code_point <= 0) { |
608 | 608 | return null; |
609 | 609 | } |
610 | 610 | |
611 | - $cache_key = $code_point . '_' . $encoding; |
|
611 | + $cache_key = $code_point.'_'.$encoding; |
|
612 | 612 | if (isset($CHAR_CACHE[$cache_key])) { |
613 | 613 | return $CHAR_CACHE[$cache_key]; |
614 | 614 | } |
@@ -654,27 +654,27 @@ discard block |
||
654 | 654 | self::$CHR = self::getData('chr'); |
655 | 655 | } |
656 | 656 | |
657 | - $code_point = (int) $code_point; |
|
657 | + $code_point = (int)$code_point; |
|
658 | 658 | if ($code_point <= 0x7FF) { |
659 | 659 | /** |
660 | 660 | * @psalm-suppress PossiblyNullArrayAccess |
661 | 661 | */ |
662 | - $chr = self::$CHR[($code_point >> 6) + 0xC0] . |
|
662 | + $chr = self::$CHR[($code_point >> 6) + 0xC0]. |
|
663 | 663 | self::$CHR[($code_point & 0x3F) + 0x80]; |
664 | 664 | } elseif ($code_point <= 0xFFFF) { |
665 | 665 | /** |
666 | 666 | * @psalm-suppress PossiblyNullArrayAccess |
667 | 667 | */ |
668 | - $chr = self::$CHR[($code_point >> 12) + 0xE0] . |
|
669 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
668 | + $chr = self::$CHR[($code_point >> 12) + 0xE0]. |
|
669 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
670 | 670 | self::$CHR[($code_point & 0x3F) + 0x80]; |
671 | 671 | } else { |
672 | 672 | /** |
673 | 673 | * @psalm-suppress PossiblyNullArrayAccess |
674 | 674 | */ |
675 | - $chr = self::$CHR[($code_point >> 18) + 0xF0] . |
|
676 | - self::$CHR[(($code_point >> 12) & 0x3F) + 0x80] . |
|
677 | - self::$CHR[(($code_point >> 6) & 0x3F) + 0x80] . |
|
675 | + $chr = self::$CHR[($code_point >> 18) + 0xF0]. |
|
676 | + self::$CHR[(($code_point >> 12) & 0x3F) + 0x80]. |
|
677 | + self::$CHR[(($code_point >> 6) & 0x3F) + 0x80]. |
|
678 | 678 | self::$CHR[($code_point & 0x3F) + 0x80]; |
679 | 679 | } |
680 | 680 | |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | |
732 | 732 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
733 | 733 | return \array_map( |
734 | - static function (string $data): int { |
|
734 | + static function(string $data): int { |
|
735 | 735 | // "mb_" is available if overload is used, so use it ... |
736 | 736 | return \mb_strlen($data, 'CP850'); // 8-BIT |
737 | 737 | }, |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | $char = ''; |
819 | 819 | } |
820 | 820 | |
821 | - return self::int_to_hex(self::ord((string) $char), $prefix); |
|
821 | + return self::int_to_hex(self::ord((string)$char), $prefix); |
|
822 | 822 | } |
823 | 823 | |
824 | 824 | /** |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | | ( [\xC0-\xFF] ) # invalid byte in range 11000000 - 11111111 |
916 | 916 | /x'; |
917 | 917 | /** @noinspection NotOptimalRegularExpressionsInspection */ |
918 | - $str = (string) \preg_replace($regex, '$1', $str); |
|
918 | + $str = (string)\preg_replace($regex, '$1', $str); |
|
919 | 919 | |
920 | 920 | if ($replace_diamond_question_mark) { |
921 | 921 | $str = self::replace_diamond_question_mark($str); |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | public static function cleanup($str): string |
955 | 955 | { |
956 | 956 | // init |
957 | - $str = (string) $str; |
|
957 | + $str = (string)$str; |
|
958 | 958 | |
959 | 959 | if ($str === '') { |
960 | 960 | return ''; |
@@ -1056,7 +1056,7 @@ discard block |
||
1056 | 1056 | { |
1057 | 1057 | if (self::$SUPPORT['mbstring'] === true) { |
1058 | 1058 | /** @noinspection PhpComposerExtensionStubsInspection */ |
1059 | - return \trim((string) \mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1059 | + return \trim((string)\mb_ereg_replace('[[:space:]]+', ' ', $str)); |
|
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | return \trim(self::regex_replace($str, '[[:space:]]+', ' ')); |
@@ -1161,9 +1161,9 @@ discard block |
||
1161 | 1161 | // - 0-9 (U+0061 - U+007A) |
1162 | 1162 | // - ISO 10646 characters U+00A1 and higher |
1163 | 1163 | // We strip out any character not in the above list. |
1164 | - $str = (string) \preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
1164 | + $str = (string)\preg_replace('/[^\x{002D}\x{0030}-\x{0039}\x{0041}-\x{005A}\x{005F}\x{0061}-\x{007A}\x{00A1}-\x{FFFF}]/u', '', $str); |
|
1165 | 1165 | // Identifiers cannot start with a digit, two hyphens, or a hyphen followed by a digit. |
1166 | - $str = (string) \preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1166 | + $str = (string)\preg_replace(['/^[0-9]/', '/^(-[0-9])|^(--)/'], ['_', '__'], $str); |
|
1167 | 1167 | |
1168 | 1168 | return \trim($str, '-'); |
1169 | 1169 | } |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | */ |
1180 | 1180 | public static function css_stripe_media_queries(string $str): string |
1181 | 1181 | { |
1182 | - return (string) \preg_replace( |
|
1182 | + return (string)\preg_replace( |
|
1183 | 1183 | '#@media\\s+(?:only\\s)?(?:[\\s{(]|screen|all)\\s?[^{]+{.*}\\s*}\\s*#isumU', |
1184 | 1184 | '', |
1185 | 1185 | $str |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | */ |
1219 | 1219 | public static function decimal_to_chr($int): string |
1220 | 1220 | { |
1221 | - return self::html_entity_decode('&#' . $int . ';', \ENT_QUOTES | \ENT_HTML5); |
|
1221 | + return self::html_entity_decode('&#'.$int.';', \ENT_QUOTES | \ENT_HTML5); |
|
1222 | 1222 | } |
1223 | 1223 | |
1224 | 1224 | /** |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | $flagOffset = 0x1F1E6; |
1269 | 1269 | $asciiOffset = 0x41; |
1270 | 1270 | |
1271 | - return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? '') . |
|
1271 | + return (self::chr((self::ord($country_code_iso_3166_1[0]) - $asciiOffset + $flagOffset)) ?? ''). |
|
1272 | 1272 | (self::chr((self::ord($country_code_iso_3166_1[1]) - $asciiOffset + $flagOffset)) ?? ''); |
1273 | 1273 | } |
1274 | 1274 | |
@@ -1299,16 +1299,16 @@ discard block |
||
1299 | 1299 | self::initEmojiData(); |
1300 | 1300 | |
1301 | 1301 | if ($use_reversible_string_mappings) { |
1302 | - return (string) \str_replace( |
|
1303 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1304 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1302 | + return (string)\str_replace( |
|
1303 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1304 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1305 | 1305 | $str |
1306 | 1306 | ); |
1307 | 1307 | } |
1308 | 1308 | |
1309 | - return (string) \str_replace( |
|
1310 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1311 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1309 | + return (string)\str_replace( |
|
1310 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1311 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1312 | 1312 | $str |
1313 | 1313 | ); |
1314 | 1314 | } |
@@ -1340,16 +1340,16 @@ discard block |
||
1340 | 1340 | self::initEmojiData(); |
1341 | 1341 | |
1342 | 1342 | if ($use_reversible_string_mappings) { |
1343 | - return (string) \str_replace( |
|
1344 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1345 | - (array) self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1343 | + return (string)\str_replace( |
|
1344 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1345 | + (array)self::$EMOJI_KEYS_REVERSIBLE_CACHE, |
|
1346 | 1346 | $str |
1347 | 1347 | ); |
1348 | 1348 | } |
1349 | 1349 | |
1350 | - return (string) \str_replace( |
|
1351 | - (array) self::$EMOJI_VALUES_CACHE, |
|
1352 | - (array) self::$EMOJI_KEYS_CACHE, |
|
1350 | + return (string)\str_replace( |
|
1351 | + (array)self::$EMOJI_VALUES_CACHE, |
|
1352 | + (array)self::$EMOJI_KEYS_CACHE, |
|
1353 | 1353 | $str |
1354 | 1354 | ); |
1355 | 1355 | } |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | if ($to_encoding === 'JSON') { |
1416 | 1416 | $return = self::json_encode($str); |
1417 | 1417 | if ($return === false) { |
1418 | - throw new \InvalidArgumentException('The input string [' . $str . '] can not be used for json_encode().'); |
|
1418 | + throw new \InvalidArgumentException('The input string ['.$str.'] can not be used for json_encode().'); |
|
1419 | 1419 | } |
1420 | 1420 | |
1421 | 1421 | return $return; |
@@ -1506,7 +1506,7 @@ discard block |
||
1506 | 1506 | /** |
1507 | 1507 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
1508 | 1508 | */ |
1509 | - \trigger_error('UTF8::encode() without mbstring cannot handle "' . $to_encoding . '" encoding', \E_USER_WARNING); |
|
1509 | + \trigger_error('UTF8::encode() without mbstring cannot handle "'.$to_encoding.'" encoding', \E_USER_WARNING); |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -1607,31 +1607,31 @@ discard block |
||
1607 | 1607 | $trim_chars = "\t\r\n -_()!~?=+/*\\,.:;\"'[]{}`&"; |
1608 | 1608 | |
1609 | 1609 | if ($length === null) { |
1610 | - $length = (int) \round((int) self::strlen($str, $encoding) / 2); |
|
1610 | + $length = (int)\round((int)self::strlen($str, $encoding) / 2); |
|
1611 | 1611 | } |
1612 | 1612 | |
1613 | 1613 | if ($search === '') { |
1614 | 1614 | if ($encoding === 'UTF-8') { |
1615 | 1615 | if ($length > 0) { |
1616 | - $string_length = (int) \mb_strlen($str); |
|
1616 | + $string_length = (int)\mb_strlen($str); |
|
1617 | 1617 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1618 | 1618 | } else { |
1619 | 1619 | $end = 0; |
1620 | 1620 | } |
1621 | 1621 | |
1622 | - $pos = (int) \min( |
|
1622 | + $pos = (int)\min( |
|
1623 | 1623 | \mb_strpos($str, ' ', $end), |
1624 | 1624 | \mb_strpos($str, '.', $end) |
1625 | 1625 | ); |
1626 | 1626 | } else { |
1627 | 1627 | if ($length > 0) { |
1628 | - $string_length = (int) self::strlen($str, $encoding); |
|
1628 | + $string_length = (int)self::strlen($str, $encoding); |
|
1629 | 1629 | $end = ($length - 1) > $string_length ? $string_length : ($length - 1); |
1630 | 1630 | } else { |
1631 | 1631 | $end = 0; |
1632 | 1632 | } |
1633 | 1633 | |
1634 | - $pos = (int) \min( |
|
1634 | + $pos = (int)\min( |
|
1635 | 1635 | self::strpos($str, ' ', $end, $encoding), |
1636 | 1636 | self::strpos($str, '.', $end, $encoding) |
1637 | 1637 | ); |
@@ -1648,18 +1648,18 @@ discard block |
||
1648 | 1648 | return ''; |
1649 | 1649 | } |
1650 | 1650 | |
1651 | - return \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1651 | + return \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1652 | 1652 | } |
1653 | 1653 | |
1654 | 1654 | return $str; |
1655 | 1655 | } |
1656 | 1656 | |
1657 | 1657 | if ($encoding === 'UTF-8') { |
1658 | - $word_position = (int) \mb_stripos($str, $search); |
|
1659 | - $half_side = (int) ($word_position - $length / 2 + (int) \mb_strlen($search) / 2); |
|
1658 | + $word_position = (int)\mb_stripos($str, $search); |
|
1659 | + $half_side = (int)($word_position - $length / 2 + (int)\mb_strlen($search) / 2); |
|
1660 | 1660 | } else { |
1661 | - $word_position = (int) self::stripos($str, $search, 0, $encoding); |
|
1662 | - $half_side = (int) ($word_position - $length / 2 + (int) self::strlen($search, $encoding) / 2); |
|
1661 | + $word_position = (int)self::stripos($str, $search, 0, $encoding); |
|
1662 | + $half_side = (int)($word_position - $length / 2 + (int)self::strlen($search, $encoding) / 2); |
|
1663 | 1663 | } |
1664 | 1664 | |
1665 | 1665 | $pos_start = 0; |
@@ -1671,12 +1671,12 @@ discard block |
||
1671 | 1671 | } |
1672 | 1672 | if ($half_text !== false) { |
1673 | 1673 | if ($encoding === 'UTF-8') { |
1674 | - $pos_start = (int) \max( |
|
1674 | + $pos_start = (int)\max( |
|
1675 | 1675 | \mb_strrpos($half_text, ' '), |
1676 | 1676 | \mb_strrpos($half_text, '.') |
1677 | 1677 | ); |
1678 | 1678 | } else { |
1679 | - $pos_start = (int) \max( |
|
1679 | + $pos_start = (int)\max( |
|
1680 | 1680 | self::strrpos($half_text, ' ', 0, $encoding), |
1681 | 1681 | self::strrpos($half_text, '.', 0, $encoding) |
1682 | 1682 | ); |
@@ -1686,19 +1686,19 @@ discard block |
||
1686 | 1686 | |
1687 | 1687 | if ($word_position && $half_side > 0) { |
1688 | 1688 | $offset = $pos_start + $length - 1; |
1689 | - $real_length = (int) self::strlen($str, $encoding); |
|
1689 | + $real_length = (int)self::strlen($str, $encoding); |
|
1690 | 1690 | |
1691 | 1691 | if ($offset > $real_length) { |
1692 | 1692 | $offset = $real_length; |
1693 | 1693 | } |
1694 | 1694 | |
1695 | 1695 | if ($encoding === 'UTF-8') { |
1696 | - $pos_end = (int) \min( |
|
1696 | + $pos_end = (int)\min( |
|
1697 | 1697 | \mb_strpos($str, ' ', $offset), |
1698 | 1698 | \mb_strpos($str, '.', $offset) |
1699 | 1699 | ) - $pos_start; |
1700 | 1700 | } else { |
1701 | - $pos_end = (int) \min( |
|
1701 | + $pos_end = (int)\min( |
|
1702 | 1702 | self::strpos($str, ' ', $offset, $encoding), |
1703 | 1703 | self::strpos($str, '.', $offset, $encoding) |
1704 | 1704 | ) - $pos_start; |
@@ -1706,12 +1706,12 @@ discard block |
||
1706 | 1706 | |
1707 | 1707 | if (!$pos_end || $pos_end <= 0) { |
1708 | 1708 | if ($encoding === 'UTF-8') { |
1709 | - $str_sub = \mb_substr($str, $pos_start, (int) \mb_strlen($str)); |
|
1709 | + $str_sub = \mb_substr($str, $pos_start, (int)\mb_strlen($str)); |
|
1710 | 1710 | } else { |
1711 | - $str_sub = self::substr($str, $pos_start, (int) self::strlen($str, $encoding), $encoding); |
|
1711 | + $str_sub = self::substr($str, $pos_start, (int)self::strlen($str, $encoding), $encoding); |
|
1712 | 1712 | } |
1713 | 1713 | if ($str_sub !== false) { |
1714 | - $extract = $replacer_for_skipped_text . \ltrim($str_sub, $trim_chars); |
|
1714 | + $extract = $replacer_for_skipped_text.\ltrim($str_sub, $trim_chars); |
|
1715 | 1715 | } else { |
1716 | 1716 | $extract = ''; |
1717 | 1717 | } |
@@ -1722,26 +1722,26 @@ discard block |
||
1722 | 1722 | $str_sub = self::substr($str, $pos_start, $pos_end, $encoding); |
1723 | 1723 | } |
1724 | 1724 | if ($str_sub !== false) { |
1725 | - $extract = $replacer_for_skipped_text . \trim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1725 | + $extract = $replacer_for_skipped_text.\trim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1726 | 1726 | } else { |
1727 | 1727 | $extract = ''; |
1728 | 1728 | } |
1729 | 1729 | } |
1730 | 1730 | } else { |
1731 | 1731 | $offset = $length - 1; |
1732 | - $true_length = (int) self::strlen($str, $encoding); |
|
1732 | + $true_length = (int)self::strlen($str, $encoding); |
|
1733 | 1733 | |
1734 | 1734 | if ($offset > $true_length) { |
1735 | 1735 | $offset = $true_length; |
1736 | 1736 | } |
1737 | 1737 | |
1738 | 1738 | if ($encoding === 'UTF-8') { |
1739 | - $pos_end = (int) \min( |
|
1739 | + $pos_end = (int)\min( |
|
1740 | 1740 | \mb_strpos($str, ' ', $offset), |
1741 | 1741 | \mb_strpos($str, '.', $offset) |
1742 | 1742 | ); |
1743 | 1743 | } else { |
1744 | - $pos_end = (int) \min( |
|
1744 | + $pos_end = (int)\min( |
|
1745 | 1745 | self::strpos($str, ' ', $offset, $encoding), |
1746 | 1746 | self::strpos($str, '.', $offset, $encoding) |
1747 | 1747 | ); |
@@ -1754,7 +1754,7 @@ discard block |
||
1754 | 1754 | $str_sub = self::substr($str, 0, $pos_end, $encoding); |
1755 | 1755 | } |
1756 | 1756 | if ($str_sub !== false) { |
1757 | - $extract = \rtrim($str_sub, $trim_chars) . $replacer_for_skipped_text; |
|
1757 | + $extract = \rtrim($str_sub, $trim_chars).$replacer_for_skipped_text; |
|
1758 | 1758 | } else { |
1759 | 1759 | $extract = ''; |
1760 | 1760 | } |
@@ -1887,7 +1887,7 @@ discard block |
||
1887 | 1887 | { |
1888 | 1888 | $file_content = \file_get_contents($file_path); |
1889 | 1889 | if ($file_content === false) { |
1890 | - throw new \RuntimeException('file_get_contents() returned false for:' . $file_path); |
|
1890 | + throw new \RuntimeException('file_get_contents() returned false for:'.$file_path); |
|
1891 | 1891 | } |
1892 | 1892 | |
1893 | 1893 | return self::string_has_bom($file_content); |
@@ -1953,7 +1953,7 @@ discard block |
||
1953 | 1953 | ) { |
1954 | 1954 | // Prevent leading combining chars |
1955 | 1955 | // for NFC-safe concatenations. |
1956 | - $var = $leading_combining . $var; |
|
1956 | + $var = $leading_combining.$var; |
|
1957 | 1957 | } |
1958 | 1958 | } |
1959 | 1959 | |
@@ -2274,10 +2274,10 @@ discard block |
||
2274 | 2274 | } |
2275 | 2275 | |
2276 | 2276 | if ($encoding === 'UTF-8') { |
2277 | - return (string) \mb_substr($str, 0, $n); |
|
2277 | + return (string)\mb_substr($str, 0, $n); |
|
2278 | 2278 | } |
2279 | 2279 | |
2280 | - return (string) self::substr($str, 0, $n, $encoding); |
|
2280 | + return (string)self::substr($str, 0, $n, $encoding); |
|
2281 | 2281 | } |
2282 | 2282 | |
2283 | 2283 | /** |
@@ -2295,7 +2295,7 @@ discard block |
||
2295 | 2295 | */ |
2296 | 2296 | public static function fits_inside(string $str, int $box_size): bool |
2297 | 2297 | { |
2298 | - return (int) self::strlen($str) <= $box_size; |
|
2298 | + return (int)self::strlen($str) <= $box_size; |
|
2299 | 2299 | } |
2300 | 2300 | |
2301 | 2301 | /** |
@@ -2378,7 +2378,7 @@ discard block |
||
2378 | 2378 | return $str; |
2379 | 2379 | } |
2380 | 2380 | |
2381 | - $str = (string) $str; |
|
2381 | + $str = (string)$str; |
|
2382 | 2382 | $last = ''; |
2383 | 2383 | while ($last !== $str) { |
2384 | 2384 | $last = $str; |
@@ -2587,7 +2587,7 @@ discard block |
||
2587 | 2587 | return $fallback; |
2588 | 2588 | } |
2589 | 2589 | /** @noinspection OffsetOperationsInspection */ |
2590 | - $type_code = (int) ($str_info['chars1'] . $str_info['chars2']); |
|
2590 | + $type_code = (int)($str_info['chars1'].$str_info['chars2']); |
|
2591 | 2591 | |
2592 | 2592 | // DEBUG |
2593 | 2593 | //var_dump($type_code); |
@@ -2645,7 +2645,7 @@ discard block |
||
2645 | 2645 | // |
2646 | 2646 | |
2647 | 2647 | if ($encoding === 'UTF-8') { |
2648 | - $max_length = (int) \mb_strlen($possible_chars); |
|
2648 | + $max_length = (int)\mb_strlen($possible_chars); |
|
2649 | 2649 | if ($max_length === 0) { |
2650 | 2650 | return ''; |
2651 | 2651 | } |
@@ -2666,7 +2666,7 @@ discard block |
||
2666 | 2666 | } else { |
2667 | 2667 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
2668 | 2668 | |
2669 | - $max_length = (int) self::strlen($possible_chars, $encoding); |
|
2669 | + $max_length = (int)self::strlen($possible_chars, $encoding); |
|
2670 | 2670 | if ($max_length === 0) { |
2671 | 2671 | return ''; |
2672 | 2672 | } |
@@ -2704,16 +2704,16 @@ discard block |
||
2704 | 2704 | $rand_int = \mt_rand(0, \mt_getrandmax()); |
2705 | 2705 | } |
2706 | 2706 | |
2707 | - $unique_helper = $rand_int . |
|
2708 | - \session_id() . |
|
2709 | - ($_SERVER['REMOTE_ADDR'] ?? '') . |
|
2710 | - ($_SERVER['SERVER_ADDR'] ?? '') . |
|
2707 | + $unique_helper = $rand_int. |
|
2708 | + \session_id(). |
|
2709 | + ($_SERVER['REMOTE_ADDR'] ?? ''). |
|
2710 | + ($_SERVER['SERVER_ADDR'] ?? ''). |
|
2711 | 2711 | $extra_entropy; |
2712 | 2712 | |
2713 | 2713 | $unique_string = \uniqid($unique_helper, true); |
2714 | 2714 | |
2715 | 2715 | if ($use_md5) { |
2716 | - $unique_string = \md5($unique_string . $unique_helper); |
|
2716 | + $unique_string = \md5($unique_string.$unique_helper); |
|
2717 | 2717 | } |
2718 | 2718 | |
2719 | 2719 | return $unique_string; |
@@ -2812,7 +2812,7 @@ discard block |
||
2812 | 2812 | public static function hex_to_chr(string $hexdec) |
2813 | 2813 | { |
2814 | 2814 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Invalid characters passed for attempted conversion, these have been ignored */ |
2815 | - return self::decimal_to_chr((int) @\hexdec($hexdec)); |
|
2815 | + return self::decimal_to_chr((int)@\hexdec($hexdec)); |
|
2816 | 2816 | } |
2817 | 2817 | |
2818 | 2818 | /** |
@@ -2832,7 +2832,7 @@ discard block |
||
2832 | 2832 | public static function hex_to_int($hexdec) |
2833 | 2833 | { |
2834 | 2834 | // init |
2835 | - $hexdec = (string) $hexdec; |
|
2835 | + $hexdec = (string)$hexdec; |
|
2836 | 2836 | |
2837 | 2837 | if ($hexdec === '') { |
2838 | 2838 | return false; |
@@ -2932,7 +2932,7 @@ discard block |
||
2932 | 2932 | return \implode( |
2933 | 2933 | '', |
2934 | 2934 | \array_map( |
2935 | - static function (string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2935 | + static function(string $chr) use ($keep_ascii_chars, $encoding): string { |
|
2936 | 2936 | return self::single_chr_html_encode($chr, $keep_ascii_chars, $encoding); |
2937 | 2937 | }, |
2938 | 2938 | self::str_split($str) |
@@ -3047,7 +3047,7 @@ discard block |
||
3047 | 3047 | /** |
3048 | 3048 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
3049 | 3049 | */ |
3050 | - \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
3050 | + \trigger_error('UTF8::html_entity_decode() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
3051 | 3051 | } |
3052 | 3052 | |
3053 | 3053 | do { |
@@ -3056,7 +3056,7 @@ discard block |
||
3056 | 3056 | if (\strpos($str, '&') !== false) { |
3057 | 3057 | if (\strpos($str, '&#') !== false) { |
3058 | 3058 | // decode also numeric & UTF16 two byte entities |
3059 | - $str = (string) \preg_replace( |
|
3059 | + $str = (string)\preg_replace( |
|
3060 | 3060 | '/(&#(?:x0*[0-9a-fA-F]{2,6}(?![0-9a-fA-F;])|(?:0*\d{2,6}(?![0-9;]))))/S', |
3061 | 3061 | '$1;', |
3062 | 3062 | $str |
@@ -3106,7 +3106,7 @@ discard block |
||
3106 | 3106 | */ |
3107 | 3107 | public static function html_stripe_empty_tags(string $str): string |
3108 | 3108 | { |
3109 | - return (string) \preg_replace( |
|
3109 | + return (string)\preg_replace( |
|
3110 | 3110 | '/<[^\\/>]*?>\\s*?<\\/[^>]*?>/u', |
3111 | 3111 | '', |
3112 | 3112 | $str |
@@ -3436,9 +3436,9 @@ discard block |
||
3436 | 3436 | { |
3437 | 3437 | $hex = \dechex($int); |
3438 | 3438 | |
3439 | - $hex = (\strlen($hex) < 4 ? \substr('0000' . $hex, -4) : $hex); |
|
3439 | + $hex = (\strlen($hex) < 4 ? \substr('0000'.$hex, -4) : $hex); |
|
3440 | 3440 | |
3441 | - return $prefix . $hex . ''; |
|
3441 | + return $prefix.$hex.''; |
|
3442 | 3442 | } |
3443 | 3443 | |
3444 | 3444 | /** |
@@ -3767,7 +3767,7 @@ discard block |
||
3767 | 3767 | */ |
3768 | 3768 | public static function is_binary($input, bool $strict = false): bool |
3769 | 3769 | { |
3770 | - $input = (string) $input; |
|
3770 | + $input = (string)$input; |
|
3771 | 3771 | if ($input === '') { |
3772 | 3772 | return false; |
3773 | 3773 | } |
@@ -4127,7 +4127,7 @@ discard block |
||
4127 | 4127 | public static function is_utf16($str, bool $check_if_string_is_binary = true) |
4128 | 4128 | { |
4129 | 4129 | // init |
4130 | - $str = (string) $str; |
|
4130 | + $str = (string)$str; |
|
4131 | 4131 | $str_chars = []; |
4132 | 4132 | |
4133 | 4133 | if ( |
@@ -4221,7 +4221,7 @@ discard block |
||
4221 | 4221 | public static function is_utf32($str, bool $check_if_string_is_binary = true) |
4222 | 4222 | { |
4223 | 4223 | // init |
4224 | - $str = (string) $str; |
|
4224 | + $str = (string)$str; |
|
4225 | 4225 | $str_chars = []; |
4226 | 4226 | |
4227 | 4227 | if ( |
@@ -4319,7 +4319,7 @@ discard block |
||
4319 | 4319 | return true; |
4320 | 4320 | } |
4321 | 4321 | |
4322 | - return self::is_utf8_string((string) $str, $strict); |
|
4322 | + return self::is_utf8_string((string)$str, $strict); |
|
4323 | 4323 | } |
4324 | 4324 | |
4325 | 4325 | /** |
@@ -4477,15 +4477,15 @@ discard block |
||
4477 | 4477 | $use_mb_functions = ($lang === null && !$try_to_keep_the_string_length); |
4478 | 4478 | |
4479 | 4479 | if ($encoding === 'UTF-8') { |
4480 | - $str_part_two = (string) \mb_substr($str, 1); |
|
4480 | + $str_part_two = (string)\mb_substr($str, 1); |
|
4481 | 4481 | |
4482 | 4482 | if ($use_mb_functions) { |
4483 | 4483 | $str_part_one = \mb_strtolower( |
4484 | - (string) \mb_substr($str, 0, 1) |
|
4484 | + (string)\mb_substr($str, 0, 1) |
|
4485 | 4485 | ); |
4486 | 4486 | } else { |
4487 | 4487 | $str_part_one = self::strtolower( |
4488 | - (string) \mb_substr($str, 0, 1), |
|
4488 | + (string)\mb_substr($str, 0, 1), |
|
4489 | 4489 | $encoding, |
4490 | 4490 | false, |
4491 | 4491 | $lang, |
@@ -4495,10 +4495,10 @@ discard block |
||
4495 | 4495 | } else { |
4496 | 4496 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
4497 | 4497 | |
4498 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
4498 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
4499 | 4499 | |
4500 | 4500 | $str_part_one = self::strtolower( |
4501 | - (string) self::substr($str, 0, 1, $encoding), |
|
4501 | + (string)self::substr($str, 0, 1, $encoding), |
|
4502 | 4502 | $encoding, |
4503 | 4503 | false, |
4504 | 4504 | $lang, |
@@ -4506,7 +4506,7 @@ discard block |
||
4506 | 4506 | ); |
4507 | 4507 | } |
4508 | 4508 | |
4509 | - return $str_part_one . $str_part_two; |
|
4509 | + return $str_part_one.$str_part_two; |
|
4510 | 4510 | } |
4511 | 4511 | |
4512 | 4512 | /** |
@@ -4655,7 +4655,7 @@ discard block |
||
4655 | 4655 | } |
4656 | 4656 | |
4657 | 4657 | /** @noinspection PhpComposerExtensionStubsInspection */ |
4658 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
4658 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
4659 | 4659 | } |
4660 | 4660 | |
4661 | 4661 | if ($chars !== null) { |
@@ -4692,7 +4692,7 @@ discard block |
||
4692 | 4692 | |
4693 | 4693 | $codepoint_max = \max($codepoints); |
4694 | 4694 | |
4695 | - return self::chr((int) $codepoint_max); |
|
4695 | + return self::chr((int)$codepoint_max); |
|
4696 | 4696 | } |
4697 | 4697 | |
4698 | 4698 | /** |
@@ -4712,7 +4712,7 @@ discard block |
||
4712 | 4712 | { |
4713 | 4713 | $bytes = self::chr_size_list($str); |
4714 | 4714 | if ($bytes !== []) { |
4715 | - return (int) \max($bytes); |
|
4715 | + return (int)\max($bytes); |
|
4716 | 4716 | } |
4717 | 4717 | |
4718 | 4718 | return 0; |
@@ -4758,7 +4758,7 @@ discard block |
||
4758 | 4758 | |
4759 | 4759 | $codepoint_min = \min($codepoints); |
4760 | 4760 | |
4761 | - return self::chr((int) $codepoint_min); |
|
4761 | + return self::chr((int)$codepoint_min); |
|
4762 | 4762 | } |
4763 | 4763 | |
4764 | 4764 | /** |
@@ -4806,7 +4806,7 @@ discard block |
||
4806 | 4806 | static $STATIC_NORMALIZE_ENCODING_CACHE = []; |
4807 | 4807 | |
4808 | 4808 | // init |
4809 | - $encoding = (string) $encoding; |
|
4809 | + $encoding = (string)$encoding; |
|
4810 | 4810 | |
4811 | 4811 | if (!$encoding) { |
4812 | 4812 | return $fallback; |
@@ -4868,7 +4868,7 @@ discard block |
||
4868 | 4868 | |
4869 | 4869 | $encoding_original = $encoding; |
4870 | 4870 | $encoding = \strtoupper($encoding); |
4871 | - $encoding_upper_helper = (string) \preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4871 | + $encoding_upper_helper = (string)\preg_replace('/[^a-zA-Z0-9]/u', '', $encoding); |
|
4872 | 4872 | |
4873 | 4873 | $equivalences = [ |
4874 | 4874 | 'ISO8859' => 'ISO-8859-1', |
@@ -5035,13 +5035,13 @@ discard block |
||
5035 | 5035 | static $CHAR_CACHE = []; |
5036 | 5036 | |
5037 | 5037 | // init |
5038 | - $chr = (string) $chr; |
|
5038 | + $chr = (string)$chr; |
|
5039 | 5039 | |
5040 | 5040 | if ($encoding !== 'UTF-8' && $encoding !== 'CP850') { |
5041 | 5041 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5042 | 5042 | } |
5043 | 5043 | |
5044 | - $cache_key = $chr . '_' . $encoding; |
|
5044 | + $cache_key = $chr.'_'.$encoding; |
|
5045 | 5045 | if (isset($CHAR_CACHE[$cache_key])) { |
5046 | 5046 | return $CHAR_CACHE[$cache_key]; |
5047 | 5047 | } |
@@ -5076,7 +5076,7 @@ discard block |
||
5076 | 5076 | // |
5077 | 5077 | |
5078 | 5078 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
5079 | - $chr = \unpack('C*', (string) \substr($chr, 0, 4)); |
|
5079 | + $chr = \unpack('C*', (string)\substr($chr, 0, 4)); |
|
5080 | 5080 | /** @noinspection OffsetOperationsInspection */ |
5081 | 5081 | $code = $chr ? $chr[1] : 0; |
5082 | 5082 | |
@@ -5084,21 +5084,21 @@ discard block |
||
5084 | 5084 | if ($code >= 0xF0 && isset($chr[4])) { |
5085 | 5085 | /** @noinspection UnnecessaryCastingInspection */ |
5086 | 5086 | /** @noinspection OffsetOperationsInspection */ |
5087 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
5087 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xF0) << 18) + (($chr[2] - 0x80) << 12) + (($chr[3] - 0x80) << 6) + $chr[4] - 0x80); |
|
5088 | 5088 | } |
5089 | 5089 | |
5090 | 5090 | /** @noinspection OffsetOperationsInspection */ |
5091 | 5091 | if ($code >= 0xE0 && isset($chr[3])) { |
5092 | 5092 | /** @noinspection UnnecessaryCastingInspection */ |
5093 | 5093 | /** @noinspection OffsetOperationsInspection */ |
5094 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
5094 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xE0) << 12) + (($chr[2] - 0x80) << 6) + $chr[3] - 0x80); |
|
5095 | 5095 | } |
5096 | 5096 | |
5097 | 5097 | /** @noinspection OffsetOperationsInspection */ |
5098 | 5098 | if ($code >= 0xC0 && isset($chr[2])) { |
5099 | 5099 | /** @noinspection UnnecessaryCastingInspection */ |
5100 | 5100 | /** @noinspection OffsetOperationsInspection */ |
5101 | - return $CHAR_CACHE[$cache_key] = (int) ((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
5101 | + return $CHAR_CACHE[$cache_key] = (int)((($code - 0xC0) << 6) + $chr[2] - 0x80); |
|
5102 | 5102 | } |
5103 | 5103 | |
5104 | 5104 | return $CHAR_CACHE[$cache_key] = $code; |
@@ -5160,7 +5160,7 @@ discard block |
||
5160 | 5160 | public static function pcre_utf8_support(): bool |
5161 | 5161 | { |
5162 | 5162 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
5163 | - return (bool) @\preg_match('//u', ''); |
|
5163 | + return (bool)@\preg_match('//u', ''); |
|
5164 | 5164 | } |
5165 | 5165 | |
5166 | 5166 | /** |
@@ -5201,14 +5201,14 @@ discard block |
||
5201 | 5201 | * @psalm-suppress DocblockTypeContradiction |
5202 | 5202 | */ |
5203 | 5203 | if (!\is_numeric($step)) { |
5204 | - throw new \InvalidArgumentException('$step need to be a number, type given: ' . \gettype($step)); |
|
5204 | + throw new \InvalidArgumentException('$step need to be a number, type given: '.\gettype($step)); |
|
5205 | 5205 | } |
5206 | 5206 | |
5207 | 5207 | /** |
5208 | 5208 | * @psalm-suppress RedundantConditionGivenDocblockType - false-positive from psalm? |
5209 | 5209 | */ |
5210 | 5210 | if ($step <= 0) { |
5211 | - throw new \InvalidArgumentException('$step need to be a positive number, given: ' . $step); |
|
5211 | + throw new \InvalidArgumentException('$step need to be a positive number, given: '.$step); |
|
5212 | 5212 | } |
5213 | 5213 | } |
5214 | 5214 | |
@@ -5220,16 +5220,16 @@ discard block |
||
5220 | 5220 | $is_xdigit = false; |
5221 | 5221 | |
5222 | 5222 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5223 | - if ($use_ctype && \ctype_digit((string) $var1) && \ctype_digit((string) $var2)) { |
|
5223 | + if ($use_ctype && \ctype_digit((string)$var1) && \ctype_digit((string)$var2)) { |
|
5224 | 5224 | $is_digit = true; |
5225 | - $start = (int) $var1; |
|
5225 | + $start = (int)$var1; |
|
5226 | 5226 | } /** @noinspection PhpComposerExtensionStubsInspection */ elseif ($use_ctype && \ctype_xdigit($var1) && \ctype_xdigit($var2)) { |
5227 | 5227 | $is_xdigit = true; |
5228 | - $start = (int) self::hex_to_int((string) $var1); |
|
5228 | + $start = (int)self::hex_to_int((string)$var1); |
|
5229 | 5229 | } elseif (!$use_ctype && \is_numeric($var1)) { |
5230 | - $start = (int) $var1; |
|
5230 | + $start = (int)$var1; |
|
5231 | 5231 | } else { |
5232 | - $start = self::ord((string) $var1); |
|
5232 | + $start = self::ord((string)$var1); |
|
5233 | 5233 | } |
5234 | 5234 | |
5235 | 5235 | if (!$start) { |
@@ -5237,13 +5237,13 @@ discard block |
||
5237 | 5237 | } |
5238 | 5238 | |
5239 | 5239 | if ($is_digit) { |
5240 | - $end = (int) $var2; |
|
5240 | + $end = (int)$var2; |
|
5241 | 5241 | } elseif ($is_xdigit) { |
5242 | - $end = (int) self::hex_to_int((string) $var2); |
|
5242 | + $end = (int)self::hex_to_int((string)$var2); |
|
5243 | 5243 | } elseif (!$use_ctype && \is_numeric($var2)) { |
5244 | - $end = (int) $var2; |
|
5244 | + $end = (int)$var2; |
|
5245 | 5245 | } else { |
5246 | - $end = self::ord((string) $var2); |
|
5246 | + $end = self::ord((string)$var2); |
|
5247 | 5247 | } |
5248 | 5248 | |
5249 | 5249 | if (!$end) { |
@@ -5252,7 +5252,7 @@ discard block |
||
5252 | 5252 | |
5253 | 5253 | $array = []; |
5254 | 5254 | foreach (\range($start, $end, $step) as $i) { |
5255 | - $array[] = (string) self::chr((int) $i, $encoding); |
|
5255 | + $array[] = (string)self::chr((int)$i, $encoding); |
|
5256 | 5256 | } |
5257 | 5257 | |
5258 | 5258 | return $array; |
@@ -5348,8 +5348,8 @@ discard block |
||
5348 | 5348 | $delimiter = '/'; |
5349 | 5349 | } |
5350 | 5350 | |
5351 | - return (string) \preg_replace( |
|
5352 | - $delimiter . $pattern . $delimiter . 'u' . $options, |
|
5351 | + return (string)\preg_replace( |
|
5352 | + $delimiter.$pattern.$delimiter.'u'.$options, |
|
5353 | 5353 | $replacement, |
5354 | 5354 | $str |
5355 | 5355 | ); |
@@ -5399,9 +5399,9 @@ discard block |
||
5399 | 5399 | return ''; |
5400 | 5400 | } |
5401 | 5401 | |
5402 | - $str_length -= (int) $bom_byte_length; |
|
5402 | + $str_length -= (int)$bom_byte_length; |
|
5403 | 5403 | |
5404 | - $str = (string) $str_tmp; |
|
5404 | + $str = (string)$str_tmp; |
|
5405 | 5405 | } |
5406 | 5406 | } |
5407 | 5407 | |
@@ -5432,7 +5432,7 @@ discard block |
||
5432 | 5432 | */ |
5433 | 5433 | if (\is_array($what)) { |
5434 | 5434 | foreach ($what as $item) { |
5435 | - $str = (string) \preg_replace('/(' . \preg_quote($item, '/') . ')+/u', $item, $str); |
|
5435 | + $str = (string)\preg_replace('/('.\preg_quote($item, '/').')+/u', $item, $str); |
|
5436 | 5436 | } |
5437 | 5437 | } |
5438 | 5438 | |
@@ -5470,7 +5470,7 @@ discard block |
||
5470 | 5470 | */ |
5471 | 5471 | public static function remove_html_breaks(string $str, string $replacement = ''): string |
5472 | 5472 | { |
5473 | - return (string) \preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5473 | + return (string)\preg_replace("#/\r\n|\r|\n|<br.*/?>#isU", $replacement, $str); |
|
5474 | 5474 | } |
5475 | 5475 | |
5476 | 5476 | /** |
@@ -5534,17 +5534,17 @@ discard block |
||
5534 | 5534 | \strpos($str, $substring) === 0 |
5535 | 5535 | ) { |
5536 | 5536 | if ($encoding === 'UTF-8') { |
5537 | - return (string) \mb_substr( |
|
5537 | + return (string)\mb_substr( |
|
5538 | 5538 | $str, |
5539 | - (int) \mb_strlen($substring) |
|
5539 | + (int)\mb_strlen($substring) |
|
5540 | 5540 | ); |
5541 | 5541 | } |
5542 | 5542 | |
5543 | 5543 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5544 | 5544 | |
5545 | - return (string) self::substr( |
|
5545 | + return (string)self::substr( |
|
5546 | 5546 | $str, |
5547 | - (int) self::strlen($substring, $encoding), |
|
5547 | + (int)self::strlen($substring, $encoding), |
|
5548 | 5548 | null, |
5549 | 5549 | $encoding |
5550 | 5550 | ); |
@@ -5572,19 +5572,19 @@ discard block |
||
5572 | 5572 | ): string { |
5573 | 5573 | if ($substring && \substr($str, -\strlen($substring)) === $substring) { |
5574 | 5574 | if ($encoding === 'UTF-8') { |
5575 | - return (string) \mb_substr( |
|
5575 | + return (string)\mb_substr( |
|
5576 | 5576 | $str, |
5577 | 5577 | 0, |
5578 | - (int) \mb_strlen($str) - (int) \mb_strlen($substring) |
|
5578 | + (int)\mb_strlen($str) - (int)\mb_strlen($substring) |
|
5579 | 5579 | ); |
5580 | 5580 | } |
5581 | 5581 | |
5582 | 5582 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
5583 | 5583 | |
5584 | - return (string) self::substr( |
|
5584 | + return (string)self::substr( |
|
5585 | 5585 | $str, |
5586 | 5586 | 0, |
5587 | - (int) self::strlen($str, $encoding) - (int) self::strlen($substring, $encoding), |
|
5587 | + (int)self::strlen($str, $encoding) - (int)self::strlen($substring, $encoding), |
|
5588 | 5588 | $encoding |
5589 | 5589 | ); |
5590 | 5590 | } |
@@ -5687,7 +5687,7 @@ discard block |
||
5687 | 5687 | /** @noinspection PhpUsageOfSilenceOperatorInspection - ignore "Unknown character" warnings, it's working anyway */ |
5688 | 5688 | @\mb_substitute_character($replacement_char_helper); |
5689 | 5689 | // the polyfill maybe return false, so cast to string |
5690 | - $str = (string) \mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5690 | + $str = (string)\mb_convert_encoding($str, 'UTF-8', 'UTF-8'); |
|
5691 | 5691 | \mb_substitute_character($save); |
5692 | 5692 | } |
5693 | 5693 | |
@@ -5733,7 +5733,7 @@ discard block |
||
5733 | 5733 | } |
5734 | 5734 | |
5735 | 5735 | /** @noinspection PhpComposerExtensionStubsInspection */ |
5736 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
5736 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
5737 | 5737 | } |
5738 | 5738 | |
5739 | 5739 | if ($chars !== null) { |
@@ -5763,7 +5763,7 @@ discard block |
||
5763 | 5763 | $html .= '<pre>'; |
5764 | 5764 | /** @noinspection AlterInForeachInspection */ |
5765 | 5765 | foreach (self::$SUPPORT as $key => &$value) { |
5766 | - $html .= $key . ' - ' . \print_r($value, true) . "\n<br>"; |
|
5766 | + $html .= $key.' - '.\print_r($value, true)."\n<br>"; |
|
5767 | 5767 | } |
5768 | 5768 | $html .= '</pre>'; |
5769 | 5769 | |
@@ -5805,7 +5805,7 @@ discard block |
||
5805 | 5805 | return $char; |
5806 | 5806 | } |
5807 | 5807 | |
5808 | - return '&#' . self::ord($char, $encoding) . ';'; |
|
5808 | + return '&#'.self::ord($char, $encoding).';'; |
|
5809 | 5809 | } |
5810 | 5810 | |
5811 | 5811 | /** |
@@ -5909,11 +5909,11 @@ discard block |
||
5909 | 5909 | $lang, |
5910 | 5910 | $try_to_keep_the_string_length |
5911 | 5911 | ); |
5912 | - $str = (string) \preg_replace('/^[-_]+/', '', $str); |
|
5912 | + $str = (string)\preg_replace('/^[-_]+/', '', $str); |
|
5913 | 5913 | |
5914 | 5914 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
5915 | 5915 | |
5916 | - $str = (string) \preg_replace_callback( |
|
5916 | + $str = (string)\preg_replace_callback( |
|
5917 | 5917 | '/[-_\\s]+(.)?/u', |
5918 | 5918 | /** |
5919 | 5919 | * @param array $match |
@@ -5922,7 +5922,7 @@ discard block |
||
5922 | 5922 | * |
5923 | 5923 | * @return string |
5924 | 5924 | */ |
5925 | - static function (array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5925 | + static function(array $match) use ($use_mb_functions, $encoding, $lang, $try_to_keep_the_string_length): string { |
|
5926 | 5926 | if (isset($match[1])) { |
5927 | 5927 | if ($use_mb_functions) { |
5928 | 5928 | if ($encoding === 'UTF-8') { |
@@ -5940,7 +5940,7 @@ discard block |
||
5940 | 5940 | $str |
5941 | 5941 | ); |
5942 | 5942 | |
5943 | - return (string) \preg_replace_callback( |
|
5943 | + return (string)\preg_replace_callback( |
|
5944 | 5944 | '/[\\p{N}]+(.)?/u', |
5945 | 5945 | /** |
5946 | 5946 | * @param array $match |
@@ -5949,7 +5949,7 @@ discard block |
||
5949 | 5949 | * |
5950 | 5950 | * @return string |
5951 | 5951 | */ |
5952 | - static function (array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5952 | + static function(array $match) use ($use_mb_functions, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length): string { |
|
5953 | 5953 | if ($use_mb_functions) { |
5954 | 5954 | if ($encoding === 'UTF-8') { |
5955 | 5955 | return \mb_strtoupper($match[0]); |
@@ -6148,7 +6148,7 @@ discard block |
||
6148 | 6148 | ): string { |
6149 | 6149 | if (self::$SUPPORT['mbstring'] === true) { |
6150 | 6150 | /** @noinspection PhpComposerExtensionStubsInspection */ |
6151 | - $str = (string) \mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
6151 | + $str = (string)\mb_ereg_replace('\\B(\\p{Lu})', '-\1', \trim($str)); |
|
6152 | 6152 | |
6153 | 6153 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
6154 | 6154 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6158,10 +6158,10 @@ discard block |
||
6158 | 6158 | } |
6159 | 6159 | |
6160 | 6160 | /** @noinspection PhpComposerExtensionStubsInspection */ |
6161 | - return (string) \mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
6161 | + return (string)\mb_ereg_replace('[\\-_\\s]+', $delimiter, $str); |
|
6162 | 6162 | } |
6163 | 6163 | |
6164 | - $str = (string) \preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
6164 | + $str = (string)\preg_replace('/\\B(\\p{Lu})/u', '-\1', \trim($str)); |
|
6165 | 6165 | |
6166 | 6166 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
6167 | 6167 | if ($use_mb_functions && $encoding === 'UTF-8') { |
@@ -6170,7 +6170,7 @@ discard block |
||
6170 | 6170 | $str = self::strtolower($str, $encoding, $clean_utf8, $lang, $try_to_keep_the_string_length); |
6171 | 6171 | } |
6172 | 6172 | |
6173 | - return (string) \preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
6173 | + return (string)\preg_replace('/[\\-_\\s]+/u', $delimiter, $str); |
|
6174 | 6174 | } |
6175 | 6175 | |
6176 | 6176 | /** |
@@ -6194,7 +6194,7 @@ discard block |
||
6194 | 6194 | public static function str_detect_encoding($str) |
6195 | 6195 | { |
6196 | 6196 | // init |
6197 | - $str = (string) $str; |
|
6197 | + $str = (string)$str; |
|
6198 | 6198 | |
6199 | 6199 | // |
6200 | 6200 | // 1.) check binary strings (010001001...) like UTF-16 / UTF-32 / PDF / Images / ... |
@@ -6296,7 +6296,7 @@ discard block |
||
6296 | 6296 | foreach (self::$ENCODINGS as $encoding_tmp) { |
6297 | 6297 | // INFO: //IGNORE but still throw notice |
6298 | 6298 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
6299 | - if ((string) @\iconv($encoding_tmp, $encoding_tmp . '//IGNORE', $str) === $str) { |
|
6299 | + if ((string)@\iconv($encoding_tmp, $encoding_tmp.'//IGNORE', $str) === $str) { |
|
6300 | 6300 | return $encoding_tmp; |
6301 | 6301 | } |
6302 | 6302 | } |
@@ -6404,7 +6404,7 @@ discard block |
||
6404 | 6404 | return $str; |
6405 | 6405 | } |
6406 | 6406 | |
6407 | - return $substring . $str; |
|
6407 | + return $substring.$str; |
|
6408 | 6408 | } |
6409 | 6409 | |
6410 | 6410 | /** |
@@ -6700,27 +6700,27 @@ discard block |
||
6700 | 6700 | string $encoding = 'UTF-8' |
6701 | 6701 | ): string { |
6702 | 6702 | if ($encoding === 'UTF-8') { |
6703 | - $len = (int) \mb_strlen($str); |
|
6703 | + $len = (int)\mb_strlen($str); |
|
6704 | 6704 | if ($index > $len) { |
6705 | 6705 | return $str; |
6706 | 6706 | } |
6707 | 6707 | |
6708 | 6708 | /** @noinspection UnnecessaryCastingInspection */ |
6709 | - return (string) \mb_substr($str, 0, $index) . |
|
6710 | - $substring . |
|
6711 | - (string) \mb_substr($str, $index, $len); |
|
6709 | + return (string)\mb_substr($str, 0, $index). |
|
6710 | + $substring. |
|
6711 | + (string)\mb_substr($str, $index, $len); |
|
6712 | 6712 | } |
6713 | 6713 | |
6714 | 6714 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
6715 | 6715 | |
6716 | - $len = (int) self::strlen($str, $encoding); |
|
6716 | + $len = (int)self::strlen($str, $encoding); |
|
6717 | 6717 | if ($index > $len) { |
6718 | 6718 | return $str; |
6719 | 6719 | } |
6720 | 6720 | |
6721 | - return ((string) self::substr($str, 0, $index, $encoding)) . |
|
6722 | - $substring . |
|
6723 | - ((string) self::substr($str, $index, $len, $encoding)); |
|
6721 | + return ((string)self::substr($str, 0, $index, $encoding)). |
|
6722 | + $substring. |
|
6723 | + ((string)self::substr($str, $index, $len, $encoding)); |
|
6724 | 6724 | } |
6725 | 6725 | |
6726 | 6726 | /** |
@@ -6760,15 +6760,15 @@ discard block |
||
6760 | 6760 | */ |
6761 | 6761 | public static function str_ireplace($search, $replacement, $subject, &$count = null) |
6762 | 6762 | { |
6763 | - $search = (array) $search; |
|
6763 | + $search = (array)$search; |
|
6764 | 6764 | |
6765 | 6765 | /** @noinspection AlterInForeachInspection */ |
6766 | 6766 | foreach ($search as &$s) { |
6767 | - $s = (string) $s; |
|
6767 | + $s = (string)$s; |
|
6768 | 6768 | if ($s === '') { |
6769 | 6769 | $s = '/^(?<=.)$/'; |
6770 | 6770 | } else { |
6771 | - $s = '/' . \preg_quote($s, '/') . '/ui'; |
|
6771 | + $s = '/'.\preg_quote($s, '/').'/ui'; |
|
6772 | 6772 | } |
6773 | 6773 | } |
6774 | 6774 | |
@@ -6816,12 +6816,12 @@ discard block |
||
6816 | 6816 | } |
6817 | 6817 | |
6818 | 6818 | if ($search === '') { |
6819 | - return $str . $replacement; |
|
6819 | + return $str.$replacement; |
|
6820 | 6820 | } |
6821 | 6821 | |
6822 | 6822 | $searchLength = \strlen($search); |
6823 | 6823 | if (\strncasecmp($str, $search, $searchLength) === 0) { |
6824 | - return $replacement . \substr($str, $searchLength); |
|
6824 | + return $replacement.\substr($str, $searchLength); |
|
6825 | 6825 | } |
6826 | 6826 | |
6827 | 6827 | return $str; |
@@ -6852,11 +6852,11 @@ discard block |
||
6852 | 6852 | } |
6853 | 6853 | |
6854 | 6854 | if ($search === '') { |
6855 | - return $str . $replacement; |
|
6855 | + return $str.$replacement; |
|
6856 | 6856 | } |
6857 | 6857 | |
6858 | 6858 | if (\stripos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
6859 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
6859 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
6860 | 6860 | } |
6861 | 6861 | |
6862 | 6862 | return $str; |
@@ -6948,15 +6948,15 @@ discard block |
||
6948 | 6948 | } |
6949 | 6949 | |
6950 | 6950 | if ($encoding === 'UTF-8') { |
6951 | - return (string) \mb_substr( |
|
6951 | + return (string)\mb_substr( |
|
6952 | 6952 | $str, |
6953 | - $offset + (int) \mb_strlen($separator) |
|
6953 | + $offset + (int)\mb_strlen($separator) |
|
6954 | 6954 | ); |
6955 | 6955 | } |
6956 | 6956 | |
6957 | - return (string) self::substr( |
|
6957 | + return (string)self::substr( |
|
6958 | 6958 | $str, |
6959 | - $offset + (int) self::strlen($separator, $encoding), |
|
6959 | + $offset + (int)self::strlen($separator, $encoding), |
|
6960 | 6960 | null, |
6961 | 6961 | $encoding |
6962 | 6962 | ); |
@@ -6988,15 +6988,15 @@ discard block |
||
6988 | 6988 | } |
6989 | 6989 | |
6990 | 6990 | if ($encoding === 'UTF-8') { |
6991 | - return (string) \mb_substr( |
|
6991 | + return (string)\mb_substr( |
|
6992 | 6992 | $str, |
6993 | - $offset + (int) self::strlen($separator) |
|
6993 | + $offset + (int)self::strlen($separator) |
|
6994 | 6994 | ); |
6995 | 6995 | } |
6996 | 6996 | |
6997 | - return (string) self::substr( |
|
6997 | + return (string)self::substr( |
|
6998 | 6998 | $str, |
6999 | - $offset + (int) self::strlen($separator, $encoding), |
|
6999 | + $offset + (int)self::strlen($separator, $encoding), |
|
7000 | 7000 | null, |
7001 | 7001 | $encoding |
7002 | 7002 | ); |
@@ -7028,10 +7028,10 @@ discard block |
||
7028 | 7028 | } |
7029 | 7029 | |
7030 | 7030 | if ($encoding === 'UTF-8') { |
7031 | - return (string) \mb_substr($str, 0, $offset); |
|
7031 | + return (string)\mb_substr($str, 0, $offset); |
|
7032 | 7032 | } |
7033 | 7033 | |
7034 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
7034 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
7035 | 7035 | } |
7036 | 7036 | |
7037 | 7037 | /** |
@@ -7060,7 +7060,7 @@ discard block |
||
7060 | 7060 | return ''; |
7061 | 7061 | } |
7062 | 7062 | |
7063 | - return (string) \mb_substr($str, 0, $offset); |
|
7063 | + return (string)\mb_substr($str, 0, $offset); |
|
7064 | 7064 | } |
7065 | 7065 | |
7066 | 7066 | $offset = self::strripos($str, $separator, 0, $encoding); |
@@ -7068,7 +7068,7 @@ discard block |
||
7068 | 7068 | return ''; |
7069 | 7069 | } |
7070 | 7070 | |
7071 | - return (string) self::substr($str, 0, $offset, $encoding); |
|
7071 | + return (string)self::substr($str, 0, $offset, $encoding); |
|
7072 | 7072 | } |
7073 | 7073 | |
7074 | 7074 | /** |
@@ -7170,12 +7170,12 @@ discard block |
||
7170 | 7170 | } |
7171 | 7171 | |
7172 | 7172 | if ($encoding === 'UTF-8') { |
7173 | - return (string) \mb_substr($str, -$n); |
|
7173 | + return (string)\mb_substr($str, -$n); |
|
7174 | 7174 | } |
7175 | 7175 | |
7176 | 7176 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7177 | 7177 | |
7178 | - return (string) self::substr($str, -$n, null, $encoding); |
|
7178 | + return (string)self::substr($str, -$n, null, $encoding); |
|
7179 | 7179 | } |
7180 | 7180 | |
7181 | 7181 | /** |
@@ -7201,21 +7201,21 @@ discard block |
||
7201 | 7201 | } |
7202 | 7202 | |
7203 | 7203 | if ($encoding === 'UTF-8') { |
7204 | - if ((int) \mb_strlen($str) <= $length) { |
|
7204 | + if ((int)\mb_strlen($str) <= $length) { |
|
7205 | 7205 | return $str; |
7206 | 7206 | } |
7207 | 7207 | |
7208 | 7208 | /** @noinspection UnnecessaryCastingInspection */ |
7209 | - return (string) \mb_substr($str, 0, $length - (int) self::strlen($str_add_on)) . $str_add_on; |
|
7209 | + return (string)\mb_substr($str, 0, $length - (int)self::strlen($str_add_on)).$str_add_on; |
|
7210 | 7210 | } |
7211 | 7211 | |
7212 | 7212 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7213 | 7213 | |
7214 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
7214 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
7215 | 7215 | return $str; |
7216 | 7216 | } |
7217 | 7217 | |
7218 | - return ((string) self::substr($str, 0, $length - (int) self::strlen($str_add_on), $encoding)) . $str_add_on; |
|
7218 | + return ((string)self::substr($str, 0, $length - (int)self::strlen($str_add_on), $encoding)).$str_add_on; |
|
7219 | 7219 | } |
7220 | 7220 | |
7221 | 7221 | /** |
@@ -7244,12 +7244,12 @@ discard block |
||
7244 | 7244 | |
7245 | 7245 | if ($encoding === 'UTF-8') { |
7246 | 7246 | /** @noinspection UnnecessaryCastingInspection */ |
7247 | - if ((int) \mb_strlen($str) <= $length) { |
|
7247 | + if ((int)\mb_strlen($str) <= $length) { |
|
7248 | 7248 | return $str; |
7249 | 7249 | } |
7250 | 7250 | |
7251 | 7251 | if (\mb_substr($str, $length - 1, 1) === ' ') { |
7252 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
7252 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
7253 | 7253 | } |
7254 | 7254 | |
7255 | 7255 | $str = \mb_substr($str, 0, $length); |
@@ -7258,33 +7258,33 @@ discard block |
||
7258 | 7258 | $new_str = \implode(' ', $array); |
7259 | 7259 | |
7260 | 7260 | if ($new_str === '') { |
7261 | - return ((string) \mb_substr($str, 0, $length - 1)) . $str_add_on; |
|
7261 | + return ((string)\mb_substr($str, 0, $length - 1)).$str_add_on; |
|
7262 | 7262 | } |
7263 | 7263 | } else { |
7264 | - if ((int) self::strlen($str, $encoding) <= $length) { |
|
7264 | + if ((int)self::strlen($str, $encoding) <= $length) { |
|
7265 | 7265 | return $str; |
7266 | 7266 | } |
7267 | 7267 | |
7268 | 7268 | if (self::substr($str, $length - 1, 1, $encoding) === ' ') { |
7269 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
7269 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
7270 | 7270 | } |
7271 | 7271 | |
7272 | 7272 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
7273 | 7273 | $str = self::substr($str, 0, $length, $encoding); |
7274 | 7274 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
7275 | 7275 | if ($str === false) { |
7276 | - return '' . $str_add_on; |
|
7276 | + return ''.$str_add_on; |
|
7277 | 7277 | } |
7278 | 7278 | |
7279 | 7279 | $array = \explode(' ', $str, -1); |
7280 | 7280 | $new_str = \implode(' ', $array); |
7281 | 7281 | |
7282 | 7282 | if ($new_str === '') { |
7283 | - return ((string) self::substr($str, 0, $length - 1, $encoding)) . $str_add_on; |
|
7283 | + return ((string)self::substr($str, 0, $length - 1, $encoding)).$str_add_on; |
|
7284 | 7284 | } |
7285 | 7285 | } |
7286 | 7286 | |
7287 | - return $new_str . $str_add_on; |
|
7287 | + return $new_str.$str_add_on; |
|
7288 | 7288 | } |
7289 | 7289 | |
7290 | 7290 | /** |
@@ -7307,7 +7307,7 @@ discard block |
||
7307 | 7307 | $longest_common_prefix = ''; |
7308 | 7308 | |
7309 | 7309 | if ($encoding === 'UTF-8') { |
7310 | - $max_length = (int) \min( |
|
7310 | + $max_length = (int)\min( |
|
7311 | 7311 | \mb_strlen($str1), |
7312 | 7312 | \mb_strlen($str2) |
7313 | 7313 | ); |
@@ -7328,7 +7328,7 @@ discard block |
||
7328 | 7328 | } else { |
7329 | 7329 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7330 | 7330 | |
7331 | - $max_length = (int) \min( |
|
7331 | + $max_length = (int)\min( |
|
7332 | 7332 | self::strlen($str1, $encoding), |
7333 | 7333 | self::strlen($str2, $encoding) |
7334 | 7334 | ); |
@@ -7377,13 +7377,13 @@ discard block |
||
7377 | 7377 | // http://en.wikipedia.org/wiki/Longest_common_substring_problem |
7378 | 7378 | |
7379 | 7379 | if ($encoding === 'UTF-8') { |
7380 | - $str_length = (int) \mb_strlen($str1); |
|
7381 | - $other_length = (int) \mb_strlen($str2); |
|
7380 | + $str_length = (int)\mb_strlen($str1); |
|
7381 | + $other_length = (int)\mb_strlen($str2); |
|
7382 | 7382 | } else { |
7383 | 7383 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7384 | 7384 | |
7385 | - $str_length = (int) self::strlen($str1, $encoding); |
|
7386 | - $other_length = (int) self::strlen($str2, $encoding); |
|
7385 | + $str_length = (int)self::strlen($str1, $encoding); |
|
7386 | + $other_length = (int)self::strlen($str2, $encoding); |
|
7387 | 7387 | } |
7388 | 7388 | |
7389 | 7389 | // Return if either string is empty |
@@ -7436,10 +7436,10 @@ discard block |
||
7436 | 7436 | } |
7437 | 7437 | |
7438 | 7438 | if ($encoding === 'UTF-8') { |
7439 | - return (string) \mb_substr($str1, $end - $len, $len); |
|
7439 | + return (string)\mb_substr($str1, $end - $len, $len); |
|
7440 | 7440 | } |
7441 | 7441 | |
7442 | - return (string) self::substr($str1, $end - $len, $len, $encoding); |
|
7442 | + return (string)self::substr($str1, $end - $len, $len, $encoding); |
|
7443 | 7443 | } |
7444 | 7444 | |
7445 | 7445 | /** |
@@ -7463,7 +7463,7 @@ discard block |
||
7463 | 7463 | } |
7464 | 7464 | |
7465 | 7465 | if ($encoding === 'UTF-8') { |
7466 | - $max_length = (int) \min( |
|
7466 | + $max_length = (int)\min( |
|
7467 | 7467 | \mb_strlen($str1, $encoding), |
7468 | 7468 | \mb_strlen($str2, $encoding) |
7469 | 7469 | ); |
@@ -7477,7 +7477,7 @@ discard block |
||
7477 | 7477 | && |
7478 | 7478 | $char === \mb_substr($str2, -$i, 1) |
7479 | 7479 | ) { |
7480 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7480 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7481 | 7481 | } else { |
7482 | 7482 | break; |
7483 | 7483 | } |
@@ -7485,7 +7485,7 @@ discard block |
||
7485 | 7485 | } else { |
7486 | 7486 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7487 | 7487 | |
7488 | - $max_length = (int) \min( |
|
7488 | + $max_length = (int)\min( |
|
7489 | 7489 | self::strlen($str1, $encoding), |
7490 | 7490 | self::strlen($str2, $encoding) |
7491 | 7491 | ); |
@@ -7499,7 +7499,7 @@ discard block |
||
7499 | 7499 | && |
7500 | 7500 | $char === self::substr($str2, -$i, 1, $encoding) |
7501 | 7501 | ) { |
7502 | - $longest_common_suffix = $char . $longest_common_suffix; |
|
7502 | + $longest_common_suffix = $char.$longest_common_suffix; |
|
7503 | 7503 | } else { |
7504 | 7504 | break; |
7505 | 7505 | } |
@@ -7522,7 +7522,7 @@ discard block |
||
7522 | 7522 | */ |
7523 | 7523 | public static function str_matches_pattern(string $str, string $pattern): bool |
7524 | 7524 | { |
7525 | - return (bool) \preg_match('/' . $pattern . '/u', $str); |
|
7525 | + return (bool)\preg_match('/'.$pattern.'/u', $str); |
|
7526 | 7526 | } |
7527 | 7527 | |
7528 | 7528 | /** |
@@ -7542,7 +7542,7 @@ discard block |
||
7542 | 7542 | public static function str_offset_exists(string $str, int $offset, string $encoding = 'UTF-8'): bool |
7543 | 7543 | { |
7544 | 7544 | // init |
7545 | - $length = (int) self::strlen($str, $encoding); |
|
7545 | + $length = (int)self::strlen($str, $encoding); |
|
7546 | 7546 | |
7547 | 7547 | if ($offset >= 0) { |
7548 | 7548 | return $length > $offset; |
@@ -7571,7 +7571,7 @@ discard block |
||
7571 | 7571 | public static function str_offset_get(string $str, int $index, string $encoding = 'UTF-8'): string |
7572 | 7572 | { |
7573 | 7573 | // init |
7574 | - $length = (int) self::strlen($str); |
|
7574 | + $length = (int)self::strlen($str); |
|
7575 | 7575 | |
7576 | 7576 | if ( |
7577 | 7577 | ($index >= 0 && $length <= $index) |
@@ -7615,7 +7615,7 @@ discard block |
||
7615 | 7615 | return $str; |
7616 | 7616 | } |
7617 | 7617 | |
7618 | - if ($pad_type !== (int) $pad_type) { |
|
7618 | + if ($pad_type !== (int)$pad_type) { |
|
7619 | 7619 | if ($pad_type === 'left') { |
7620 | 7620 | $pad_type = \STR_PAD_LEFT; |
7621 | 7621 | } elseif ($pad_type === 'right') { |
@@ -7624,23 +7624,23 @@ discard block |
||
7624 | 7624 | $pad_type = \STR_PAD_BOTH; |
7625 | 7625 | } else { |
7626 | 7626 | throw new \InvalidArgumentException( |
7627 | - 'Pad expects $pad_type to be "STR_PAD_*" or ' . "to be one of 'left', 'right' or 'both'" |
|
7627 | + 'Pad expects $pad_type to be "STR_PAD_*" or '."to be one of 'left', 'right' or 'both'" |
|
7628 | 7628 | ); |
7629 | 7629 | } |
7630 | 7630 | } |
7631 | 7631 | |
7632 | 7632 | if ($encoding === 'UTF-8') { |
7633 | - $str_length = (int) \mb_strlen($str); |
|
7633 | + $str_length = (int)\mb_strlen($str); |
|
7634 | 7634 | |
7635 | 7635 | if ($pad_length >= $str_length) { |
7636 | 7636 | switch ($pad_type) { |
7637 | 7637 | case \STR_PAD_LEFT: |
7638 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7638 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7639 | 7639 | |
7640 | 7640 | $diff = ($pad_length - $str_length); |
7641 | 7641 | |
7642 | - $pre = (string) \mb_substr( |
|
7643 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7642 | + $pre = (string)\mb_substr( |
|
7643 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7644 | 7644 | 0, |
7645 | 7645 | $diff |
7646 | 7646 | ); |
@@ -7651,16 +7651,16 @@ discard block |
||
7651 | 7651 | case \STR_PAD_BOTH: |
7652 | 7652 | $diff = ($pad_length - $str_length); |
7653 | 7653 | |
7654 | - $ps_length_left = (int) \floor($diff / 2); |
|
7654 | + $ps_length_left = (int)\floor($diff / 2); |
|
7655 | 7655 | |
7656 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7656 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7657 | 7657 | |
7658 | - $pre = (string) \mb_substr( |
|
7658 | + $pre = (string)\mb_substr( |
|
7659 | 7659 | \str_repeat($pad_string, $ps_length_left), |
7660 | 7660 | 0, |
7661 | 7661 | $ps_length_left |
7662 | 7662 | ); |
7663 | - $post = (string) \mb_substr( |
|
7663 | + $post = (string)\mb_substr( |
|
7664 | 7664 | \str_repeat($pad_string, $ps_length_right), |
7665 | 7665 | 0, |
7666 | 7666 | $ps_length_right |
@@ -7670,19 +7670,19 @@ discard block |
||
7670 | 7670 | |
7671 | 7671 | case \STR_PAD_RIGHT: |
7672 | 7672 | default: |
7673 | - $ps_length = (int) \mb_strlen($pad_string); |
|
7673 | + $ps_length = (int)\mb_strlen($pad_string); |
|
7674 | 7674 | |
7675 | 7675 | $diff = ($pad_length - $str_length); |
7676 | 7676 | |
7677 | - $post = (string) \mb_substr( |
|
7678 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7677 | + $post = (string)\mb_substr( |
|
7678 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7679 | 7679 | 0, |
7680 | 7680 | $diff |
7681 | 7681 | ); |
7682 | 7682 | $pre = ''; |
7683 | 7683 | } |
7684 | 7684 | |
7685 | - return $pre . $str . $post; |
|
7685 | + return $pre.$str.$post; |
|
7686 | 7686 | } |
7687 | 7687 | |
7688 | 7688 | return $str; |
@@ -7690,17 +7690,17 @@ discard block |
||
7690 | 7690 | |
7691 | 7691 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
7692 | 7692 | |
7693 | - $str_length = (int) self::strlen($str, $encoding); |
|
7693 | + $str_length = (int)self::strlen($str, $encoding); |
|
7694 | 7694 | |
7695 | 7695 | if ($pad_length >= $str_length) { |
7696 | 7696 | switch ($pad_type) { |
7697 | 7697 | case \STR_PAD_LEFT: |
7698 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7698 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7699 | 7699 | |
7700 | 7700 | $diff = ($pad_length - $str_length); |
7701 | 7701 | |
7702 | - $pre = (string) self::substr( |
|
7703 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7702 | + $pre = (string)self::substr( |
|
7703 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7704 | 7704 | 0, |
7705 | 7705 | $diff, |
7706 | 7706 | $encoding |
@@ -7712,17 +7712,17 @@ discard block |
||
7712 | 7712 | case \STR_PAD_BOTH: |
7713 | 7713 | $diff = ($pad_length - $str_length); |
7714 | 7714 | |
7715 | - $ps_length_left = (int) \floor($diff / 2); |
|
7715 | + $ps_length_left = (int)\floor($diff / 2); |
|
7716 | 7716 | |
7717 | - $ps_length_right = (int) \ceil($diff / 2); |
|
7717 | + $ps_length_right = (int)\ceil($diff / 2); |
|
7718 | 7718 | |
7719 | - $pre = (string) self::substr( |
|
7719 | + $pre = (string)self::substr( |
|
7720 | 7720 | \str_repeat($pad_string, $ps_length_left), |
7721 | 7721 | 0, |
7722 | 7722 | $ps_length_left, |
7723 | 7723 | $encoding |
7724 | 7724 | ); |
7725 | - $post = (string) self::substr( |
|
7725 | + $post = (string)self::substr( |
|
7726 | 7726 | \str_repeat($pad_string, $ps_length_right), |
7727 | 7727 | 0, |
7728 | 7728 | $ps_length_right, |
@@ -7733,12 +7733,12 @@ discard block |
||
7733 | 7733 | |
7734 | 7734 | case \STR_PAD_RIGHT: |
7735 | 7735 | default: |
7736 | - $ps_length = (int) self::strlen($pad_string, $encoding); |
|
7736 | + $ps_length = (int)self::strlen($pad_string, $encoding); |
|
7737 | 7737 | |
7738 | 7738 | $diff = ($pad_length - $str_length); |
7739 | 7739 | |
7740 | - $post = (string) self::substr( |
|
7741 | - \str_repeat($pad_string, (int) \ceil($diff / $ps_length)), |
|
7740 | + $post = (string)self::substr( |
|
7741 | + \str_repeat($pad_string, (int)\ceil($diff / $ps_length)), |
|
7742 | 7742 | 0, |
7743 | 7743 | $diff, |
7744 | 7744 | $encoding |
@@ -7746,7 +7746,7 @@ discard block |
||
7746 | 7746 | $pre = ''; |
7747 | 7747 | } |
7748 | 7748 | |
7749 | - return $pre . $str . $post; |
|
7749 | + return $pre.$str.$post; |
|
7750 | 7750 | } |
7751 | 7751 | |
7752 | 7752 | return $str; |
@@ -7957,12 +7957,12 @@ discard block |
||
7957 | 7957 | } |
7958 | 7958 | |
7959 | 7959 | if ($search === '') { |
7960 | - return $str . $replacement; |
|
7960 | + return $str.$replacement; |
|
7961 | 7961 | } |
7962 | 7962 | |
7963 | 7963 | $searchLength = \strlen($search); |
7964 | 7964 | if (\strncmp($str, $search, $searchLength) === 0) { |
7965 | - return $replacement . \substr($str, $searchLength); |
|
7965 | + return $replacement.\substr($str, $searchLength); |
|
7966 | 7966 | } |
7967 | 7967 | |
7968 | 7968 | return $str; |
@@ -7996,11 +7996,11 @@ discard block |
||
7996 | 7996 | } |
7997 | 7997 | |
7998 | 7998 | if ($search === '') { |
7999 | - return $str . $replacement; |
|
7999 | + return $str.$replacement; |
|
8000 | 8000 | } |
8001 | 8001 | |
8002 | 8002 | if (\strpos($str, $search, \strlen($str) - \strlen($search)) !== false) { |
8003 | - $str = \substr($str, 0, -\strlen($search)) . $replacement; |
|
8003 | + $str = \substr($str, 0, -\strlen($search)).$replacement; |
|
8004 | 8004 | } |
8005 | 8005 | |
8006 | 8006 | return $str; |
@@ -8034,7 +8034,7 @@ discard block |
||
8034 | 8034 | $subject, |
8035 | 8035 | $replace, |
8036 | 8036 | $pos, |
8037 | - (int) self::strlen($search) |
|
8037 | + (int)self::strlen($search) |
|
8038 | 8038 | ); |
8039 | 8039 | } |
8040 | 8040 | |
@@ -8068,7 +8068,7 @@ discard block |
||
8068 | 8068 | $subject, |
8069 | 8069 | $replace, |
8070 | 8070 | $pos, |
8071 | - (int) self::strlen($search) |
|
8071 | + (int)self::strlen($search) |
|
8072 | 8072 | ); |
8073 | 8073 | } |
8074 | 8074 | |
@@ -8091,7 +8091,7 @@ discard block |
||
8091 | 8091 | public static function str_shuffle(string $str, string $encoding = 'UTF-8'): string |
8092 | 8092 | { |
8093 | 8093 | if ($encoding === 'UTF-8') { |
8094 | - $indexes = \range(0, (int) \mb_strlen($str) - 1); |
|
8094 | + $indexes = \range(0, (int)\mb_strlen($str) - 1); |
|
8095 | 8095 | /** @noinspection NonSecureShuffleUsageInspection */ |
8096 | 8096 | \shuffle($indexes); |
8097 | 8097 | |
@@ -8107,7 +8107,7 @@ discard block |
||
8107 | 8107 | } else { |
8108 | 8108 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8109 | 8109 | |
8110 | - $indexes = \range(0, (int) self::strlen($str, $encoding) - 1); |
|
8110 | + $indexes = \range(0, (int)self::strlen($str, $encoding) - 1); |
|
8111 | 8111 | /** @noinspection NonSecureShuffleUsageInspection */ |
8112 | 8112 | \shuffle($indexes); |
8113 | 8113 | |
@@ -8150,11 +8150,11 @@ discard block |
||
8150 | 8150 | ) { |
8151 | 8151 | if ($encoding === 'UTF-8') { |
8152 | 8152 | if ($end === null) { |
8153 | - $length = (int) \mb_strlen($str); |
|
8153 | + $length = (int)\mb_strlen($str); |
|
8154 | 8154 | } elseif ($end >= 0 && $end <= $start) { |
8155 | 8155 | return ''; |
8156 | 8156 | } elseif ($end < 0) { |
8157 | - $length = (int) \mb_strlen($str) + $end - $start; |
|
8157 | + $length = (int)\mb_strlen($str) + $end - $start; |
|
8158 | 8158 | } else { |
8159 | 8159 | $length = $end - $start; |
8160 | 8160 | } |
@@ -8165,11 +8165,11 @@ discard block |
||
8165 | 8165 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8166 | 8166 | |
8167 | 8167 | if ($end === null) { |
8168 | - $length = (int) self::strlen($str, $encoding); |
|
8168 | + $length = (int)self::strlen($str, $encoding); |
|
8169 | 8169 | } elseif ($end >= 0 && $end <= $start) { |
8170 | 8170 | return ''; |
8171 | 8171 | } elseif ($end < 0) { |
8172 | - $length = (int) self::strlen($str, $encoding) + $end - $start; |
|
8172 | + $length = (int)self::strlen($str, $encoding) + $end - $start; |
|
8173 | 8173 | } else { |
8174 | 8174 | $length = $end - $start; |
8175 | 8175 | } |
@@ -8204,7 +8204,7 @@ discard block |
||
8204 | 8204 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8205 | 8205 | } |
8206 | 8206 | |
8207 | - $str = (string) \preg_replace_callback( |
|
8207 | + $str = (string)\preg_replace_callback( |
|
8208 | 8208 | '/([\\p{N}|\\p{Lu}])/u', |
8209 | 8209 | /** |
8210 | 8210 | * @param string[] $matches |
@@ -8213,28 +8213,28 @@ discard block |
||
8213 | 8213 | * |
8214 | 8214 | * @return string |
8215 | 8215 | */ |
8216 | - static function (array $matches) use ($encoding): string { |
|
8216 | + static function(array $matches) use ($encoding): string { |
|
8217 | 8217 | $match = $matches[1]; |
8218 | - $match_int = (int) $match; |
|
8218 | + $match_int = (int)$match; |
|
8219 | 8219 | |
8220 | - if ((string) $match_int === $match) { |
|
8221 | - return '_' . $match . '_'; |
|
8220 | + if ((string)$match_int === $match) { |
|
8221 | + return '_'.$match.'_'; |
|
8222 | 8222 | } |
8223 | 8223 | |
8224 | 8224 | if ($encoding === 'UTF-8') { |
8225 | - return '_' . \mb_strtolower($match); |
|
8225 | + return '_'.\mb_strtolower($match); |
|
8226 | 8226 | } |
8227 | 8227 | |
8228 | - return '_' . self::strtolower($match, $encoding); |
|
8228 | + return '_'.self::strtolower($match, $encoding); |
|
8229 | 8229 | }, |
8230 | 8230 | $str |
8231 | 8231 | ); |
8232 | 8232 | |
8233 | - $str = (string) \preg_replace( |
|
8233 | + $str = (string)\preg_replace( |
|
8234 | 8234 | [ |
8235 | - '/\\s+/u', // convert spaces to "_" |
|
8235 | + '/\\s+/u', // convert spaces to "_" |
|
8236 | 8236 | '/^\\s+|\\s+$/u', // trim leading & trailing spaces |
8237 | - '/_+/', // remove double "_" |
|
8237 | + '/_+/', // remove double "_" |
|
8238 | 8238 | ], |
8239 | 8239 | [ |
8240 | 8240 | '_', |
@@ -8365,7 +8365,7 @@ discard block |
||
8365 | 8365 | } |
8366 | 8366 | |
8367 | 8367 | // init |
8368 | - $input = (string) $input; |
|
8368 | + $input = (string)$input; |
|
8369 | 8369 | |
8370 | 8370 | if ($input === '') { |
8371 | 8371 | return []; |
@@ -8422,7 +8422,7 @@ discard block |
||
8422 | 8422 | ($input[$i] & "\xE0") === "\xC0" |
8423 | 8423 | ) { |
8424 | 8424 | if (($input[$i + 1] & "\xC0") === "\x80") { |
8425 | - $ret[] = $input[$i] . $input[$i + 1]; |
|
8425 | + $ret[] = $input[$i].$input[$i + 1]; |
|
8426 | 8426 | |
8427 | 8427 | ++$i; |
8428 | 8428 | } |
@@ -8436,7 +8436,7 @@ discard block |
||
8436 | 8436 | && |
8437 | 8437 | ($input[$i + 2] & "\xC0") === "\x80" |
8438 | 8438 | ) { |
8439 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2]; |
|
8439 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2]; |
|
8440 | 8440 | |
8441 | 8441 | $i += 2; |
8442 | 8442 | } |
@@ -8452,7 +8452,7 @@ discard block |
||
8452 | 8452 | && |
8453 | 8453 | ($input[$i + 3] & "\xC0") === "\x80" |
8454 | 8454 | ) { |
8455 | - $ret[] = $input[$i] . $input[$i + 1] . $input[$i + 2] . $input[$i + 3]; |
|
8455 | + $ret[] = $input[$i].$input[$i + 1].$input[$i + 2].$input[$i + 3]; |
|
8456 | 8456 | |
8457 | 8457 | $i += 3; |
8458 | 8458 | } |
@@ -8462,7 +8462,7 @@ discard block |
||
8462 | 8462 | |
8463 | 8463 | if ($length > 1) { |
8464 | 8464 | return \array_map( |
8465 | - static function (array $item): string { |
|
8465 | + static function(array $item): string { |
|
8466 | 8466 | return \implode('', $item); |
8467 | 8467 | }, |
8468 | 8468 | \array_chunk($ret, $length) |
@@ -8528,7 +8528,7 @@ discard block |
||
8528 | 8528 | $limit = -1; |
8529 | 8529 | } |
8530 | 8530 | |
8531 | - $array = \preg_split('/' . \preg_quote($pattern, '/') . '/u', $str, $limit); |
|
8531 | + $array = \preg_split('/'.\preg_quote($pattern, '/').'/u', $str, $limit); |
|
8532 | 8532 | |
8533 | 8533 | if ($array === false) { |
8534 | 8534 | return []; |
@@ -8629,9 +8629,9 @@ discard block |
||
8629 | 8629 | return ''; |
8630 | 8630 | } |
8631 | 8631 | |
8632 | - return (string) \mb_substr( |
|
8632 | + return (string)\mb_substr( |
|
8633 | 8633 | $str, |
8634 | - $offset + (int) \mb_strlen($separator) |
|
8634 | + $offset + (int)\mb_strlen($separator) |
|
8635 | 8635 | ); |
8636 | 8636 | } |
8637 | 8637 | |
@@ -8640,9 +8640,9 @@ discard block |
||
8640 | 8640 | return ''; |
8641 | 8641 | } |
8642 | 8642 | |
8643 | - return (string) \mb_substr( |
|
8643 | + return (string)\mb_substr( |
|
8644 | 8644 | $str, |
8645 | - $offset + (int) self::strlen($separator, $encoding), |
|
8645 | + $offset + (int)self::strlen($separator, $encoding), |
|
8646 | 8646 | null, |
8647 | 8647 | $encoding |
8648 | 8648 | ); |
@@ -8674,9 +8674,9 @@ discard block |
||
8674 | 8674 | return ''; |
8675 | 8675 | } |
8676 | 8676 | |
8677 | - return (string) \mb_substr( |
|
8677 | + return (string)\mb_substr( |
|
8678 | 8678 | $str, |
8679 | - $offset + (int) \mb_strlen($separator) |
|
8679 | + $offset + (int)\mb_strlen($separator) |
|
8680 | 8680 | ); |
8681 | 8681 | } |
8682 | 8682 | |
@@ -8685,9 +8685,9 @@ discard block |
||
8685 | 8685 | return ''; |
8686 | 8686 | } |
8687 | 8687 | |
8688 | - return (string) self::substr( |
|
8688 | + return (string)self::substr( |
|
8689 | 8689 | $str, |
8690 | - $offset + (int) self::strlen($separator, $encoding), |
|
8690 | + $offset + (int)self::strlen($separator, $encoding), |
|
8691 | 8691 | null, |
8692 | 8692 | $encoding |
8693 | 8693 | ); |
@@ -8719,7 +8719,7 @@ discard block |
||
8719 | 8719 | return ''; |
8720 | 8720 | } |
8721 | 8721 | |
8722 | - return (string) \mb_substr( |
|
8722 | + return (string)\mb_substr( |
|
8723 | 8723 | $str, |
8724 | 8724 | 0, |
8725 | 8725 | $offset |
@@ -8731,7 +8731,7 @@ discard block |
||
8731 | 8731 | return ''; |
8732 | 8732 | } |
8733 | 8733 | |
8734 | - return (string) self::substr( |
|
8734 | + return (string)self::substr( |
|
8735 | 8735 | $str, |
8736 | 8736 | 0, |
8737 | 8737 | $offset, |
@@ -8762,7 +8762,7 @@ discard block |
||
8762 | 8762 | return ''; |
8763 | 8763 | } |
8764 | 8764 | |
8765 | - return (string) \mb_substr( |
|
8765 | + return (string)\mb_substr( |
|
8766 | 8766 | $str, |
8767 | 8767 | 0, |
8768 | 8768 | $offset |
@@ -8776,7 +8776,7 @@ discard block |
||
8776 | 8776 | |
8777 | 8777 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
8778 | 8778 | |
8779 | - return (string) self::substr( |
|
8779 | + return (string)self::substr( |
|
8780 | 8780 | $str, |
8781 | 8781 | 0, |
8782 | 8782 | $offset, |
@@ -8891,7 +8891,7 @@ discard block |
||
8891 | 8891 | */ |
8892 | 8892 | public static function str_surround(string $str, string $substring): string |
8893 | 8893 | { |
8894 | - return $substring . $str . $substring; |
|
8894 | + return $substring.$str.$substring; |
|
8895 | 8895 | } |
8896 | 8896 | |
8897 | 8897 | /** |
@@ -8955,9 +8955,9 @@ discard block |
||
8955 | 8955 | $word_define_chars = ''; |
8956 | 8956 | } |
8957 | 8957 | |
8958 | - $str = (string) \preg_replace_callback( |
|
8959 | - '/([^\\s' . $word_define_chars . ']+)/u', |
|
8960 | - static function (array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8958 | + $str = (string)\preg_replace_callback( |
|
8959 | + '/([^\\s'.$word_define_chars.']+)/u', |
|
8960 | + static function(array $match) use ($try_to_keep_the_string_length, $lang, $ignore, $use_mb_functions, $encoding): string { |
|
8961 | 8961 | if ($ignore !== null && \in_array($match[0], $ignore, true)) { |
8962 | 8962 | return $match[0]; |
8963 | 8963 | } |
@@ -9124,16 +9124,16 @@ discard block |
||
9124 | 9124 | |
9125 | 9125 | // the main substitutions |
9126 | 9126 | /** @noinspection RegExpDuplicateAlternationBranch - false-positive - https://youtrack.jetbrains.com/issue/WI-51002 */ |
9127 | - $str = (string) \preg_replace_callback( |
|
9127 | + $str = (string)\preg_replace_callback( |
|
9128 | 9128 | '~\\b (_*) (?: # 1. Leading underscore and |
9129 | 9129 | ( (?<=[ ][/\\\\]) [[:alpha:]]+ [-_[:alpha:]/\\\\]+ | # 2. file path or |
9130 | - [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx . ' ) # URL, domain, or email |
|
9130 | + [-_[:alpha:]]+ [@.:] [-_[:alpha:]@.:/]+ ' . $apostrophe_rx.' ) # URL, domain, or email |
|
9131 | 9131 | | |
9132 | - ( (?i: ' . $small_words_rx . ' ) ' . $apostrophe_rx . ' ) # 3. or small word (case-insensitive) |
|
9132 | + ( (?i: ' . $small_words_rx.' ) '.$apostrophe_rx.' ) # 3. or small word (case-insensitive) |
|
9133 | 9133 | | |
9134 | - ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 4. or word w/o internal caps |
|
9134 | + ( [[:alpha:]] [[:lower:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 4. or word w/o internal caps |
|
9135 | 9135 | | |
9136 | - ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx . ' ) # 5. or some other word |
|
9136 | + ( [[:alpha:]] [[:alpha:]\'’()\[\]{}]* ' . $apostrophe_rx.' ) # 5. or some other word |
|
9137 | 9137 | ) (_*) \\b # 6. With trailing underscore |
9138 | 9138 | ~ux', |
9139 | 9139 | /** |
@@ -9143,7 +9143,7 @@ discard block |
||
9143 | 9143 | * |
9144 | 9144 | * @return string |
9145 | 9145 | */ |
9146 | - static function (array $matches) use ($encoding): string { |
|
9146 | + static function(array $matches) use ($encoding): string { |
|
9147 | 9147 | // preserve leading underscore |
9148 | 9148 | $str = $matches[1]; |
9149 | 9149 | if ($matches[2]) { |
@@ -9168,11 +9168,11 @@ discard block |
||
9168 | 9168 | ); |
9169 | 9169 | |
9170 | 9170 | // Exceptions for small words: capitalize at start of title... |
9171 | - $str = (string) \preg_replace_callback( |
|
9171 | + $str = (string)\preg_replace_callback( |
|
9172 | 9172 | '~( \\A [[:punct:]]* # start of title... |
9173 | 9173 | | [:.;?!][ ]+ # or of subsentence... |
9174 | 9174 | | [ ][\'"“‘(\[][ ]* ) # or of inserted subphrase... |
9175 | - ( ' . $small_words_rx . ' ) \\b # ...followed by small word |
|
9175 | + ( ' . $small_words_rx.' ) \\b # ...followed by small word |
|
9176 | 9176 | ~uxi', |
9177 | 9177 | /** |
9178 | 9178 | * @param string[] $matches |
@@ -9181,15 +9181,15 @@ discard block |
||
9181 | 9181 | * |
9182 | 9182 | * @return string |
9183 | 9183 | */ |
9184 | - static function (array $matches) use ($encoding): string { |
|
9185 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
9184 | + static function(array $matches) use ($encoding): string { |
|
9185 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
9186 | 9186 | }, |
9187 | 9187 | $str |
9188 | 9188 | ); |
9189 | 9189 | |
9190 | 9190 | // ...and end of title |
9191 | - $str = (string) \preg_replace_callback( |
|
9192 | - '~\\b ( ' . $small_words_rx . ' ) # small word... |
|
9191 | + $str = (string)\preg_replace_callback( |
|
9192 | + '~\\b ( '.$small_words_rx.' ) # small word... |
|
9193 | 9193 | (?= [[:punct:]]* \Z # ...at the end of the title... |
9194 | 9194 | | [\'"’”)\]] [ ] ) # ...or of an inserted subphrase? |
9195 | 9195 | ~uxi', |
@@ -9200,7 +9200,7 @@ discard block |
||
9200 | 9200 | * |
9201 | 9201 | * @return string |
9202 | 9202 | */ |
9203 | - static function (array $matches) use ($encoding): string { |
|
9203 | + static function(array $matches) use ($encoding): string { |
|
9204 | 9204 | return static::ucfirst($matches[1], $encoding); |
9205 | 9205 | }, |
9206 | 9206 | $str |
@@ -9208,10 +9208,10 @@ discard block |
||
9208 | 9208 | |
9209 | 9209 | // Exceptions for small words in hyphenated compound words. |
9210 | 9210 | // e.g. "in-flight" -> In-Flight |
9211 | - $str = (string) \preg_replace_callback( |
|
9211 | + $str = (string)\preg_replace_callback( |
|
9212 | 9212 | '~\\b |
9213 | 9213 | (?<! -) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (in-flight) |
9214 | - ( ' . $small_words_rx . ' ) |
|
9214 | + ( ' . $small_words_rx.' ) |
|
9215 | 9215 | (?= -[[:alpha:]]+) # lookahead for "-someword" |
9216 | 9216 | ~uxi', |
9217 | 9217 | /** |
@@ -9221,18 +9221,18 @@ discard block |
||
9221 | 9221 | * |
9222 | 9222 | * @return string |
9223 | 9223 | */ |
9224 | - static function (array $matches) use ($encoding): string { |
|
9224 | + static function(array $matches) use ($encoding): string { |
|
9225 | 9225 | return static::ucfirst($matches[1], $encoding); |
9226 | 9226 | }, |
9227 | 9227 | $str |
9228 | 9228 | ); |
9229 | 9229 | |
9230 | 9230 | // e.g. "Stand-in" -> "Stand-In" (Stand is already capped at this point) |
9231 | - $str = (string) \preg_replace_callback( |
|
9231 | + $str = (string)\preg_replace_callback( |
|
9232 | 9232 | '~\\b |
9233 | 9233 | (?<!…) # Negative lookbehind for a hyphen; we do not want to match man-in-the-middle but do want (stand-in) |
9234 | 9234 | ( [[:alpha:]]+- ) # $1 = first word and hyphen, should already be properly capped |
9235 | - ( ' . $small_words_rx . ' ) # ...followed by small word |
|
9235 | + ( ' . $small_words_rx.' ) # ...followed by small word |
|
9236 | 9236 | (?! - ) # Negative lookahead for another - |
9237 | 9237 | ~uxi', |
9238 | 9238 | /** |
@@ -9242,8 +9242,8 @@ discard block |
||
9242 | 9242 | * |
9243 | 9243 | * @return string |
9244 | 9244 | */ |
9245 | - static function (array $matches) use ($encoding): string { |
|
9246 | - return $matches[1] . static::ucfirst($matches[2], $encoding); |
|
9245 | + static function(array $matches) use ($encoding): string { |
|
9246 | + return $matches[1].static::ucfirst($matches[2], $encoding); |
|
9247 | 9247 | }, |
9248 | 9248 | $str |
9249 | 9249 | ); |
@@ -9362,7 +9362,7 @@ discard block |
||
9362 | 9362 | ); |
9363 | 9363 | |
9364 | 9364 | foreach ($tmp_return as &$item) { |
9365 | - $item = (string) $item; |
|
9365 | + $item = (string)$item; |
|
9366 | 9366 | } |
9367 | 9367 | |
9368 | 9368 | return $tmp_return; |
@@ -9416,39 +9416,39 @@ discard block |
||
9416 | 9416 | } |
9417 | 9417 | |
9418 | 9418 | if ($encoding === 'UTF-8') { |
9419 | - if ($length >= (int) \mb_strlen($str)) { |
|
9419 | + if ($length >= (int)\mb_strlen($str)) { |
|
9420 | 9420 | return $str; |
9421 | 9421 | } |
9422 | 9422 | |
9423 | 9423 | if ($substring !== '') { |
9424 | - $length -= (int) \mb_strlen($substring); |
|
9424 | + $length -= (int)\mb_strlen($substring); |
|
9425 | 9425 | |
9426 | 9426 | /** @noinspection UnnecessaryCastingInspection */ |
9427 | - return (string) \mb_substr($str, 0, $length) . $substring; |
|
9427 | + return (string)\mb_substr($str, 0, $length).$substring; |
|
9428 | 9428 | } |
9429 | 9429 | |
9430 | 9430 | /** @noinspection UnnecessaryCastingInspection */ |
9431 | - return (string) \mb_substr($str, 0, $length); |
|
9431 | + return (string)\mb_substr($str, 0, $length); |
|
9432 | 9432 | } |
9433 | 9433 | |
9434 | 9434 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9435 | 9435 | |
9436 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
9436 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
9437 | 9437 | return $str; |
9438 | 9438 | } |
9439 | 9439 | |
9440 | 9440 | if ($substring !== '') { |
9441 | - $length -= (int) self::strlen($substring, $encoding); |
|
9441 | + $length -= (int)self::strlen($substring, $encoding); |
|
9442 | 9442 | } |
9443 | 9443 | |
9444 | 9444 | return ( |
9445 | - (string) self::substr( |
|
9445 | + (string)self::substr( |
|
9446 | 9446 | $str, |
9447 | 9447 | 0, |
9448 | 9448 | $length, |
9449 | 9449 | $encoding |
9450 | 9450 | ) |
9451 | - ) . $substring; |
|
9451 | + ).$substring; |
|
9452 | 9452 | } |
9453 | 9453 | |
9454 | 9454 | /** |
@@ -9482,12 +9482,12 @@ discard block |
||
9482 | 9482 | } |
9483 | 9483 | |
9484 | 9484 | if ($encoding === 'UTF-8') { |
9485 | - if ($length >= (int) \mb_strlen($str)) { |
|
9485 | + if ($length >= (int)\mb_strlen($str)) { |
|
9486 | 9486 | return $str; |
9487 | 9487 | } |
9488 | 9488 | |
9489 | 9489 | // need to further trim the string so we can append the substring |
9490 | - $length -= (int) \mb_strlen($substring); |
|
9490 | + $length -= (int)\mb_strlen($substring); |
|
9491 | 9491 | if ($length <= 0) { |
9492 | 9492 | return $substring; |
9493 | 9493 | } |
@@ -9513,18 +9513,18 @@ discard block |
||
9513 | 9513 | !$ignore_do_not_split_words_for_one_word |
9514 | 9514 | ) |
9515 | 9515 | ) { |
9516 | - $truncated = (string) \mb_substr($truncated, 0, (int) $last_position); |
|
9516 | + $truncated = (string)\mb_substr($truncated, 0, (int)$last_position); |
|
9517 | 9517 | } |
9518 | 9518 | } |
9519 | 9519 | } else { |
9520 | 9520 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
9521 | 9521 | |
9522 | - if ($length >= (int) self::strlen($str, $encoding)) { |
|
9522 | + if ($length >= (int)self::strlen($str, $encoding)) { |
|
9523 | 9523 | return $str; |
9524 | 9524 | } |
9525 | 9525 | |
9526 | 9526 | // need to further trim the string so we can append the substring |
9527 | - $length -= (int) self::strlen($substring, $encoding); |
|
9527 | + $length -= (int)self::strlen($substring, $encoding); |
|
9528 | 9528 | if ($length <= 0) { |
9529 | 9529 | return $substring; |
9530 | 9530 | } |
@@ -9550,12 +9550,12 @@ discard block |
||
9550 | 9550 | !$ignore_do_not_split_words_for_one_word |
9551 | 9551 | ) |
9552 | 9552 | ) { |
9553 | - $truncated = (string) self::substr($truncated, 0, (int) $last_position, $encoding); |
|
9553 | + $truncated = (string)self::substr($truncated, 0, (int)$last_position, $encoding); |
|
9554 | 9554 | } |
9555 | 9555 | } |
9556 | 9556 | } |
9557 | 9557 | |
9558 | - return $truncated . $substring; |
|
9558 | + return $truncated.$substring; |
|
9559 | 9559 | } |
9560 | 9560 | |
9561 | 9561 | /** |
@@ -9682,13 +9682,13 @@ discard block |
||
9682 | 9682 | } |
9683 | 9683 | } elseif ($format === 2) { |
9684 | 9684 | $number_of_words = []; |
9685 | - $offset = (int) self::strlen($str_parts[0]); |
|
9685 | + $offset = (int)self::strlen($str_parts[0]); |
|
9686 | 9686 | for ($i = 1; $i < $len; $i += 2) { |
9687 | 9687 | $number_of_words[$offset] = $str_parts[$i]; |
9688 | - $offset += (int) self::strlen($str_parts[$i]) + (int) self::strlen($str_parts[$i + 1]); |
|
9688 | + $offset += (int)self::strlen($str_parts[$i]) + (int)self::strlen($str_parts[$i + 1]); |
|
9689 | 9689 | } |
9690 | 9690 | } else { |
9691 | - $number_of_words = (int) (($len - 1) / 2); |
|
9691 | + $number_of_words = (int)(($len - 1) / 2); |
|
9692 | 9692 | } |
9693 | 9693 | |
9694 | 9694 | return $number_of_words; |
@@ -9821,7 +9821,7 @@ discard block |
||
9821 | 9821 | } |
9822 | 9822 | |
9823 | 9823 | if ($char_list === '') { |
9824 | - return (int) self::strlen($str, $encoding); |
|
9824 | + return (int)self::strlen($str, $encoding); |
|
9825 | 9825 | } |
9826 | 9826 | |
9827 | 9827 | if ($offset || $length !== null) { |
@@ -9848,7 +9848,7 @@ discard block |
||
9848 | 9848 | } |
9849 | 9849 | |
9850 | 9850 | $matches = []; |
9851 | - if (\preg_match('/^(.*?)' . self::rxClass($char_list) . '/us', $str, $matches)) { |
|
9851 | + if (\preg_match('/^(.*?)'.self::rxClass($char_list).'/us', $str, $matches)) { |
|
9852 | 9852 | $return = self::strlen($matches[1], $encoding); |
9853 | 9853 | if ($return === false) { |
9854 | 9854 | return 0; |
@@ -9857,7 +9857,7 @@ discard block |
||
9857 | 9857 | return $return; |
9858 | 9858 | } |
9859 | 9859 | |
9860 | - return (int) self::strlen($str, $encoding); |
|
9860 | + return (int)self::strlen($str, $encoding); |
|
9861 | 9861 | } |
9862 | 9862 | |
9863 | 9863 | /** |
@@ -9920,7 +9920,7 @@ discard block |
||
9920 | 9920 | |
9921 | 9921 | $str = ''; |
9922 | 9922 | foreach ($intOrHex as $strPart) { |
9923 | - $str .= '&#' . (int) $strPart . ';'; |
|
9923 | + $str .= '&#'.(int)$strPart.';'; |
|
9924 | 9924 | } |
9925 | 9925 | |
9926 | 9926 | return self::html_entity_decode($str, \ENT_QUOTES | \ENT_HTML5); |
@@ -10017,7 +10017,7 @@ discard block |
||
10017 | 10017 | return ''; |
10018 | 10018 | } |
10019 | 10019 | |
10020 | - return (string) \preg_replace('/[[:space:]]+/u', '', $str); |
|
10020 | + return (string)\preg_replace('/[[:space:]]+/u', '', $str); |
|
10021 | 10021 | } |
10022 | 10022 | |
10023 | 10023 | /** |
@@ -10096,7 +10096,7 @@ discard block |
||
10096 | 10096 | // fallback for ascii only |
10097 | 10097 | // |
10098 | 10098 | |
10099 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10099 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10100 | 10100 | return \stripos($haystack, $needle, $offset); |
10101 | 10101 | } |
10102 | 10102 | |
@@ -10185,7 +10185,7 @@ discard block |
||
10185 | 10185 | /** |
10186 | 10186 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10187 | 10187 | */ |
10188 | - \trigger_error('UTF8::stristr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10188 | + \trigger_error('UTF8::stristr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10189 | 10189 | } |
10190 | 10190 | |
10191 | 10191 | if ( |
@@ -10199,11 +10199,11 @@ discard block |
||
10199 | 10199 | } |
10200 | 10200 | } |
10201 | 10201 | |
10202 | - if (ASCII::is_ascii($needle . $haystack)) { |
|
10202 | + if (ASCII::is_ascii($needle.$haystack)) { |
|
10203 | 10203 | return \stristr($haystack, $needle, $before_needle); |
10204 | 10204 | } |
10205 | 10205 | |
10206 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/usi', $haystack, $match); |
|
10206 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/usi', $haystack, $match); |
|
10207 | 10207 | |
10208 | 10208 | if (!isset($match[1])) { |
10209 | 10209 | return false; |
@@ -10213,7 +10213,7 @@ discard block |
||
10213 | 10213 | return $match[1]; |
10214 | 10214 | } |
10215 | 10215 | |
10216 | - return self::substr($haystack, (int) self::strlen($match[1], $encoding), null, $encoding); |
|
10216 | + return self::substr($haystack, (int)self::strlen($match[1], $encoding), null, $encoding); |
|
10217 | 10217 | } |
10218 | 10218 | |
10219 | 10219 | /** |
@@ -10296,7 +10296,7 @@ discard block |
||
10296 | 10296 | /** |
10297 | 10297 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10298 | 10298 | */ |
10299 | - \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10299 | + \trigger_error('UTF8::strlen() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10300 | 10300 | } |
10301 | 10301 | |
10302 | 10302 | // |
@@ -10434,8 +10434,8 @@ discard block |
||
10434 | 10434 | } |
10435 | 10435 | |
10436 | 10436 | return \strnatcmp( |
10437 | - (string) self::strtonatfold($str1), |
|
10438 | - (string) self::strtonatfold($str2) |
|
10437 | + (string)self::strtonatfold($str1), |
|
10438 | + (string)self::strtonatfold($str2) |
|
10439 | 10439 | ); |
10440 | 10440 | } |
10441 | 10441 | |
@@ -10505,11 +10505,11 @@ discard block |
||
10505 | 10505 | } |
10506 | 10506 | |
10507 | 10507 | if ($encoding === 'UTF-8') { |
10508 | - $str1 = (string) \mb_substr($str1, 0, $len); |
|
10509 | - $str2 = (string) \mb_substr($str2, 0, $len); |
|
10508 | + $str1 = (string)\mb_substr($str1, 0, $len); |
|
10509 | + $str2 = (string)\mb_substr($str2, 0, $len); |
|
10510 | 10510 | } else { |
10511 | - $str1 = (string) self::substr($str1, 0, $len, $encoding); |
|
10512 | - $str2 = (string) self::substr($str2, 0, $len, $encoding); |
|
10511 | + $str1 = (string)self::substr($str1, 0, $len, $encoding); |
|
10512 | + $str2 = (string)self::substr($str2, 0, $len, $encoding); |
|
10513 | 10513 | } |
10514 | 10514 | |
10515 | 10515 | return self::strcmp($str1, $str2); |
@@ -10536,8 +10536,8 @@ discard block |
||
10536 | 10536 | return false; |
10537 | 10537 | } |
10538 | 10538 | |
10539 | - if (\preg_match('/' . self::rxClass($char_list) . '/us', $haystack, $m)) { |
|
10540 | - return \substr($haystack, (int) \strpos($haystack, $m[0])); |
|
10539 | + if (\preg_match('/'.self::rxClass($char_list).'/us', $haystack, $m)) { |
|
10540 | + return \substr($haystack, (int)\strpos($haystack, $m[0])); |
|
10541 | 10541 | } |
10542 | 10542 | |
10543 | 10543 | return false; |
@@ -10582,10 +10582,10 @@ discard block |
||
10582 | 10582 | } |
10583 | 10583 | |
10584 | 10584 | // iconv and mbstring do not support integer $needle |
10585 | - if ((int) $needle === $needle) { |
|
10586 | - $needle = (string) self::chr($needle); |
|
10585 | + if ((int)$needle === $needle) { |
|
10586 | + $needle = (string)self::chr($needle); |
|
10587 | 10587 | } |
10588 | - $needle = (string) $needle; |
|
10588 | + $needle = (string)$needle; |
|
10589 | 10589 | |
10590 | 10590 | if ($haystack === '') { |
10591 | 10591 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -10645,7 +10645,7 @@ discard block |
||
10645 | 10645 | /** |
10646 | 10646 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10647 | 10647 | */ |
10648 | - \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10648 | + \trigger_error('UTF8::strpos() without mbstring / iconv cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10649 | 10649 | } |
10650 | 10650 | |
10651 | 10651 | // |
@@ -10686,7 +10686,7 @@ discard block |
||
10686 | 10686 | // fallback for ascii only |
10687 | 10687 | // |
10688 | 10688 | |
10689 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
10689 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
10690 | 10690 | /** @noinspection PhpUsageOfSilenceOperatorInspection - Offset not contained in string */ |
10691 | 10691 | return @\strpos($haystack, $needle, $offset); |
10692 | 10692 | } |
@@ -10699,7 +10699,7 @@ discard block |
||
10699 | 10699 | if ($haystack_tmp === false) { |
10700 | 10700 | $haystack_tmp = ''; |
10701 | 10701 | } |
10702 | - $haystack = (string) $haystack_tmp; |
|
10702 | + $haystack = (string)$haystack_tmp; |
|
10703 | 10703 | |
10704 | 10704 | if ($offset < 0) { |
10705 | 10705 | $offset = 0; |
@@ -10711,7 +10711,7 @@ discard block |
||
10711 | 10711 | } |
10712 | 10712 | |
10713 | 10713 | if ($pos) { |
10714 | - return $offset + (int) self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10714 | + return $offset + (int)self::strlen(\substr($haystack, 0, $pos), $encoding); |
|
10715 | 10715 | } |
10716 | 10716 | |
10717 | 10717 | return $offset + 0; |
@@ -10866,7 +10866,7 @@ discard block |
||
10866 | 10866 | /** |
10867 | 10867 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
10868 | 10868 | */ |
10869 | - \trigger_error('UTF8::strrchr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
10869 | + \trigger_error('UTF8::strrchr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
10870 | 10870 | } |
10871 | 10871 | |
10872 | 10872 | // |
@@ -10878,7 +10878,7 @@ discard block |
||
10878 | 10878 | if ($needle_tmp === false) { |
10879 | 10879 | return false; |
10880 | 10880 | } |
10881 | - $needle = (string) $needle_tmp; |
|
10881 | + $needle = (string)$needle_tmp; |
|
10882 | 10882 | |
10883 | 10883 | $pos = \iconv_strrpos($haystack, $needle, $encoding); |
10884 | 10884 | if ($pos === false) { |
@@ -10900,7 +10900,7 @@ discard block |
||
10900 | 10900 | if ($needle_tmp === false) { |
10901 | 10901 | return false; |
10902 | 10902 | } |
10903 | - $needle = (string) $needle_tmp; |
|
10903 | + $needle = (string)$needle_tmp; |
|
10904 | 10904 | |
10905 | 10905 | $pos = self::strrpos($haystack, $needle, 0, $encoding); |
10906 | 10906 | if ($pos === false) { |
@@ -10941,7 +10941,7 @@ discard block |
||
10941 | 10941 | if ($encoding === 'UTF-8') { |
10942 | 10942 | if (self::$SUPPORT['intl'] === true) { |
10943 | 10943 | // try "grapheme" first: https://stackoverflow.com/questions/17496493/strrev-dosent-support-utf-8 |
10944 | - $i = (int) \grapheme_strlen($str); |
|
10944 | + $i = (int)\grapheme_strlen($str); |
|
10945 | 10945 | while ($i--) { |
10946 | 10946 | $reversed_tmp = \grapheme_substr($str, $i, 1); |
10947 | 10947 | if ($reversed_tmp !== false) { |
@@ -10949,7 +10949,7 @@ discard block |
||
10949 | 10949 | } |
10950 | 10950 | } |
10951 | 10951 | } else { |
10952 | - $i = (int) \mb_strlen($str); |
|
10952 | + $i = (int)\mb_strlen($str); |
|
10953 | 10953 | while ($i--) { |
10954 | 10954 | $reversed_tmp = \mb_substr($str, $i, 1); |
10955 | 10955 | if ($reversed_tmp !== false) { |
@@ -10960,7 +10960,7 @@ discard block |
||
10960 | 10960 | } else { |
10961 | 10961 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
10962 | 10962 | |
10963 | - $i = (int) self::strlen($str, $encoding); |
|
10963 | + $i = (int)self::strlen($str, $encoding); |
|
10964 | 10964 | while ($i--) { |
10965 | 10965 | $reversed_tmp = self::substr($str, $i, 1, $encoding); |
10966 | 10966 | if ($reversed_tmp !== false) { |
@@ -11039,7 +11039,7 @@ discard block |
||
11039 | 11039 | if ($needle_tmp === false) { |
11040 | 11040 | return false; |
11041 | 11041 | } |
11042 | - $needle = (string) $needle_tmp; |
|
11042 | + $needle = (string)$needle_tmp; |
|
11043 | 11043 | |
11044 | 11044 | $pos = self::strripos($haystack, $needle, 0, $encoding); |
11045 | 11045 | if ($pos === false) { |
@@ -11088,10 +11088,10 @@ discard block |
||
11088 | 11088 | } |
11089 | 11089 | |
11090 | 11090 | // iconv and mbstring do not support integer $needle |
11091 | - if ((int) $needle === $needle && $needle >= 0) { |
|
11092 | - $needle = (string) self::chr($needle); |
|
11091 | + if ((int)$needle === $needle && $needle >= 0) { |
|
11092 | + $needle = (string)self::chr($needle); |
|
11093 | 11093 | } |
11094 | - $needle = (string) $needle; |
|
11094 | + $needle = (string)$needle; |
|
11095 | 11095 | |
11096 | 11096 | if ($haystack === '') { |
11097 | 11097 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -11147,7 +11147,7 @@ discard block |
||
11147 | 11147 | /** |
11148 | 11148 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11149 | 11149 | */ |
11150 | - \trigger_error('UTF8::strripos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11150 | + \trigger_error('UTF8::strripos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11151 | 11151 | } |
11152 | 11152 | |
11153 | 11153 | // |
@@ -11171,7 +11171,7 @@ discard block |
||
11171 | 11171 | // fallback for ascii only |
11172 | 11172 | // |
11173 | 11173 | |
11174 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11174 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11175 | 11175 | return \strripos($haystack, $needle, $offset); |
11176 | 11176 | } |
11177 | 11177 | |
@@ -11260,10 +11260,10 @@ discard block |
||
11260 | 11260 | } |
11261 | 11261 | |
11262 | 11262 | // iconv and mbstring do not support integer $needle |
11263 | - if ((int) $needle === $needle && $needle >= 0) { |
|
11264 | - $needle = (string) self::chr($needle); |
|
11263 | + if ((int)$needle === $needle && $needle >= 0) { |
|
11264 | + $needle = (string)self::chr($needle); |
|
11265 | 11265 | } |
11266 | - $needle = (string) $needle; |
|
11266 | + $needle = (string)$needle; |
|
11267 | 11267 | |
11268 | 11268 | if ($haystack === '') { |
11269 | 11269 | if (\PHP_VERSION_ID >= 80000 && $needle === '') { |
@@ -11319,7 +11319,7 @@ discard block |
||
11319 | 11319 | /** |
11320 | 11320 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11321 | 11321 | */ |
11322 | - \trigger_error('UTF8::strrpos() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11322 | + \trigger_error('UTF8::strrpos() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11323 | 11323 | } |
11324 | 11324 | |
11325 | 11325 | // |
@@ -11343,7 +11343,7 @@ discard block |
||
11343 | 11343 | // fallback for ascii only |
11344 | 11344 | // |
11345 | 11345 | |
11346 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11346 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11347 | 11347 | return \strrpos($haystack, $needle, $offset); |
11348 | 11348 | } |
11349 | 11349 | |
@@ -11363,7 +11363,7 @@ discard block |
||
11363 | 11363 | if ($haystack_tmp === false) { |
11364 | 11364 | $haystack_tmp = ''; |
11365 | 11365 | } |
11366 | - $haystack = (string) $haystack_tmp; |
|
11366 | + $haystack = (string)$haystack_tmp; |
|
11367 | 11367 | } |
11368 | 11368 | |
11369 | 11369 | $pos = \strrpos($haystack, $needle); |
@@ -11377,7 +11377,7 @@ discard block |
||
11377 | 11377 | return false; |
11378 | 11378 | } |
11379 | 11379 | |
11380 | - return $offset + (int) self::strlen($str_tmp); |
|
11380 | + return $offset + (int)self::strlen($str_tmp); |
|
11381 | 11381 | } |
11382 | 11382 | |
11383 | 11383 | /** |
@@ -11445,12 +11445,12 @@ discard block |
||
11445 | 11445 | if ($offset || $length !== null) { |
11446 | 11446 | if ($encoding === 'UTF-8') { |
11447 | 11447 | if ($length === null) { |
11448 | - $str = (string) \mb_substr($str, $offset); |
|
11448 | + $str = (string)\mb_substr($str, $offset); |
|
11449 | 11449 | } else { |
11450 | - $str = (string) \mb_substr($str, $offset, $length); |
|
11450 | + $str = (string)\mb_substr($str, $offset, $length); |
|
11451 | 11451 | } |
11452 | 11452 | } else { |
11453 | - $str = (string) self::substr($str, $offset, $length, $encoding); |
|
11453 | + $str = (string)self::substr($str, $offset, $length, $encoding); |
|
11454 | 11454 | } |
11455 | 11455 | } |
11456 | 11456 | |
@@ -11460,7 +11460,7 @@ discard block |
||
11460 | 11460 | |
11461 | 11461 | $matches = []; |
11462 | 11462 | |
11463 | - return \preg_match('/^' . self::rxClass($mask) . '+/u', $str, $matches) ? (int) self::strlen($matches[0], $encoding) : 0; |
|
11463 | + return \preg_match('/^'.self::rxClass($mask).'+/u', $str, $matches) ? (int)self::strlen($matches[0], $encoding) : 0; |
|
11464 | 11464 | } |
11465 | 11465 | |
11466 | 11466 | /** |
@@ -11554,7 +11554,7 @@ discard block |
||
11554 | 11554 | /** |
11555 | 11555 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11556 | 11556 | */ |
11557 | - \trigger_error('UTF8::strstr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
11557 | + \trigger_error('UTF8::strstr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
11558 | 11558 | } |
11559 | 11559 | |
11560 | 11560 | // |
@@ -11576,7 +11576,7 @@ discard block |
||
11576 | 11576 | // fallback for ascii only |
11577 | 11577 | // |
11578 | 11578 | |
11579 | - if (ASCII::is_ascii($haystack . $needle)) { |
|
11579 | + if (ASCII::is_ascii($haystack.$needle)) { |
|
11580 | 11580 | return \strstr($haystack, $needle, $before_needle); |
11581 | 11581 | } |
11582 | 11582 | |
@@ -11584,7 +11584,7 @@ discard block |
||
11584 | 11584 | // fallback via vanilla php |
11585 | 11585 | // |
11586 | 11586 | |
11587 | - \preg_match('/^(.*?)' . \preg_quote($needle, '/') . '/us', $haystack, $match); |
|
11587 | + \preg_match('/^(.*?)'.\preg_quote($needle, '/').'/us', $haystack, $match); |
|
11588 | 11588 | |
11589 | 11589 | if (!isset($match[1])) { |
11590 | 11590 | return false; |
@@ -11594,7 +11594,7 @@ discard block |
||
11594 | 11594 | return $match[1]; |
11595 | 11595 | } |
11596 | 11596 | |
11597 | - return self::substr($haystack, (int) self::strlen($match[1])); |
|
11597 | + return self::substr($haystack, (int)self::strlen($match[1])); |
|
11598 | 11598 | } |
11599 | 11599 | |
11600 | 11600 | /** |
@@ -11724,7 +11724,7 @@ discard block |
||
11724 | 11724 | bool $try_to_keep_the_string_length = false |
11725 | 11725 | ): string { |
11726 | 11726 | // init |
11727 | - $str = (string) $str; |
|
11727 | + $str = (string)$str; |
|
11728 | 11728 | |
11729 | 11729 | if ($str === '') { |
11730 | 11730 | return ''; |
@@ -11753,25 +11753,25 @@ discard block |
||
11753 | 11753 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11754 | 11754 | } |
11755 | 11755 | |
11756 | - $language_code = $lang . '-Lower'; |
|
11756 | + $language_code = $lang.'-Lower'; |
|
11757 | 11757 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11758 | 11758 | /** |
11759 | 11759 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11760 | 11760 | */ |
11761 | - \trigger_error('UTF8::strtolower() cannot handle special language: ' . $lang . ' | supported: ' . \print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11761 | + \trigger_error('UTF8::strtolower() cannot handle special language: '.$lang.' | supported: '.\print_r(self::$INTL_TRANSLITERATOR_LIST, true), \E_USER_WARNING); |
|
11762 | 11762 | |
11763 | 11763 | $language_code = 'Any-Lower'; |
11764 | 11764 | } |
11765 | 11765 | |
11766 | 11766 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11767 | 11767 | /** @noinspection UnnecessaryCastingInspection */ |
11768 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11768 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11769 | 11769 | } |
11770 | 11770 | |
11771 | 11771 | /** |
11772 | 11772 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11773 | 11773 | */ |
11774 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: ' . $lang, \E_USER_WARNING); |
|
11774 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang" parameter: '.$lang, \E_USER_WARNING); |
|
11775 | 11775 | } |
11776 | 11776 | |
11777 | 11777 | // always fallback via symfony polyfill |
@@ -11806,7 +11806,7 @@ discard block |
||
11806 | 11806 | bool $try_to_keep_the_string_length = false |
11807 | 11807 | ): string { |
11808 | 11808 | // init |
11809 | - $str = (string) $str; |
|
11809 | + $str = (string)$str; |
|
11810 | 11810 | |
11811 | 11811 | if ($str === '') { |
11812 | 11812 | return ''; |
@@ -11835,25 +11835,25 @@ discard block |
||
11835 | 11835 | self::$INTL_TRANSLITERATOR_LIST = self::getData('transliterator_list'); |
11836 | 11836 | } |
11837 | 11837 | |
11838 | - $language_code = $lang . '-Upper'; |
|
11838 | + $language_code = $lang.'-Upper'; |
|
11839 | 11839 | if (!\in_array($language_code, self::$INTL_TRANSLITERATOR_LIST, true)) { |
11840 | 11840 | /** |
11841 | 11841 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11842 | 11842 | */ |
11843 | - \trigger_error('UTF8::strtoupper() without intl for special language: ' . $lang, \E_USER_WARNING); |
|
11843 | + \trigger_error('UTF8::strtoupper() without intl for special language: '.$lang, \E_USER_WARNING); |
|
11844 | 11844 | |
11845 | 11845 | $language_code = 'Any-Upper'; |
11846 | 11846 | } |
11847 | 11847 | |
11848 | 11848 | /** @noinspection PhpComposerExtensionStubsInspection */ |
11849 | 11849 | /** @noinspection UnnecessaryCastingInspection */ |
11850 | - return (string) \transliterator_transliterate($language_code, $str); |
|
11850 | + return (string)\transliterator_transliterate($language_code, $str); |
|
11851 | 11851 | } |
11852 | 11852 | |
11853 | 11853 | /** |
11854 | 11854 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
11855 | 11855 | */ |
11856 | - \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: ' . $lang, \E_USER_WARNING); |
|
11856 | + \trigger_error('UTF8::strtolower() without intl cannot handle the "lang"-parameter: '.$lang, \E_USER_WARNING); |
|
11857 | 11857 | } |
11858 | 11858 | |
11859 | 11859 | // always fallback via symfony polyfill |
@@ -11917,7 +11917,7 @@ discard block |
||
11917 | 11917 | $from = \array_combine($from, $to); |
11918 | 11918 | /** @noinspection CallableParameterUseCaseInTypeContextInspection - FP */ |
11919 | 11919 | if ($from === false) { |
11920 | - 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) . ')'); |
|
11920 | + 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).')'); |
|
11921 | 11921 | } |
11922 | 11922 | } |
11923 | 11923 | |
@@ -11983,9 +11983,9 @@ discard block |
||
11983 | 11983 | } |
11984 | 11984 | |
11985 | 11985 | $wide = 0; |
11986 | - $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); |
|
11986 | + $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); |
|
11987 | 11987 | |
11988 | - return ($wide << 1) + (int) self::strlen($str); |
|
11988 | + return ($wide << 1) + (int)self::strlen($str); |
|
11989 | 11989 | } |
11990 | 11990 | |
11991 | 11991 | /** |
@@ -12084,7 +12084,7 @@ discard block |
||
12084 | 12084 | return ''; |
12085 | 12085 | } |
12086 | 12086 | |
12087 | - $length = $length ?? (int) $str_length; |
|
12087 | + $length = $length ?? (int)$str_length; |
|
12088 | 12088 | |
12089 | 12089 | if ( |
12090 | 12090 | $encoding !== 'UTF-8' |
@@ -12094,7 +12094,7 @@ discard block |
||
12094 | 12094 | /** |
12095 | 12095 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
12096 | 12096 | */ |
12097 | - \trigger_error('UTF8::substr() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
12097 | + \trigger_error('UTF8::substr() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
12098 | 12098 | } |
12099 | 12099 | |
12100 | 12100 | // |
@@ -12189,16 +12189,16 @@ discard block |
||
12189 | 12189 | ) { |
12190 | 12190 | if ($encoding === 'UTF-8') { |
12191 | 12191 | if ($length === null) { |
12192 | - $str1 = (string) \mb_substr($str1, $offset); |
|
12192 | + $str1 = (string)\mb_substr($str1, $offset); |
|
12193 | 12193 | } else { |
12194 | - $str1 = (string) \mb_substr($str1, $offset, $length); |
|
12194 | + $str1 = (string)\mb_substr($str1, $offset, $length); |
|
12195 | 12195 | } |
12196 | - $str2 = (string) \mb_substr($str2, 0, (int) self::strlen($str1)); |
|
12196 | + $str2 = (string)\mb_substr($str2, 0, (int)self::strlen($str1)); |
|
12197 | 12197 | } else { |
12198 | 12198 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12199 | 12199 | |
12200 | - $str1 = (string) self::substr($str1, $offset, $length, $encoding); |
|
12201 | - $str2 = (string) self::substr($str2, 0, (int) self::strlen($str1), $encoding); |
|
12200 | + $str1 = (string)self::substr($str1, $offset, $length, $encoding); |
|
12201 | + $str2 = (string)self::substr($str2, 0, (int)self::strlen($str1), $encoding); |
|
12202 | 12202 | } |
12203 | 12203 | } |
12204 | 12204 | |
@@ -12273,13 +12273,13 @@ discard block |
||
12273 | 12273 | if ($length_tmp === false) { |
12274 | 12274 | return false; |
12275 | 12275 | } |
12276 | - $length = (int) $length_tmp; |
|
12276 | + $length = (int)$length_tmp; |
|
12277 | 12277 | } |
12278 | 12278 | |
12279 | 12279 | if ($encoding === 'UTF-8') { |
12280 | - $haystack = (string) \mb_substr($haystack, $offset, $length); |
|
12280 | + $haystack = (string)\mb_substr($haystack, $offset, $length); |
|
12281 | 12281 | } else { |
12282 | - $haystack = (string) \mb_substr($haystack, $offset, $length, $encoding); |
|
12282 | + $haystack = (string)\mb_substr($haystack, $offset, $length, $encoding); |
|
12283 | 12283 | } |
12284 | 12284 | } |
12285 | 12285 | |
@@ -12291,7 +12291,7 @@ discard block |
||
12291 | 12291 | /** |
12292 | 12292 | * @psalm-suppress ImpureFunctionCall - is is only a warning |
12293 | 12293 | */ |
12294 | - \trigger_error('UTF8::substr_count() without mbstring cannot handle "' . $encoding . '" encoding', \E_USER_WARNING); |
|
12294 | + \trigger_error('UTF8::substr_count() without mbstring cannot handle "'.$encoding.'" encoding', \E_USER_WARNING); |
|
12295 | 12295 | } |
12296 | 12296 | |
12297 | 12297 | if (self::$SUPPORT['mbstring'] === true) { |
@@ -12302,7 +12302,7 @@ discard block |
||
12302 | 12302 | return \mb_substr_count($haystack, $needle, $encoding); |
12303 | 12303 | } |
12304 | 12304 | |
12305 | - \preg_match_all('/' . \preg_quote($needle, '/') . '/us', $haystack, $matches, \PREG_SET_ORDER); |
|
12305 | + \preg_match_all('/'.\preg_quote($needle, '/').'/us', $haystack, $matches, \PREG_SET_ORDER); |
|
12306 | 12306 | |
12307 | 12307 | return \count($matches); |
12308 | 12308 | } |
@@ -12352,7 +12352,7 @@ discard block |
||
12352 | 12352 | if ($length_tmp === false) { |
12353 | 12353 | return false; |
12354 | 12354 | } |
12355 | - $length = (int) $length_tmp; |
|
12355 | + $length = (int)$length_tmp; |
|
12356 | 12356 | } |
12357 | 12357 | |
12358 | 12358 | if ( |
@@ -12374,7 +12374,7 @@ discard block |
||
12374 | 12374 | if ($haystack_tmp === false) { |
12375 | 12375 | $haystack_tmp = ''; |
12376 | 12376 | } |
12377 | - $haystack = (string) $haystack_tmp; |
|
12377 | + $haystack = (string)$haystack_tmp; |
|
12378 | 12378 | } |
12379 | 12379 | |
12380 | 12380 | if (self::$SUPPORT['mbstring_func_overload'] === true) { |
@@ -12415,10 +12415,10 @@ discard block |
||
12415 | 12415 | |
12416 | 12416 | if ($encoding === 'UTF-8') { |
12417 | 12417 | if ($case_sensitive) { |
12418 | - return (int) \mb_substr_count($str, $substring); |
|
12418 | + return (int)\mb_substr_count($str, $substring); |
|
12419 | 12419 | } |
12420 | 12420 | |
12421 | - return (int) \mb_substr_count( |
|
12421 | + return (int)\mb_substr_count( |
|
12422 | 12422 | \mb_strtoupper($str), |
12423 | 12423 | \mb_strtoupper($substring) |
12424 | 12424 | ); |
@@ -12427,10 +12427,10 @@ discard block |
||
12427 | 12427 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
12428 | 12428 | |
12429 | 12429 | if ($case_sensitive) { |
12430 | - return (int) \mb_substr_count($str, $substring, $encoding); |
|
12430 | + return (int)\mb_substr_count($str, $substring, $encoding); |
|
12431 | 12431 | } |
12432 | 12432 | |
12433 | - return (int) \mb_substr_count( |
|
12433 | + return (int)\mb_substr_count( |
|
12434 | 12434 | self::strtocasefold($str, true, false, $encoding, null, false), |
12435 | 12435 | self::strtocasefold($substring, true, false, $encoding, null, false), |
12436 | 12436 | $encoding |
@@ -12464,7 +12464,7 @@ discard block |
||
12464 | 12464 | } |
12465 | 12465 | |
12466 | 12466 | if (self::str_istarts_with($haystack, $needle)) { |
12467 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
12467 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
12468 | 12468 | } |
12469 | 12469 | |
12470 | 12470 | return $haystack; |
@@ -12531,7 +12531,7 @@ discard block |
||
12531 | 12531 | } |
12532 | 12532 | |
12533 | 12533 | if (self::str_iends_with($haystack, $needle)) { |
12534 | - $haystack = (string) \mb_substr($haystack, 0, (int) self::strlen($haystack) - (int) self::strlen($needle)); |
|
12534 | + $haystack = (string)\mb_substr($haystack, 0, (int)self::strlen($haystack) - (int)self::strlen($needle)); |
|
12535 | 12535 | } |
12536 | 12536 | |
12537 | 12537 | return $haystack; |
@@ -12564,7 +12564,7 @@ discard block |
||
12564 | 12564 | } |
12565 | 12565 | |
12566 | 12566 | if (self::str_starts_with($haystack, $needle)) { |
12567 | - $haystack = (string) \mb_substr($haystack, (int) self::strlen($needle)); |
|
12567 | + $haystack = (string)\mb_substr($haystack, (int)self::strlen($needle)); |
|
12568 | 12568 | } |
12569 | 12569 | |
12570 | 12570 | return $haystack; |
@@ -12621,7 +12621,7 @@ discard block |
||
12621 | 12621 | if (\is_array($offset)) { |
12622 | 12622 | $offset = \array_slice($offset, 0, $num); |
12623 | 12623 | foreach ($offset as &$value_tmp) { |
12624 | - $value_tmp = (int) $value_tmp === $value_tmp ? $value_tmp : 0; |
|
12624 | + $value_tmp = (int)$value_tmp === $value_tmp ? $value_tmp : 0; |
|
12625 | 12625 | } |
12626 | 12626 | unset($value_tmp); |
12627 | 12627 | } else { |
@@ -12634,7 +12634,7 @@ discard block |
||
12634 | 12634 | } elseif (\is_array($length)) { |
12635 | 12635 | $length = \array_slice($length, 0, $num); |
12636 | 12636 | foreach ($length as &$value_tmp_V2) { |
12637 | - $value_tmp_V2 = (int) $value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
12637 | + $value_tmp_V2 = (int)$value_tmp_V2 === $value_tmp_V2 ? $value_tmp_V2 : $num; |
|
12638 | 12638 | } |
12639 | 12639 | unset($value_tmp_V2); |
12640 | 12640 | } else { |
@@ -12654,8 +12654,8 @@ discard block |
||
12654 | 12654 | } |
12655 | 12655 | |
12656 | 12656 | // init |
12657 | - $str = (string) $str; |
|
12658 | - $replacement = (string) $replacement; |
|
12657 | + $str = (string)$str; |
|
12658 | + $replacement = (string)$replacement; |
|
12659 | 12659 | |
12660 | 12660 | if (\is_array($length)) { |
12661 | 12661 | throw new \InvalidArgumentException('Parameter "$length" can only be an array, if "$str" is also an array.'); |
@@ -12670,16 +12670,16 @@ discard block |
||
12670 | 12670 | } |
12671 | 12671 | |
12672 | 12672 | if (self::$SUPPORT['mbstring'] === true) { |
12673 | - $string_length = (int) self::strlen($str, $encoding); |
|
12673 | + $string_length = (int)self::strlen($str, $encoding); |
|
12674 | 12674 | |
12675 | 12675 | if ($offset < 0) { |
12676 | - $offset = (int) \max(0, $string_length + $offset); |
|
12676 | + $offset = (int)\max(0, $string_length + $offset); |
|
12677 | 12677 | } elseif ($offset > $string_length) { |
12678 | 12678 | $offset = $string_length; |
12679 | 12679 | } |
12680 | 12680 | |
12681 | 12681 | if ($length !== null && $length < 0) { |
12682 | - $length = (int) \max(0, $string_length - $offset + $length); |
|
12682 | + $length = (int)\max(0, $string_length - $offset + $length); |
|
12683 | 12683 | } elseif ($length === null || $length > $string_length) { |
12684 | 12684 | $length = $string_length; |
12685 | 12685 | } |
@@ -12690,9 +12690,9 @@ discard block |
||
12690 | 12690 | } |
12691 | 12691 | |
12692 | 12692 | /** @noinspection AdditionOperationOnArraysInspection */ |
12693 | - return ((string) \mb_substr($str, 0, $offset, $encoding)) . |
|
12694 | - $replacement . |
|
12695 | - ((string) \mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
12693 | + return ((string)\mb_substr($str, 0, $offset, $encoding)). |
|
12694 | + $replacement. |
|
12695 | + ((string)\mb_substr($str, $offset + $length, $string_length - $offset - $length, $encoding)); |
|
12696 | 12696 | } |
12697 | 12697 | |
12698 | 12698 | // |
@@ -12701,8 +12701,7 @@ discard block |
||
12701 | 12701 | |
12702 | 12702 | if (ASCII::is_ascii($str)) { |
12703 | 12703 | return ($length === null) ? |
12704 | - \substr_replace($str, $replacement, $offset) : |
|
12705 | - \substr_replace($str, $replacement, $offset, $length); |
|
12704 | + \substr_replace($str, $replacement, $offset) : \substr_replace($str, $replacement, $offset, $length); |
|
12706 | 12705 | } |
12707 | 12706 | |
12708 | 12707 | // |
@@ -12718,7 +12717,7 @@ discard block |
||
12718 | 12717 | // e.g.: non mbstring support + invalid chars |
12719 | 12718 | return ''; |
12720 | 12719 | } |
12721 | - $length = (int) $length_tmp; |
|
12720 | + $length = (int)$length_tmp; |
|
12722 | 12721 | } |
12723 | 12722 | |
12724 | 12723 | \array_splice($str_matches[0], $offset, $length, $replacement_matches[0]); |
@@ -12761,14 +12760,14 @@ discard block |
||
12761 | 12760 | && |
12762 | 12761 | \substr($haystack, -\strlen($needle)) === $needle |
12763 | 12762 | ) { |
12764 | - return (string) \mb_substr($haystack, 0, (int) \mb_strlen($haystack) - (int) \mb_strlen($needle)); |
|
12763 | + return (string)\mb_substr($haystack, 0, (int)\mb_strlen($haystack) - (int)\mb_strlen($needle)); |
|
12765 | 12764 | } |
12766 | 12765 | |
12767 | 12766 | if (\substr($haystack, -\strlen($needle)) === $needle) { |
12768 | - return (string) self::substr( |
|
12767 | + return (string)self::substr( |
|
12769 | 12768 | $haystack, |
12770 | 12769 | 0, |
12771 | - (int) self::strlen($haystack, $encoding) - (int) self::strlen($needle, $encoding), |
|
12770 | + (int)self::strlen($haystack, $encoding) - (int)self::strlen($needle, $encoding), |
|
12772 | 12771 | $encoding |
12773 | 12772 | ); |
12774 | 12773 | } |
@@ -12803,10 +12802,10 @@ discard block |
||
12803 | 12802 | } |
12804 | 12803 | |
12805 | 12804 | if ($encoding === 'UTF-8') { |
12806 | - return (string) (\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12805 | + return (string)(\mb_strtolower($str) ^ \mb_strtoupper($str) ^ $str); |
|
12807 | 12806 | } |
12808 | 12807 | |
12809 | - return (string) (self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12808 | + return (string)(self::strtolower($str, $encoding) ^ self::strtoupper($str, $encoding) ^ $str); |
|
12810 | 12809 | } |
12811 | 12810 | |
12812 | 12811 | /** |
@@ -13018,7 +13017,7 @@ discard block |
||
13018 | 13017 | public static function to_boolean($str): bool |
13019 | 13018 | { |
13020 | 13019 | // init |
13021 | - $str = (string) $str; |
|
13020 | + $str = (string)$str; |
|
13022 | 13021 | |
13023 | 13022 | if ($str === '') { |
13024 | 13023 | return false; |
@@ -13046,10 +13045,10 @@ discard block |
||
13046 | 13045 | } |
13047 | 13046 | |
13048 | 13047 | if (\is_numeric($str)) { |
13049 | - return ((float) $str + 0) > 0; |
|
13048 | + return ((float)$str + 0) > 0; |
|
13050 | 13049 | } |
13051 | 13050 | |
13052 | - return (bool) \trim($str); |
|
13051 | + return (bool)\trim($str); |
|
13053 | 13052 | } |
13054 | 13053 | |
13055 | 13054 | /** |
@@ -13097,7 +13096,7 @@ discard block |
||
13097 | 13096 | return $str; |
13098 | 13097 | } |
13099 | 13098 | |
13100 | - $str = (string) $str; |
|
13099 | + $str = (string)$str; |
|
13101 | 13100 | if ($str === '') { |
13102 | 13101 | return ''; |
13103 | 13102 | } |
@@ -13205,7 +13204,7 @@ discard block |
||
13205 | 13204 | $c2 = $i + 1 >= $max ? "\x00" : $str[$i + 1]; |
13206 | 13205 | |
13207 | 13206 | if ($c2 >= "\x80" && $c2 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13208 | - $buf .= $c1 . $c2; |
|
13207 | + $buf .= $c1.$c2; |
|
13209 | 13208 | ++$i; |
13210 | 13209 | } else { // not valid UTF8 - convert it |
13211 | 13210 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13216,7 +13215,7 @@ discard block |
||
13216 | 13215 | $c3 = $i + 2 >= $max ? "\x00" : $str[$i + 2]; |
13217 | 13216 | |
13218 | 13217 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13219 | - $buf .= $c1 . $c2 . $c3; |
|
13218 | + $buf .= $c1.$c2.$c3; |
|
13220 | 13219 | $i += 2; |
13221 | 13220 | } else { // not valid UTF8 - convert it |
13222 | 13221 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13228,7 +13227,7 @@ discard block |
||
13228 | 13227 | $c4 = $i + 3 >= $max ? "\x00" : $str[$i + 3]; |
13229 | 13228 | |
13230 | 13229 | if ($c2 >= "\x80" && $c2 <= "\xBF" && $c3 >= "\x80" && $c3 <= "\xBF" && $c4 >= "\x80" && $c4 <= "\xBF") { // yeah, almost sure it's UTF8 already |
13231 | - $buf .= $c1 . $c2 . $c3 . $c4; |
|
13230 | + $buf .= $c1.$c2.$c3.$c4; |
|
13232 | 13231 | $i += 3; |
13233 | 13232 | } else { // not valid UTF8 - convert it |
13234 | 13233 | $buf .= self::to_utf8_convert_helper($c1); |
@@ -13256,13 +13255,13 @@ discard block |
||
13256 | 13255 | * |
13257 | 13256 | * @return string |
13258 | 13257 | */ |
13259 | - static function (array $matches): string { |
|
13258 | + static function(array $matches): string { |
|
13260 | 13259 | if (isset($matches[3])) { |
13261 | - $cp = (int) \hexdec($matches[3]); |
|
13260 | + $cp = (int)\hexdec($matches[3]); |
|
13262 | 13261 | } else { |
13263 | 13262 | // http://unicode.org/faq/utf_bom.html#utf16-4 |
13264 | - $cp = ((int) \hexdec($matches[1]) << 10) |
|
13265 | - + (int) \hexdec($matches[2]) |
|
13263 | + $cp = ((int)\hexdec($matches[1]) << 10) |
|
13264 | + + (int)\hexdec($matches[2]) |
|
13266 | 13265 | + 0x10000 |
13267 | 13266 | - (0xD800 << 10) |
13268 | 13267 | - 0xDC00; |
@@ -13273,12 +13272,12 @@ discard block |
||
13273 | 13272 | // php_utf32_utf8(unsigned char *buf, unsigned k) |
13274 | 13273 | |
13275 | 13274 | if ($cp < 0x80) { |
13276 | - return (string) self::chr($cp); |
|
13275 | + return (string)self::chr($cp); |
|
13277 | 13276 | } |
13278 | 13277 | |
13279 | 13278 | if ($cp < 0xA0) { |
13280 | 13279 | /** @noinspection UnnecessaryCastingInspection */ |
13281 | - return (string) self::chr(0xC0 | $cp >> 6) . (string) self::chr(0x80 | $cp & 0x3F); |
|
13280 | + return (string)self::chr(0xC0 | $cp >> 6).(string)self::chr(0x80 | $cp & 0x3F); |
|
13282 | 13281 | } |
13283 | 13282 | |
13284 | 13283 | return self::decimal_to_chr($cp); |
@@ -13311,7 +13310,7 @@ discard block |
||
13311 | 13310 | public static function to_int(string $str) |
13312 | 13311 | { |
13313 | 13312 | if (\is_numeric($str)) { |
13314 | - return (int) $str; |
|
13313 | + return (int)$str; |
|
13315 | 13314 | } |
13316 | 13315 | |
13317 | 13316 | return null; |
@@ -13346,7 +13345,7 @@ discard block |
||
13346 | 13345 | || |
13347 | 13346 | $input_type === 'double' |
13348 | 13347 | ) { |
13349 | - return (string) $input; |
|
13348 | + return (string)$input; |
|
13350 | 13349 | } |
13351 | 13350 | |
13352 | 13351 | if ($input_type === 'object') { |
@@ -13356,7 +13355,7 @@ discard block |
||
13356 | 13355 | /** @noinspection NestedPositiveIfStatementsInspection */ |
13357 | 13356 | /** @noinspection MissingOrEmptyGroupStatementInspection */ |
13358 | 13357 | if (\method_exists($input, '__toString')) { |
13359 | - return (string) $input; |
|
13358 | + return (string)$input; |
|
13360 | 13359 | } |
13361 | 13360 | } |
13362 | 13361 | |
@@ -13397,7 +13396,7 @@ discard block |
||
13397 | 13396 | } |
13398 | 13397 | |
13399 | 13398 | /** @noinspection PhpComposerExtensionStubsInspection */ |
13400 | - return (string) \mb_ereg_replace($pattern, '', $str); |
|
13399 | + return (string)\mb_ereg_replace($pattern, '', $str); |
|
13401 | 13400 | } |
13402 | 13401 | |
13403 | 13402 | if ($chars !== null) { |
@@ -13448,15 +13447,15 @@ discard block |
||
13448 | 13447 | $use_mb_functions = $lang === null && !$try_to_keep_the_string_length; |
13449 | 13448 | |
13450 | 13449 | if ($encoding === 'UTF-8') { |
13451 | - $str_part_two = (string) \mb_substr($str, 1); |
|
13450 | + $str_part_two = (string)\mb_substr($str, 1); |
|
13452 | 13451 | |
13453 | 13452 | if ($use_mb_functions) { |
13454 | 13453 | $str_part_one = \mb_strtoupper( |
13455 | - (string) \mb_substr($str, 0, 1) |
|
13454 | + (string)\mb_substr($str, 0, 1) |
|
13456 | 13455 | ); |
13457 | 13456 | } else { |
13458 | 13457 | $str_part_one = self::strtoupper( |
13459 | - (string) \mb_substr($str, 0, 1), |
|
13458 | + (string)\mb_substr($str, 0, 1), |
|
13460 | 13459 | $encoding, |
13461 | 13460 | false, |
13462 | 13461 | $lang, |
@@ -13466,16 +13465,16 @@ discard block |
||
13466 | 13465 | } else { |
13467 | 13466 | $encoding = self::normalize_encoding($encoding, 'UTF-8'); |
13468 | 13467 | |
13469 | - $str_part_two = (string) self::substr($str, 1, null, $encoding); |
|
13468 | + $str_part_two = (string)self::substr($str, 1, null, $encoding); |
|
13470 | 13469 | |
13471 | 13470 | if ($use_mb_functions) { |
13472 | 13471 | $str_part_one = \mb_strtoupper( |
13473 | - (string) \mb_substr($str, 0, 1, $encoding), |
|
13472 | + (string)\mb_substr($str, 0, 1, $encoding), |
|
13474 | 13473 | $encoding |
13475 | 13474 | ); |
13476 | 13475 | } else { |
13477 | 13476 | $str_part_one = self::strtoupper( |
13478 | - (string) self::substr($str, 0, 1, $encoding), |
|
13477 | + (string)self::substr($str, 0, 1, $encoding), |
|
13479 | 13478 | $encoding, |
13480 | 13479 | false, |
13481 | 13480 | $lang, |
@@ -13484,7 +13483,7 @@ discard block |
||
13484 | 13483 | } |
13485 | 13484 | } |
13486 | 13485 | |
13487 | - return $str_part_one . $str_part_two; |
|
13486 | + return $str_part_one.$str_part_two; |
|
13488 | 13487 | } |
13489 | 13488 | |
13490 | 13489 | /** |
@@ -13545,7 +13544,7 @@ discard block |
||
13545 | 13544 | $str = self::clean($str); |
13546 | 13545 | } |
13547 | 13546 | |
13548 | - $use_php_default_functions = !(bool) ($char_list . \implode('', $exceptions)); |
|
13547 | + $use_php_default_functions = !(bool)($char_list.\implode('', $exceptions)); |
|
13549 | 13548 | |
13550 | 13549 | if ( |
13551 | 13550 | $use_php_default_functions |
@@ -13946,7 +13945,7 @@ discard block |
||
13946 | 13945 | if ( |
13947 | 13946 | $keep_utf8_chars |
13948 | 13947 | && |
13949 | - (int) self::strlen($return) >= (int) self::strlen($str_backup) |
|
13948 | + (int)self::strlen($return) >= (int)self::strlen($str_backup) |
|
13950 | 13949 | ) { |
13951 | 13950 | return $str_backup; |
13952 | 13951 | } |
@@ -14037,17 +14036,17 @@ discard block |
||
14037 | 14036 | return ''; |
14038 | 14037 | } |
14039 | 14038 | |
14040 | - \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,' . $limit . '}/u', $str, $matches); |
|
14039 | + \preg_match('/^\\s*+(?:[^\\s]++\\s*+){1,'.$limit.'}/u', $str, $matches); |
|
14041 | 14040 | |
14042 | 14041 | if ( |
14043 | 14042 | !isset($matches[0]) |
14044 | 14043 | || |
14045 | - \mb_strlen($str) === (int) \mb_strlen($matches[0]) |
|
14044 | + \mb_strlen($str) === (int)\mb_strlen($matches[0]) |
|
14046 | 14045 | ) { |
14047 | 14046 | return $str; |
14048 | 14047 | } |
14049 | 14048 | |
14050 | - return \rtrim($matches[0]) . $str_add_on; |
|
14049 | + return \rtrim($matches[0]).$str_add_on; |
|
14051 | 14050 | } |
14052 | 14051 | |
14053 | 14052 | /** |
@@ -14142,7 +14141,7 @@ discard block |
||
14142 | 14141 | } |
14143 | 14142 | } |
14144 | 14143 | |
14145 | - return $str_return . \implode('', $charsArray); |
|
14144 | + return $str_return.\implode('', $charsArray); |
|
14146 | 14145 | } |
14147 | 14146 | |
14148 | 14147 | /** |
@@ -14196,7 +14195,7 @@ discard block |
||
14196 | 14195 | $final_break = ''; |
14197 | 14196 | } |
14198 | 14197 | |
14199 | - return \implode($delimiter ?? "\n", $string_helper_array) . $final_break; |
|
14198 | + return \implode($delimiter ?? "\n", $string_helper_array).$final_break; |
|
14200 | 14199 | } |
14201 | 14200 | |
14202 | 14201 | /** |
@@ -14438,7 +14437,7 @@ discard block |
||
14438 | 14437 | /** @noinspection PhpIncludeInspection */ |
14439 | 14438 | /** @noinspection UsingInclusionReturnValueInspection */ |
14440 | 14439 | /** @psalm-suppress UnresolvableInclude */ |
14441 | - return include __DIR__ . '/data/' . $file . '.php'; |
|
14440 | + return include __DIR__.'/data/'.$file.'.php'; |
|
14442 | 14441 | } |
14443 | 14442 | |
14444 | 14443 | /** |
@@ -14458,7 +14457,7 @@ discard block |
||
14458 | 14457 | */ |
14459 | 14458 | \uksort( |
14460 | 14459 | self::$EMOJI, |
14461 | - static function (string $a, string $b): int { |
|
14460 | + static function(string $a, string $b): int { |
|
14462 | 14461 | return \strlen($b) <=> \strlen($a); |
14463 | 14462 | } |
14464 | 14463 | ); |
@@ -14468,7 +14467,7 @@ discard block |
||
14468 | 14467 | |
14469 | 14468 | foreach (self::$EMOJI_KEYS_CACHE as $key) { |
14470 | 14469 | $tmp_key = \crc32($key); |
14471 | - self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_' . $tmp_key . '_-_' . \strrev((string) $tmp_key) . '_-_8FTU_ELBATROP_-_'; |
|
14470 | + self::$EMOJI_KEYS_REVERSIBLE_CACHE[] = '_-_PORTABLE_UTF8_-_'.$tmp_key.'_-_'.\strrev((string)$tmp_key).'_-_8FTU_ELBATROP_-_'; |
|
14472 | 14471 | } |
14473 | 14472 | |
14474 | 14473 | return true; |
@@ -14496,7 +14495,7 @@ discard block |
||
14496 | 14495 | /** @noinspection PhpUsageOfSilenceOperatorInspection */ |
14497 | 14496 | return \defined('MB_OVERLOAD_STRING') |
14498 | 14497 | && |
14499 | - ((int) @\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
14498 | + ((int)@\ini_get('mbstring.func_overload') & \MB_OVERLOAD_STRING); |
|
14500 | 14499 | } |
14501 | 14500 | |
14502 | 14501 | /** |
@@ -14562,7 +14561,7 @@ discard block |
||
14562 | 14561 | */ |
14563 | 14562 | static $RX_CLASS_CACHE = []; |
14564 | 14563 | |
14565 | - $cache_key = $s . '_' . $class; |
|
14564 | + $cache_key = $s.'_'.$class; |
|
14566 | 14565 | |
14567 | 14566 | if (isset($RX_CLASS_CACHE[$cache_key])) { |
14568 | 14567 | return $RX_CLASS_CACHE[$cache_key]; |
@@ -14575,7 +14574,7 @@ discard block |
||
14575 | 14574 | /** @noinspection AlterInForeachInspection */ |
14576 | 14575 | foreach (self::str_split($s) as &$s) { |
14577 | 14576 | if ($s === '-') { |
14578 | - $class_array[0] = '-' . $class_array[0]; |
|
14577 | + $class_array[0] = '-'.$class_array[0]; |
|
14579 | 14578 | } elseif (!isset($s[2])) { |
14580 | 14579 | $class_array[0] .= \preg_quote($s, '/'); |
14581 | 14580 | } elseif (self::strlen($s) === 1) { |
@@ -14586,13 +14585,13 @@ discard block |
||
14586 | 14585 | } |
14587 | 14586 | |
14588 | 14587 | if ($class_array[0]) { |
14589 | - $class_array[0] = '[' . $class_array[0] . ']'; |
|
14588 | + $class_array[0] = '['.$class_array[0].']'; |
|
14590 | 14589 | } |
14591 | 14590 | |
14592 | 14591 | if (\count($class_array) === 1) { |
14593 | 14592 | $return = $class_array[0]; |
14594 | 14593 | } else { |
14595 | - $return = '(?:' . \implode('|', $class_array) . ')'; |
|
14594 | + $return = '(?:'.\implode('|', $class_array).')'; |
|
14596 | 14595 | } |
14597 | 14596 | |
14598 | 14597 | $RX_CLASS_CACHE[$cache_key] = $return; |
@@ -14673,7 +14672,7 @@ discard block |
||
14673 | 14672 | |
14674 | 14673 | if ($delimiter === '-') { |
14675 | 14674 | /** @noinspection AlterInForeachInspection */ |
14676 | - foreach ((array) $special_cases['names'] as &$beginning) { |
|
14675 | + foreach ((array)$special_cases['names'] as &$beginning) { |
|
14677 | 14676 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
14678 | 14677 | $continue = true; |
14679 | 14678 | |
@@ -14683,7 +14682,7 @@ discard block |
||
14683 | 14682 | } |
14684 | 14683 | |
14685 | 14684 | /** @noinspection AlterInForeachInspection */ |
14686 | - foreach ((array) $special_cases['prefixes'] as &$beginning) { |
|
14685 | + foreach ((array)$special_cases['prefixes'] as &$beginning) { |
|
14687 | 14686 | if (\strncmp($name, $beginning, \strlen($beginning)) === 0) { |
14688 | 14687 | $continue = true; |
14689 | 14688 | |
@@ -14759,8 +14758,8 @@ discard block |
||
14759 | 14758 | } else { |
14760 | 14759 | /** @noinspection OffsetOperationsInspection */ |
14761 | 14760 | $cc1 = self::$CHR[$ordC1 / 64] | "\xC0"; |
14762 | - $cc2 = ((string) $input & "\x3F") | "\x80"; |
|
14763 | - $buf .= $cc1 . $cc2; |
|
14761 | + $cc2 = ((string)$input & "\x3F") | "\x80"; |
|
14762 | + $buf .= $cc1.$cc2; |
|
14764 | 14763 | } |
14765 | 14764 | |
14766 | 14765 | return $buf; |
@@ -14783,7 +14782,7 @@ discard block |
||
14783 | 14782 | |
14784 | 14783 | $pattern = '/%u([0-9a-fA-F]{3,4})/'; |
14785 | 14784 | if (\preg_match($pattern, $str)) { |
14786 | - $str = (string) \preg_replace($pattern, '&#x\\1;', $str); |
|
14785 | + $str = (string)\preg_replace($pattern, '&#x\\1;', $str); |
|
14787 | 14786 | } |
14788 | 14787 | |
14789 | 14788 | return $str; |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require __DIR__ . '/../vendor/autoload.php'; |
|
4 | -require __DIR__ . '/vendor/autoload.php'; |
|
3 | +require __DIR__.'/../vendor/autoload.php'; |
|
4 | +require __DIR__.'/vendor/autoload.php'; |
|
5 | 5 | |
6 | 6 | $readmeText = (new \voku\PhpReadmeHelper\GenerateApi())->generate( |
7 | - __DIR__ . '/../src/voku/helper/UTF8.php', |
|
8 | - __DIR__ . '/docs/base.md' |
|
7 | + __DIR__.'/../src/voku/helper/UTF8.php', |
|
8 | + __DIR__.'/docs/base.md' |
|
9 | 9 | ); |
10 | 10 | |
11 | -file_put_contents(__DIR__ . '/../README.md', $readmeText); |
|
11 | +file_put_contents(__DIR__.'/../README.md', $readmeText); |