@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | } elseif (($token->value === ',') && ($brackets === 0)) { |
| 402 | 402 | break; |
| 403 | 403 | } |
| 404 | - } elseif (! self::checkIfTokenQuotedSymbol($token) && $token->type !== TokenType::String) { |
|
| 404 | + } elseif (!self::checkIfTokenQuotedSymbol($token) && $token->type !== TokenType::String) { |
|
| 405 | 405 | if (isset(Parser::STATEMENT_PARSERS[$arrayKey]) && Parser::STATEMENT_PARSERS[$arrayKey] !== '') { |
| 406 | 406 | $list->idx++; // Ignore the current token |
| 407 | 407 | $nextToken = $list->getNext(); |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | } elseif ( |
| 425 | 425 | (array_key_exists($arrayKey, self::DATABASE_OPTIONS) |
| 426 | 426 | || array_key_exists($arrayKey, self::TABLE_OPTIONS)) |
| 427 | - && ! self::checkIfColumnDefinitionKeyword($arrayKey) |
|
| 427 | + && !self::checkIfColumnDefinitionKeyword($arrayKey) |
|
| 428 | 428 | ) { |
| 429 | 429 | // This alter operation has finished, which means a comma |
| 430 | 430 | // was missing before start of new alter operation |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | // Handle optional AS keyword before alias |
| 201 | 201 | if ($token->type === TokenType::Keyword && $token->keyword === 'AS') { |
| 202 | - if ($asFound || ! empty($ret->alias)) { |
|
| 202 | + if ($asFound || !empty($ret->alias)) { |
|
| 203 | 203 | $parser->error('Potential duplicate alias of CASE expression.', $token); |
| 204 | 204 | break; |
| 205 | 205 | } |
@@ -221,11 +221,11 @@ discard block |
||
| 221 | 221 | if ( |
| 222 | 222 | $asFound |
| 223 | 223 | || $token->type === TokenType::String |
| 224 | - || ($token->type === TokenType::Symbol && ! $token->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
| 224 | + || ($token->type === TokenType::Symbol && !$token->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
| 225 | 225 | || $token->type === TokenType::None |
| 226 | 226 | ) { |
| 227 | 227 | // An alias is expected (the keyword `AS` was previously found). |
| 228 | - if (! empty($ret->alias)) { |
|
| 228 | + if (!empty($ret->alias)) { |
|
| 229 | 229 | $parser->error('An alias was previously found.', $token); |
| 230 | 230 | break; |
| 231 | 231 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param TokensList $list the list of tokens that are being parsed |
| 45 | 45 | * @param array<string, mixed> $options parameters for parsing |
| 46 | 46 | */ |
| 47 | - public static function parse(Parser $parser, TokensList $list, array $options = []): DataType|null |
|
| 47 | + public static function parse(Parser $parser, TokensList $list, array $options = []): DataType | null |
|
| 48 | 48 | { |
| 49 | 49 | $ret = new DataType(); |
| 50 | 50 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | if ($state === 0) { |
| 74 | 74 | $ret->name = strtoupper((string) $token->value); |
| 75 | - if (($token->type !== TokenType::Keyword) || (! ($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
| 75 | + if (($token->type !== TokenType::Keyword) || (!($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
| 76 | 76 | $parser->error('Unrecognized data type.', $token); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -156,7 +156,7 @@ |
||
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Last iteration was not saved. |
| 159 | - if (! empty($expr->old)) { |
|
| 159 | + if (!empty($expr->old)) { |
|
| 160 | 160 | $ret[] = $expr; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -121,7 +121,7 @@ |
||
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - if (! empty($expr->type)) { |
|
| 124 | + if (!empty($expr->type)) { |
|
| 125 | 125 | $ret[] = $expr; |
| 126 | 126 | } |
| 127 | 127 | |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | if ($token->type === TokenType::Operator && $token->value === '(') { |
| 88 | 88 | --$list->idx; // ArrayObj needs to start with `(` |
| 89 | 89 | $state = 1; |
| 90 | - continue;// do not add this token to the name |
|
| 90 | + continue; // do not add this token to the name |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $ret->name .= $token->value; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | ) { |
| 89 | 89 | $expr->type = $token->keyword; |
| 90 | 90 | } elseif (($token->type === TokenType::Operator) && ($token->value === ',')) { |
| 91 | - if (! empty($expr->expr)) { |
|
| 91 | + if (!empty($expr->expr)) { |
|
| 92 | 92 | $ret[] = $expr; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // Last iteration was not processed. |
| 104 | - if (! empty($expr->expr)) { |
|
| 104 | + if (!empty($expr->expr)) { |
|
| 105 | 105 | $ret[] = $expr; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @throws ParserException |
| 82 | 82 | */ |
| 83 | - public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null |
|
| 83 | + public static function parse(Parser $parser, TokensList $list, array $options = []): Expression | null |
|
| 84 | 84 | { |
| 85 | 85 | $ret = new Expression(); |
| 86 | 86 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | ]; |
| 114 | 114 | |
| 115 | 115 | // When a field is parsed, no parentheses are expected. |
| 116 | - if (! empty($options['parseField'])) { |
|
| 116 | + if (!empty($options['parseField'])) { |
|
| 117 | 117 | $options['breakOnParentheses'] = true; |
| 118 | 118 | $options['field'] = $options['parseField']; |
| 119 | 119 | } |
@@ -140,18 +140,18 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if ($token->type === TokenType::Keyword) { |
| 143 | - if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
| 143 | + if (($brackets > 0) && empty($ret->subquery) && !empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
| 144 | 144 | // A `(` was previously found and this keyword is the |
| 145 | 145 | // beginning of a statement, so this is a subquery. |
| 146 | 146 | $ret->subquery = $token->keyword; |
| 147 | 147 | } elseif ( |
| 148 | 148 | ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
| 149 | 149 | && (empty($options['parseField']) |
| 150 | - && ! $alias) |
|
| 150 | + && !$alias) |
|
| 151 | 151 | ) { |
| 152 | 152 | $isExpr = true; |
| 153 | 153 | } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) { |
| 154 | - if (! in_array($token->keyword, self::ALLOWED_KEYWORDS, true)) { |
|
| 154 | + if (!in_array($token->keyword, self::ALLOWED_KEYWORDS, true)) { |
|
| 155 | 155 | // A reserved keyword that is not allowed in the |
| 156 | 156 | // expression was found so the expression must have |
| 157 | 157 | // ended and a new clause is starting. |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if ($token->keyword === 'AS') { |
| 162 | - if (! empty($options['breakOnAlias'])) { |
|
| 162 | + if (!empty($options['breakOnAlias'])) { |
|
| 163 | 163 | break; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $isExpr = true; |
| 185 | 185 | } elseif ( |
| 186 | - $brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias |
|
| 186 | + $brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias |
|
| 187 | 187 | && ($ret->table === null || $ret->table === '') |
| 188 | 188 | ) { |
| 189 | 189 | /* End of expression */ |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | || (($token->type === TokenType::Operator) |
| 202 | 202 | && ($token->value !== '.')) |
| 203 | 203 | ) { |
| 204 | - if (! empty($options['parseField'])) { |
|
| 204 | + if (!empty($options['parseField'])) { |
|
| 205 | 205 | break; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | if ($token->type === TokenType::Operator) { |
| 214 | - if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
| 214 | + if (!empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
| 215 | 215 | // No brackets were expected. |
| 216 | 216 | break; |
| 217 | 217 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | --$brackets; |
| 237 | 237 | if ($brackets === 0) { |
| 238 | - if (! empty($options['parenthesesDelimited'])) { |
|
| 238 | + if (!empty($options['parenthesesDelimited'])) { |
|
| 239 | 239 | // The current token is the last bracket, the next |
| 240 | 240 | // one will be outside the expression. |
| 241 | 241 | $ret->expr .= $token->token; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | if ($alias) { |
| 263 | 263 | // An alias is expected (the keyword `AS` was previously found). |
| 264 | - if (! empty($ret->alias)) { |
|
| 264 | + if (!empty($ret->alias)) { |
|
| 265 | 265 | $parser->error('An alias was previously found.', $token); |
| 266 | 266 | break; |
| 267 | 267 | } |
@@ -275,15 +275,15 @@ discard block |
||
| 275 | 275 | && ($prev[0] === null |
| 276 | 276 | || (($prev[0]->type !== TokenType::Operator || $prev[0]->token === ')') |
| 277 | 277 | && ($prev[0]->type !== TokenType::Keyword |
| 278 | - || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
| 278 | + || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
| 279 | 279 | && (($prev[1]->type === TokenType::String) |
| 280 | 280 | || ($prev[1]->type === TokenType::Symbol |
| 281 | - && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
| 282 | - && ! ($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER)) |
|
| 281 | + && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
| 282 | + && !($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER)) |
|
| 283 | 283 | || ($prev[1]->type === TokenType::None |
| 284 | 284 | && $prev[1]->token !== 'OVER')) |
| 285 | 285 | ) { |
| 286 | - if (! empty($ret->alias)) { |
|
| 286 | + if (!empty($ret->alias)) { |
|
| 287 | 287 | $parser->error('An alias was previously found.', $token); |
| 288 | 288 | break; |
| 289 | 289 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | // Found a `.` which means we expect a column name and |
| 315 | 315 | // the column name we parsed is actually the table name |
| 316 | 316 | // and the table name is actually a database name. |
| 317 | - if (! empty($ret->database) || $dot) { |
|
| 317 | + if (!empty($ret->database) || $dot) { |
|
| 318 | 318 | $parser->error('Unexpected dot.', $token); |
| 319 | 319 | } |
| 320 | 320 | |
@@ -331,11 +331,11 @@ discard block |
||
| 331 | 331 | $dot = false; |
| 332 | 332 | } else { |
| 333 | 333 | // No alias is expected. |
| 334 | - if (! empty($options['breakOnAlias'])) { |
|
| 334 | + if (!empty($options['breakOnAlias'])) { |
|
| 335 | 335 | break; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - if (! empty($ret->alias)) { |
|
| 338 | + if (!empty($ret->alias)) { |
|
| 339 | 339 | $parser->error('An alias was previously found.', $token); |
| 340 | 340 | break; |
| 341 | 341 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | } else { |
| 116 | 116 | // The expression ended. |
| 117 | 117 | $expr->expr = trim($expr->expr); |
| 118 | - if (! empty($expr->expr)) { |
|
| 118 | + if (!empty($expr->expr)) { |
|
| 119 | 119 | $ret[] = $expr; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | if ( |
| 134 | 134 | ($token->type === TokenType::Keyword) |
| 135 | 135 | && ($token->flags & Token::FLAG_KEYWORD_RESERVED) |
| 136 | - && ! ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
|
| 136 | + && !($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
|
| 137 | 137 | ) { |
| 138 | 138 | if ($token->value === 'BETWEEN') { |
| 139 | 139 | $betweenBefore = true; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - if ($brackets === 0 && ! in_array($token->value, self::ALLOWED_KEYWORDS, true)) { |
|
| 142 | + if ($brackets === 0 && !in_array($token->value, self::ALLOWED_KEYWORDS, true)) { |
|
| 143 | 143 | break; |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | // Last iteration was not processed. |
| 178 | 178 | $expr->expr = trim($expr->expr); |
| 179 | - if (! empty($expr->expr)) { |
|
| 179 | + if (!empty($expr->expr)) { |
|
| 180 | 180 | $ret[] = $expr; |
| 181 | 181 | } |
| 182 | 182 | |