@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | $list->idx = $lastIdx; |
489 | 489 | } elseif (empty(self::STATEMENT_PARSERS[$token->keyword])) { |
490 | 490 | // Checking if it is a known statement that can be parsed. |
491 | - if (! isset(self::STATEMENT_PARSERS[$token->keyword])) { |
|
491 | + if (!isset(self::STATEMENT_PARSERS[$token->keyword])) { |
|
492 | 492 | // A statement is considered recognized if the parser |
493 | 493 | // is aware that it is a statement, but it does not have |
494 | 494 | // a parser for it yet. |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | |
529 | 529 | // Handles unions. |
530 | 530 | if ( |
531 | - ! empty($unionType) |
|
531 | + !empty($unionType) |
|
532 | 532 | && ($lastStatement instanceof SelectStatement) |
533 | 533 | && ($statement instanceof SelectStatement) |
534 | 534 | ) { |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | * |
616 | 616 | * @throws ParserException throws the exception, if strict mode is enabled. |
617 | 617 | */ |
618 | - public function error($msg, Token|null $token = null, $code = 0): void |
|
618 | + public function error($msg, Token | null $token = null, $code = 0): void |
|
619 | 619 | { |
620 | 620 | $error = new ParserException( |
621 | 621 | Translator::gettext($msg), |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param Parser|null $parser the instance that requests parsing |
89 | 89 | * @param TokensList|null $list the list of tokens to be parsed |
90 | 90 | */ |
91 | - public function __construct(Parser|null $parser = null, TokensList|null $list = null) |
|
91 | + public function __construct(Parser | null $parser = null, TokensList | null $list = null) |
|
92 | 92 | { |
93 | 93 | if (($parser === null) || ($list === null)) { |
94 | 94 | return; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | // Checking if this field was already built. |
167 | 167 | if ($type & 1) { |
168 | - if (! empty($built[$field])) { |
|
168 | + if (!empty($built[$field])) { |
|
169 | 169 | continue; |
170 | 170 | } |
171 | 171 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | // Checking if the result of the builder should be added. |
181 | - if (! ($type & 1)) { |
|
181 | + if (!($type & 1)) { |
|
182 | 182 | continue; |
183 | 183 | } |
184 | 184 | |
@@ -304,8 +304,8 @@ discard block |
||
304 | 304 | $options = []; |
305 | 305 | |
306 | 306 | // Looking for duplicated clauses. |
307 | - if (! empty(Parser::KEYWORD_PARSERS[$token->value]) || ! empty(Parser::STATEMENT_PARSERS[$token->value])) { |
|
308 | - if (! empty($parsedClauses[$token->value])) { |
|
307 | + if (!empty(Parser::KEYWORD_PARSERS[$token->value]) || !empty(Parser::STATEMENT_PARSERS[$token->value])) { |
|
308 | + if (!empty($parsedClauses[$token->value])) { |
|
309 | 309 | $parser->error('This type of clause was previously parsed.', $token); |
310 | 310 | break; |
311 | 311 | } |
@@ -318,18 +318,18 @@ discard block |
||
318 | 318 | // but it might be the beginning of a statement of truncate, |
319 | 319 | // so let the value use the keyword field for truncate type. |
320 | 320 | $tokenValue = in_array($token->keyword, ['TRUNCATE']) ? $token->keyword : $token->value; |
321 | - if (! empty(Parser::KEYWORD_PARSERS[$tokenValue]) && $list->idx < $list->count) { |
|
321 | + if (!empty(Parser::KEYWORD_PARSERS[$tokenValue]) && $list->idx < $list->count) { |
|
322 | 322 | $class = Parser::KEYWORD_PARSERS[$tokenValue]['class']; |
323 | 323 | $field = Parser::KEYWORD_PARSERS[$tokenValue]['field']; |
324 | - if (! empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) { |
|
324 | + if (!empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) { |
|
325 | 325 | $options = Parser::KEYWORD_PARSERS[$tokenValue]['options']; |
326 | 326 | } |
327 | 327 | } |
328 | 328 | |
329 | 329 | // Checking if this is the beginning of the statement. |
330 | - if (! empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
330 | + if (!empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
331 | 331 | if ( |
332 | - ! empty(static::$clauses) // Undefined for some statements. |
|
332 | + !empty(static::$clauses) // Undefined for some statements. |
|
333 | 333 | && empty(static::$clauses[$token->value]) |
334 | 334 | ) { |
335 | 335 | // Some keywords (e.g. `SET`) may be the beginning of a |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | break; |
345 | 345 | } |
346 | 346 | |
347 | - if (! $parsedOptions) { |
|
347 | + if (!$parsedOptions) { |
|
348 | 348 | if (empty(static::$statementOptions[$token->value])) { |
349 | 349 | // Skipping keyword because if it is not a option. |
350 | 350 | ++$list->idx; |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | if ($minJoin === 0 && stripos($clauseType, 'JOIN')) { |
518 | 518 | // First JOIN clause is detected |
519 | 519 | $minJoin = $maxJoin = $clauseStartIdx; |
520 | - } elseif ($minJoin !== 0 && ! stripos($clauseType, 'JOIN')) { |
|
520 | + } elseif ($minJoin !== 0 && !stripos($clauseType, 'JOIN')) { |
|
521 | 521 | // After a previous JOIN clause, a non-JOIN clause has been detected |
522 | 522 | $maxJoin = $lastIdx; |
523 | 523 | } elseif ($maxJoin < $clauseStartIdx && stripos($clauseType, 'JOIN')) { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | $this->str = $str; |
80 | 80 | $this->byteLen = mb_strlen($str, '8bit'); |
81 | - if (! mb_check_encoding($str, 'UTF-8')) { |
|
81 | + if (!mb_check_encoding($str, 'UTF-8')) { |
|
82 | 82 | $this->charLen = 0; |
83 | 83 | } else { |
84 | 84 | $this->charLen = mb_strlen($str, 'UTF-8'); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @param int $offset the offset to be returned |
102 | 102 | */ |
103 | - public function offsetGet($offset): string|null |
|
103 | + public function offsetGet($offset): string | null |
|
104 | 104 | { |
105 | 105 | // This function moves the internal byte and character pointer to the requested offset. |
106 | 106 | // This function is part of hot code so the aim is to do the following |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $this->assertEquals([ |
44 | 44 | TokenType::Keyword->value | Token::FLAG_KEYWORD_RESERVED => [ |
45 | 45 | 8 => ['RESERVED'], |
46 | - 9 => ['RESERVED2','RESERVED3','RESERVED4','RESERVED5'], |
|
46 | + 9 => ['RESERVED2', 'RESERVED3', 'RESERVED4', 'RESERVED5'], |
|
47 | 47 | ], |
48 | 48 | TokenType::Keyword->value | Token::FLAG_KEYWORD_FUNCTION => [8 => ['FUNCTION']], |
49 | 49 | TokenType::Keyword->value | Token::FLAG_KEYWORD_DATA_TYPE => [8 => ['DATATYPE']], |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | switch ($this->type) { |
129 | 129 | case TokenType::Keyword: |
130 | 130 | $this->keyword = strtoupper($this->token); |
131 | - if (! ($this->flags & self::FLAG_KEYWORD_RESERVED)) { |
|
131 | + if (!($this->flags & self::FLAG_KEYWORD_RESERVED)) { |
|
132 | 132 | // Unreserved keywords should stay the way they are because they |
133 | 133 | // might represent field names. |
134 | 134 | return $this->token; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | } elseif (($this->flags & self::FLAG_NUMBER_APPROXIMATE) || ($this->flags & self::FLAG_NUMBER_FLOAT)) { |
155 | 155 | $ret = (float) $ret; |
156 | - } elseif (! ($this->flags & self::FLAG_NUMBER_BINARY)) { |
|
156 | + } elseif (!($this->flags & self::FLAG_NUMBER_BINARY)) { |
|
157 | 157 | $ret = (int) $ret; |
158 | 158 | } |
159 | 159 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | // in PHP 5.3- the `null` parameter isn't handled correctly. |
189 | 189 | $str = mb_substr( |
190 | 190 | $str, |
191 | - ! empty($str[1]) && ($str[1] === '@') ? 2 : 1, |
|
191 | + !empty($str[1]) && ($str[1] === '@') ? 2 : 1, |
|
192 | 192 | mb_strlen($str), |
193 | 193 | 'UTF-8' |
194 | 194 | ); |
@@ -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 |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | } else { |
152 | 152 | // The expression ended. |
153 | 153 | $expr->expr = trim($expr->expr); |
154 | - if (! empty($expr->expr)) { |
|
154 | + if (!empty($expr->expr)) { |
|
155 | 155 | $ret[] = $expr; |
156 | 156 | } |
157 | 157 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | if ( |
170 | 170 | ($token->type === TokenType::Keyword) |
171 | 171 | && ($token->flags & Token::FLAG_KEYWORD_RESERVED) |
172 | - && ! ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
|
172 | + && !($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
|
173 | 173 | ) { |
174 | 174 | if ($token->value === 'BETWEEN') { |
175 | 175 | $betweenBefore = true; |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | |
213 | 213 | // Last iteration was not processed. |
214 | 214 | $expr->expr = trim($expr->expr); |
215 | - if (! empty($expr->expr)) { |
|
215 | + if (!empty($expr->expr)) { |
|
216 | 216 | $ret[] = $expr; |
217 | 217 | } |
218 | 218 |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @param TokensList $list the list of tokens that are being parsed |
96 | 96 | * @param array<string, mixed> $options parameters for parsing |
97 | 97 | */ |
98 | - public static function parse(Parser $parser, TokensList $list, array $options = []): DataType|null |
|
98 | + public static function parse(Parser $parser, TokensList $list, array $options = []): DataType | null |
|
99 | 99 | { |
100 | 100 | $ret = new static(); |
101 | 101 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | if ($state === 0) { |
127 | 127 | $ret->name = strtoupper((string) $token->value); |
128 | - if (($token->type !== TokenType::Keyword) || (! ($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
128 | + if (($token->type !== TokenType::Keyword) || (!($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) { |
|
129 | 129 | $parser->error('Unrecognized data type.', $token); |
130 | 130 | } |
131 | 131 |
@@ -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 | } |