@@ -28,7 +28,6 @@ class Highlight
28
28
private string $ constant = 'color:#8C4D03 ' ;
29
29
private string $ tag_close = 'color:#F00000 ' ;
30
30
private string $ operators = 'color:#0000FF ' ;
31
- private string $ semi_colon = 'color:#000000 ' ;
32
31
private string $ parenthesis = 'color:#038C8C ' ;
33
32
private string $ return_type = 'color:#E3093F ' ;
34
33
private string $ php_function = 'color:#6367A7 ' ;
@@ -60,15 +59,14 @@ class Highlight
60
59
(i(f|mplements|n(clude(_once)?|st(anceof|eadof)|terface)|sset))|
61
60
(n(amespace|ew))|
62
61
(p(r(i(nt|vate)|otected)|ublic))|
63
- (re(quire(_once)?|turn))|
62
+ (re(quire(_once)?|turn|adonly ))|
64
63
(s(tatic|witch))|
65
64
(t(hrow|r(ait|y)))|
66
65
(u(nset(?!\s*\))|se))|
67
66
(__halt_compiler|break|list|(x)?or|var|while|match))\b/ ' ;
68
67
private string $ operators_ptrn = '/((?<! (style|class))\=|\.|\!|\+|\%|-(?!\w+:)|(?<!https|http)[^a-z+]:|\@|\||\?|>|<|&)/ ' ;
69
- private string $ semi_colon_ptrn = '/(?<![<|>|&]);/ ' ;
70
68
private string $ parenthesis_ptrn = '/\(|\)/ ' ;
71
- private string $ return_type_ptrn = '/(?<=\<\/span\>\:|\:\<\/span\>)\s*(?:\<span.*?\>\:<span>)*(string|bool|array|float|int|callable|void)/ ' ;
69
+ private string $ return_type_ptrn = '/(?<=\<\/span\>\:|\:\<\/span\>)\s*(?:\<span.*?\>\:<span>)*(string|bool|array|float|int|callable|void|never )/ ' ;
72
70
private string $ curly_braces_ptrn = '/[\{\}]/ ' ;
73
71
private string $ parameter_type_ptrn = '/(?<!\w)(string|bool|array|float|int|callable)\s*(?=\<span.*?class="(variable|operators)"\>[\$|&])/ ' ;
74
72
private string $ square_bracket_ptrn = '/\[|\]/ ' ;
@@ -125,12 +123,11 @@ private function format(string $code, ?string $file_name, bool $cache): string
125
123
126
124
while ($ token !== false )
127
125
{
128
- $ value = rtrim ($ token , PHP_EOL );
129
- if ($ value == '' ) {
130
- $ value = ' ' ;
126
+ $ line = rtrim ($ token , PHP_EOL );
127
+ if ($ line == '' ) {
128
+ $ line = ' ' ;
131
129
}
132
130
133
- $ line = preg_replace ($ this ->semi_colon_ptrn , "<span style= \"{$ this ->semi_colon }\" class= \"semi_colon \"> \$0</span> " , $ value );
134
131
$ gui_line_number = $ this ->show_line_number ? "<td " . ($ this ->line_selectable ? '' : ' unselectable="on" ' ) . "> {$ start_number }</td><td> " : '<td> ' ;
135
132
136
133
if (isset ($ this ->highlight [$ start_number ]))
0 commit comments