summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Utils/Formatter.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php
index 16c0778..e07394c 100644
--- a/src/Utils/Formatter.php
+++ b/src/Utils/Formatter.php
@@ -6,6 +6,7 @@
namespace PhpMyAdmin\SqlParser\Utils;
+use PhpMyAdmin\SqlParser\Components\JoinKeyword;
use PhpMyAdmin\SqlParser\Lexer;
use PhpMyAdmin\SqlParser\Parser;
use PhpMyAdmin\SqlParser\Token;
@@ -383,6 +384,15 @@ class Formatter
}
}
+ // Inline JOINs
+ if (($prev->type === Token::TYPE_KEYWORD && isset(JoinKeyword::$JOINS[$prev->value]))
+ || (in_array($curr->value, array('ON', 'USING'), true) && isset(JoinKeyword::$JOINS[$list->tokens[$list->idx - 2]->value]))
+ || (isset($list->tokens[$list->idx - 4]) && isset(JoinKeyword::$JOINS[$list->tokens[$list->idx - 4]->value]))
+ || (isset($list->tokens[$list->idx - 6]) && isset(JoinKeyword::$JOINS[$list->tokens[$list->idx - 6]->value]))
+ ) {
+ $lineEnded = false;
+ }
+
// Indenting BEGIN ... END blocks.
if ($prev->type === Token::TYPE_KEYWORD && $prev->keyword === 'BEGIN') {
$lineEnded = true;