diff options
author | Dan Ungureanu <udan1107@gmail.com> | 2015-11-12 23:41:01 +0200 |
---|---|---|
committer | Dan Ungureanu <udan1107@gmail.com> | 2015-11-12 23:41:01 +0200 |
commit | a42f12a2d83afa8eadbdda02305613465a760a80 (patch) | |
tree | cc0ca94a9e9da15bb577983c28fdbb4fa3df75f5 | |
parent | 2a3d3b80deba3364b7a1c4ddd52b22c7bb24995b (diff) | |
download | sql-parser-a42f12a2d83afa8eadbdda02305613465a760a80.zip sql-parser-a42f12a2d83afa8eadbdda02305613465a760a80.tar.gz sql-parser-a42f12a2d83afa8eadbdda02305613465a760a80.tar.bz2 |
Fixed a bug where formatter split the function name and the parameters list.v3.0.6
-rw-r--r-- | src/Utils/Formatter.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php index ea4b419..7ff1346 100644 --- a/src/Utils/Formatter.php +++ b/src/Utils/Formatter.php @@ -304,7 +304,9 @@ class Formatter if (($this->options['parts_newline']) && (!$formattedOptions) && (empty(self::$INLINE_CLAUSES[$lastClause])) - && ($curr->type != Token::TYPE_KEYWORD) + && (($curr->type !== Token::TYPE_KEYWORD) + || (($curr->type === Token::TYPE_KEYWORD) + && ($curr->flags & Token::FLAG_KEYWORD_FUNCTION))) ) { $formattedOptions = true; $lineEnded = true; @@ -334,8 +336,8 @@ class Formatter // Formatting fragments delimited by comma. if (($prev->type === Token::TYPE_OPERATOR) && ($prev->value === ',')) { // Fragments delimited by a comma are broken into multiple - // pieces only if the clause if the clause is not inlined or - // this fragment is between brackets that were on new line. + // pieces only if the clause is not inlined or this fragment + // is between brackets that are on new line. if (((empty(self::$INLINE_CLAUSES[$lastClause])) && ($this->options['parts_newline'])) || (end($blocksLineEndings) === true) @@ -401,8 +403,7 @@ class Formatter $comment = ''; } - // Saving the next token as the one that will be processed during - // the next iteration. + // Iteration finished, consider current token as previous. $prev = $curr; } |