diff options
author | Brad Mostert <mostertb@users.noreply.github.com> | 2018-10-13 16:17:46 +0200 |
---|---|---|
committer | Brad Mostert <mostertb@users.noreply.github.com> | 2018-10-13 16:17:46 +0200 |
commit | bf4ad3d3b148ce0868339ee24bca9a5c46821063 (patch) | |
tree | 858fca31c9bf35f72c260c51602dd30faa3cb581 | |
parent | 61343f63d0a64a14287f2366c2907b8a05eb0a87 (diff) | |
download | sql-parser-bf4ad3d3b148ce0868339ee24bca9a5c46821063.zip sql-parser-bf4ad3d3b148ce0868339ee24bca9a5c46821063.tar.gz sql-parser-bf4ad3d3b148ce0868339ee24bca9a5c46821063.tar.bz2 |
Apply php-cs-fixer formatting changes
-rw-r--r-- | src/Components/CaseExpression.php | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/Components/CaseExpression.php b/src/Components/CaseExpression.php index ad6b92a..fc80697 100644 --- a/src/Components/CaseExpression.php +++ b/src/Components/CaseExpression.php @@ -57,7 +57,7 @@ class CaseExpression extends Component public $else_result; /** - * The alias of this CASE statement + * The alias of this CASE statement. * * @var string */ @@ -78,8 +78,8 @@ class CaseExpression extends Component } /** - * @param Parser $parser the parser that serves as context - * @param TokensList $list the list of tokens that are being parsed + * @param Parser $parser the parser that serves as context + * @param TokensList $list the list of tokens that are being parsed * @param array $options parameters for parsing * * @return CaseExpression @@ -209,7 +209,6 @@ class CaseExpression extends Component $list->tokens[$list->idx - 1] ); } else { - // Parse for alias of CASE expression $asFound = false; for (; $list->idx < $list->count; ++$list->idx) { @@ -219,6 +218,7 @@ class CaseExpression extends Component if ($token->type === Token::TYPE_DELIMITER) { break; } + // Skipping whitespaces and comments. if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT) @@ -227,9 +227,8 @@ class CaseExpression extends Component } // Handle optional AS keyword before alias - if($token->type === Token::TYPE_KEYWORD - && $token->keyword === 'AS'){ - + if ($token->type === Token::TYPE_KEYWORD + && $token->keyword === 'AS') { if ($asFound || !empty($ret->alias)) { $parser->error('Potential duplicate alias of CASE expression.', $token); break; @@ -240,8 +239,8 @@ class CaseExpression extends Component if ($asFound && $token->type === Token::TYPE_KEYWORD - && ($token->flags & Token::FLAG_KEYWORD_RESERVED || $token->flags & Token::FLAG_KEYWORD_FUNCTION)){ - $parser->error('An alias expected after AS but got '.$token->value, $token); + && ($token->flags & Token::FLAG_KEYWORD_RESERVED || $token->flags & Token::FLAG_KEYWORD_FUNCTION)) { + $parser->error('An alias expected after AS but got ' . $token->value, $token); $asFound = false; break; } @@ -250,8 +249,7 @@ class CaseExpression extends Component || $token->type === Token::TYPE_STRING || ($token->type === Token::TYPE_SYMBOL && !$token->flags & Token::FLAG_SYMBOL_VARIABLE) || $token->type === Token::TYPE_NONE - ){ - + ) { // An alias is expected (the keyword `AS` was previously found). if (!empty($ret->alias)) { $parser->error('An alias was previously found.', $token); @@ -269,7 +267,6 @@ class CaseExpression extends Component $parser->error('An alias was expected after AS.', $list->tokens[$list->idx - 1]); } - $ret->expr = self::build($ret); } |