1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-30 09:39:51 +02:00

Compiler: Add new lines before selected keywords, not after

This commit is contained in:
Peter Knut
2024-11-05 21:16:29 +01:00
parent b1ecb0649e
commit 99b7c08e3a

View File

@@ -258,7 +258,7 @@ function php_shrink($input) {
$tokens[$i+4] = array(0, ';'); $tokens[$i+4] = array(0, ';');
} }
if ($token[0] == T_COMMENT || $token[0] == T_WHITESPACE || ($token[0] == T_DOC_COMMENT && $doc_comment)) { if ($token[0] == T_COMMENT || $token[0] == T_WHITESPACE || ($token[0] == T_DOC_COMMENT && $doc_comment)) {
$space = "\n"; $space = " ";
} else { } else {
if ($token[0] == T_DOC_COMMENT) { if ($token[0] == T_DOC_COMMENT) {
$doc_comment = true; $doc_comment = true;
@@ -287,9 +287,13 @@ function php_shrink($input) {
} elseif ($token[0] === T_VARIABLE && !isset($special_variables[$token[1]])) { } elseif ($token[0] === T_VARIABLE && !isset($special_variables[$token[1]])) {
$token[1] = '$' . $short_variables[$token[1]]; $token[1] = '$' . $short_variables[$token[1]];
} }
if (isset($set[substr($output, -1)]) || isset($set[$token[1][0]])) {
if ($token[0] == T_FUNCTION || $token[0] == T_CLASS || $token[0] == T_INTERFACE || $token[0] == T_TRAIT) {
$space = "\n";
} elseif (isset($set[substr($output, -1)]) || isset($set[$token[1][0]])) {
$space = ''; $space = '';
} }
$output .= $space . $token[1]; $output .= $space . $token[1];
$space = ''; $space = '';
} }