@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | /** @param array<string, bool|string>|false $getopt */ |
| 52 | 52 | #[DataProvider('highlightParamsProvider')] |
| 53 | - public function testRunHighlight(array|false $getopt, string $output, int $result): void |
|
| 53 | + public function testRunHighlight(array | false $getopt, string $output, int $result): void |
|
| 54 | 54 | { |
| 55 | 55 | $cli = $this->getCLI($getopt); |
| 56 | 56 | $this->expectOutputString($output); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | /** @param array<string, bool|string>|false $getopt */ |
| 124 | 124 | #[DataProvider('highlightParamsStdInProvider')] |
| 125 | - public function testRunHighlightStdIn(string $input, array|false $getopt, string $output, int $result): void |
|
| 125 | + public function testRunHighlightStdIn(string $input, array | false $getopt, string $output, int $result): void |
|
| 126 | 126 | { |
| 127 | 127 | $cli = $this->getCLIStdIn($input, $getopt); |
| 128 | 128 | $this->expectOutputString($output); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | /** @param array<string, bool|string>|false $getopt */ |
| 189 | 189 | #[DataProvider('lintParamsStdInProvider')] |
| 190 | - public function testRunLintFromStdIn(string $input, array|false $getopt, string $output, int $result): void |
|
| 190 | + public function testRunLintFromStdIn(string $input, array | false $getopt, string $output, int $result): void |
|
| 191 | 191 | { |
| 192 | 192 | $cli = $this->getCLIStdIn($input, $getopt); |
| 193 | 193 | $this->expectOutputString($output); |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | /** @param array<string, bool|string>|false $getopt */ |
| 251 | 251 | #[DataProvider('lintParamsProvider')] |
| 252 | - public function testRunLint(array|false $getopt, string $output, int $result): void |
|
| 252 | + public function testRunLint(array | false $getopt, string $output, int $result): void |
|
| 253 | 253 | { |
| 254 | 254 | $cli = $this->getCLI($getopt); |
| 255 | 255 | $this->expectOutputString($output); |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | /** @param array<string, bool|string>|false $getopt */ |
| 315 | 315 | #[DataProvider('tokenizeParamsProvider')] |
| 316 | - public function testRunTokenize(array|false $getopt, string $output, int $result): void |
|
| 316 | + public function testRunTokenize(array | false $getopt, string $output, int $result): void |
|
| 317 | 317 | { |
| 318 | 318 | $cli = $this->getCLI($getopt); |
| 319 | 319 | $this->expectOutputString($output); |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | /** @param array<string, bool|string>|false $getopt */ |
| 367 | 367 | #[DataProvider('tokenizeParamsStdInProvider')] |
| 368 | - public function testRunTokenizeStdIn(string $input, array|false $getopt, string $output, int $result): void |
|
| 368 | + public function testRunTokenizeStdIn(string $input, array | false $getopt, string $output, int $result): void |
|
| 369 | 369 | { |
| 370 | 370 | $cli = $this->getCLIStdIn($input, $getopt); |
| 371 | 371 | $this->expectOutputString($output); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * Test for loading closest SQL context |
| 36 | 36 | */ |
| 37 | 37 | #[DataProvider('contextLoadingProvider')] |
| 38 | - public function testLoadClosest(string $context, string|null $expected): void |
|
| 38 | + public function testLoadClosest(string $context, string | null $expected): void |
|
| 39 | 39 | { |
| 40 | 40 | $this->assertEquals($expected, Context::loadClosest($context)); |
| 41 | 41 | if ($expected !== null) { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | #[DataProvider('providerForTestMode')] |
| 121 | - public function testMode(int|string $mode, int $expected): void |
|
| 121 | + public function testMode(int | string $mode, int $expected): void |
|
| 122 | 122 | { |
| 123 | 123 | Context::setMode($mode); |
| 124 | 124 | $this->assertSame($expected, Context::getMode()); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | /** |
| 68 | 68 | * The string to be parsed. |
| 69 | 69 | */ |
| 70 | - public string|UtfString $str = ''; |
|
| 70 | + public string | UtfString $str = ''; |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * The length of `$str`. |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * enabled or not |
| 114 | 114 | * @param string $delimiter the delimiter to be used |
| 115 | 115 | */ |
| 116 | - public function __construct(string|UtfString $str, bool $strict = false, string|null $delimiter = null) |
|
| 116 | + public function __construct(string | UtfString $str, bool $strict = false, string | null $delimiter = null) |
|
| 117 | 117 | { |
| 118 | 118 | if (Context::$keywords === []) { |
| 119 | 119 | Context::load(); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $len = $str instanceof UtfString ? $str->length() : strlen($str); |
| 125 | 125 | |
| 126 | 126 | // For multi-byte strings, a new instance of `UtfString` is initialized. |
| 127 | - if (! $str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { |
|
| 127 | + if (!$str instanceof UtfString && $len !== mb_strlen($str, 'UTF-8')) { |
|
| 128 | 128 | $str = new UtfString($str); |
| 129 | 129 | } |
| 130 | 130 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $this->strict = $strict; |
| 135 | 135 | |
| 136 | 136 | // Setting the delimiter. |
| 137 | - $this->setDelimiter(! empty($delimiter) ? $delimiter : static::$defaultDelimiter); |
|
| 137 | + $this->setDelimiter(!empty($delimiter) ? $delimiter : static::$defaultDelimiter); |
|
| 138 | 138 | |
| 139 | 139 | $this->lex(); |
| 140 | 140 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | $delimiterLen = 0; |
| 244 | 244 | while ( |
| 245 | 245 | ++$this->last < $this->len |
| 246 | - && ! Context::isWhitespace($this->str[$this->last]) |
|
| 246 | + && !Context::isWhitespace($this->str[$this->last]) |
|
| 247 | 247 | && $delimiterLen < 15 |
| 248 | 248 | ) { |
| 249 | 249 | $this->delimiter .= $this->str[$this->last]; |
@@ -302,8 +302,8 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | if ( |
| 305 | - ($next->type !== TokenType::Keyword || ! in_array($next->value, ['FROM', 'USING'], true)) |
|
| 306 | - && ($next->type !== TokenType::Operator || ! in_array($next->value, [',', ')'], true)) |
|
| 305 | + ($next->type !== TokenType::Keyword || !in_array($next->value, ['FROM', 'USING'], true)) |
|
| 306 | + && ($next->type !== TokenType::Operator || !in_array($next->value, [',', ')'], true)) |
|
| 307 | 307 | ) { |
| 308 | 308 | continue; |
| 309 | 309 | } |
@@ -341,10 +341,10 @@ discard block |
||
| 341 | 341 | $next = $this->list->getNext(); |
| 342 | 342 | if ( |
| 343 | 343 | ($next->type !== TokenType::Keyword |
| 344 | - || ! in_array($next->value, self::KEYWORD_NAME_INDICATORS, true) |
|
| 344 | + || !in_array($next->value, self::KEYWORD_NAME_INDICATORS, true) |
|
| 345 | 345 | ) |
| 346 | 346 | && ($next->type !== TokenType::Operator |
| 347 | - || ! in_array($next->value, self::OPERATOR_NAME_INDICATORS, true) |
|
| 347 | + || !in_array($next->value, self::OPERATOR_NAME_INDICATORS, true) |
|
| 348 | 348 | ) |
| 349 | 349 | && ($next->value !== '') |
| 350 | 350 | ) { |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | /** |
| 389 | 389 | * Parses a keyword. |
| 390 | 390 | */ |
| 391 | - public function parseKeyword(): Token|null |
|
| 391 | + public function parseKeyword(): Token | null |
|
| 392 | 392 | { |
| 393 | 393 | $token = ''; |
| 394 | 394 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | $token .= $this->str[$this->last]; |
| 429 | 429 | $flags = Context::isKeyword($token); |
| 430 | 430 | |
| 431 | - if (($this->last + 1 !== $this->len && ! Context::isSeparator($this->str[$this->last + 1])) || ! $flags) { |
|
| 431 | + if (($this->last + 1 !== $this->len && !Context::isSeparator($this->str[$this->last + 1])) || !$flags) { |
|
| 432 | 432 | continue; |
| 433 | 433 | } |
| 434 | 434 | |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | /** |
| 449 | 449 | * Parses a label. |
| 450 | 450 | */ |
| 451 | - public function parseLabel(): Token|null |
|
| 451 | + public function parseLabel(): Token | null |
|
| 452 | 452 | { |
| 453 | 453 | $token = ''; |
| 454 | 454 | |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | /** |
| 493 | 493 | * Parses an operator. |
| 494 | 494 | */ |
| 495 | - public function parseOperator(): Token|null |
|
| 495 | + public function parseOperator(): Token | null |
|
| 496 | 496 | { |
| 497 | 497 | $token = ''; |
| 498 | 498 | |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $token .= $this->str[$this->last]; |
| 513 | 513 | $flags = Context::isOperator($token); |
| 514 | 514 | |
| 515 | - if (! $flags) { |
|
| 515 | + if (!$flags) { |
|
| 516 | 516 | continue; |
| 517 | 517 | } |
| 518 | 518 | |
@@ -528,11 +528,11 @@ discard block |
||
| 528 | 528 | /** |
| 529 | 529 | * Parses a whitespace. |
| 530 | 530 | */ |
| 531 | - public function parseWhitespace(): Token|null |
|
| 531 | + public function parseWhitespace(): Token | null |
|
| 532 | 532 | { |
| 533 | 533 | $token = $this->str[$this->last]; |
| 534 | 534 | |
| 535 | - if (! Context::isWhitespace($token)) { |
|
| 535 | + if (!Context::isWhitespace($token)) { |
|
| 536 | 536 | return null; |
| 537 | 537 | } |
| 538 | 538 | |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | /** |
| 549 | 549 | * Parses a comment. |
| 550 | 550 | */ |
| 551 | - public function parseComment(): Token|null |
|
| 551 | + public function parseComment(): Token | null |
|
| 552 | 552 | { |
| 553 | 553 | $iBak = $this->last; |
| 554 | 554 | $token = $this->str[$this->last]; |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | /** |
| 666 | 666 | * Parses a boolean. |
| 667 | 667 | */ |
| 668 | - public function parseBool(): Token|null |
|
| 668 | + public function parseBool(): Token | null |
|
| 669 | 669 | { |
| 670 | 670 | if ($this->last + 3 >= $this->len) { |
| 671 | 671 | // At least `min(strlen('TRUE'), strlen('FALSE'))` characters are |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | /** |
| 697 | 697 | * Parses a number. |
| 698 | 698 | */ |
| 699 | - public function parseNumber(): Token|null |
|
| 699 | + public function parseNumber(): Token | null |
|
| 700 | 700 | { |
| 701 | 701 | // A rudimentary state machine is being used to parse numbers due to |
| 702 | 702 | // the various forms of their notation. |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | } elseif ($state === 2) { |
| 764 | 764 | $flags |= Token::FLAG_NUMBER_HEX; |
| 765 | 765 | if ( |
| 766 | - ! ( |
|
| 766 | + !( |
|
| 767 | 767 | ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9') |
| 768 | 768 | || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F') |
| 769 | 769 | || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f') |
@@ -859,12 +859,12 @@ discard block |
||
| 859 | 859 | * |
| 860 | 860 | * @throws LexerException |
| 861 | 861 | */ |
| 862 | - public function parseString(string $quote = ''): Token|null |
|
| 862 | + public function parseString(string $quote = ''): Token | null |
|
| 863 | 863 | { |
| 864 | 864 | $token = $this->str[$this->last]; |
| 865 | 865 | $flags = Context::isString($token); |
| 866 | 866 | |
| 867 | - if (! $flags && $token !== $quote) { |
|
| 867 | + if (!$flags && $token !== $quote) { |
|
| 868 | 868 | return null; |
| 869 | 869 | } |
| 870 | 870 | |
@@ -909,12 +909,12 @@ discard block |
||
| 909 | 909 | * |
| 910 | 910 | * @throws LexerException |
| 911 | 911 | */ |
| 912 | - public function parseSymbol(): Token|null |
|
| 912 | + public function parseSymbol(): Token | null |
|
| 913 | 913 | { |
| 914 | 914 | $token = $this->str[$this->last]; |
| 915 | 915 | $flags = Context::isSymbol($token); |
| 916 | 916 | |
| 917 | - if (! $flags) { |
|
| 917 | + if (!$flags) { |
|
| 918 | 918 | return null; |
| 919 | 919 | } |
| 920 | 920 | |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | if ($str === null) { |
| 941 | 941 | $str = $this->parseUnknown(); |
| 942 | 942 | |
| 943 | - if ($str === null && ! ($flags & Token::FLAG_SYMBOL_PARAMETER)) { |
|
| 943 | + if ($str === null && !($flags & Token::FLAG_SYMBOL_PARAMETER)) { |
|
| 944 | 944 | $this->error('Variable name was expected.', $this->str[$this->last], $this->last); |
| 945 | 945 | } |
| 946 | 946 | } |
@@ -956,14 +956,14 @@ discard block |
||
| 956 | 956 | /** |
| 957 | 957 | * Parses unknown parts of the query. |
| 958 | 958 | */ |
| 959 | - public function parseUnknown(): Token|null |
|
| 959 | + public function parseUnknown(): Token | null |
|
| 960 | 960 | { |
| 961 | 961 | $token = $this->str[$this->last]; |
| 962 | 962 | if (Context::isSeparator($token)) { |
| 963 | 963 | return null; |
| 964 | 964 | } |
| 965 | 965 | |
| 966 | - while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) { |
|
| 966 | + while (++$this->last < $this->len && !Context::isSeparator($this->str[$this->last])) { |
|
| 967 | 967 | $token .= $this->str[$this->last]; |
| 968 | 968 | |
| 969 | 969 | // Test if end of token equals the current delimiter. If so, remove it from the token. |
@@ -982,7 +982,7 @@ discard block |
||
| 982 | 982 | /** |
| 983 | 983 | * Parses the delimiter of the query. |
| 984 | 984 | */ |
| 985 | - public function parseDelimiter(): Token|null |
|
| 985 | + public function parseDelimiter(): Token | null |
|
| 986 | 986 | { |
| 987 | 987 | $idx = 0; |
| 988 | 988 | |
@@ -999,7 +999,7 @@ discard block |
||
| 999 | 999 | return new Token($this->delimiter, TokenType::Delimiter); |
| 1000 | 1000 | } |
| 1001 | 1001 | |
| 1002 | - private function parse(): Token|null |
|
| 1002 | + private function parse(): Token | null |
|
| 1003 | 1003 | { |
| 1004 | 1004 | // It is best to put the parsers in order of their complexity |
| 1005 | 1005 | // (ascending) and their occurrence rate (descending). |
@@ -33,5 +33,5 @@ |
||
| 33 | 33 | * |
| 34 | 34 | * @var Expression[]|null |
| 35 | 35 | */ |
| 36 | - public array|null $tables = null; |
|
| 36 | + public array | null $tables = null; |
|
| 37 | 37 | } |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | * : list<array{string, Token|null, int}> |
| 60 | 60 | * ) |
| 61 | 61 | */ |
| 62 | - public function getErrorsAsArray(Lexer|Parser $obj): array |
|
| 62 | + public function getErrorsAsArray(Lexer | Parser $obj): array |
|
| 63 | 63 | { |
| 64 | 64 | $ret = []; |
| 65 | 65 | if ($obj instanceof Lexer) { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * The position is counted in chars, not bytes, so you should |
| 94 | 94 | * use mb_* functions to properly handle utf-8 multibyte chars. |
| 95 | 95 | */ |
| 96 | - public int|null $position = null; |
|
| 96 | + public int | null $position = null; |
|
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * @param string $token the value of the token |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | switch ($this->type) { |
| 119 | 119 | case TokenType::Keyword: |
| 120 | 120 | $this->keyword = strtoupper($this->token); |
| 121 | - if (! ($this->flags & self::FLAG_KEYWORD_RESERVED)) { |
|
| 121 | + if (!($this->flags & self::FLAG_KEYWORD_RESERVED)) { |
|
| 122 | 122 | // Unreserved keywords should stay the way they are because they |
| 123 | 123 | // might represent field names. |
| 124 | 124 | return $this->token; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | } elseif (($this->flags & self::FLAG_NUMBER_APPROXIMATE) || ($this->flags & self::FLAG_NUMBER_FLOAT)) { |
| 145 | 145 | $ret = (float) $ret; |
| 146 | - } elseif (! ($this->flags & self::FLAG_NUMBER_BINARY)) { |
|
| 146 | + } elseif (!($this->flags & self::FLAG_NUMBER_BINARY)) { |
|
| 147 | 147 | $ret = (int) $ret; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | // in PHP 5.3- the `null` parameter isn't handled correctly. |
| 179 | 179 | $str = mb_substr( |
| 180 | 180 | $str, |
| 181 | - ! empty($str[1]) && ($str[1] === '@') ? 2 : 1, |
|
| 181 | + !empty($str[1]) && ($str[1] === '@') ? 2 : 1, |
|
| 182 | 182 | mb_strlen($str), |
| 183 | 183 | 'UTF-8', |
| 184 | 184 | ); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | public $expr; |
| 79 | 79 | |
| 80 | 80 | /** @param string $expr the condition or the operator */ |
| 81 | - public function __construct(string|null $expr = null) |
|
| 81 | + public function __construct(string | null $expr = null) |
|
| 82 | 82 | { |
| 83 | 83 | $this->expr = trim((string) $expr); |
| 84 | 84 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | } else { |
| 142 | 142 | // The expression ended. |
| 143 | 143 | $expr->expr = trim($expr->expr); |
| 144 | - if (! empty($expr->expr)) { |
|
| 144 | + if (!empty($expr->expr)) { |
|
| 145 | 145 | $ret[] = $expr; |
| 146 | 146 | } |
| 147 | 147 | |
@@ -159,13 +159,13 @@ discard block |
||
| 159 | 159 | if ( |
| 160 | 160 | ($token->type === TokenType::Keyword) |
| 161 | 161 | && ($token->flags & Token::FLAG_KEYWORD_RESERVED) |
| 162 | - && ! ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
|
| 162 | + && !($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
|
| 163 | 163 | ) { |
| 164 | 164 | if ($token->value === 'BETWEEN') { |
| 165 | 165 | $betweenBefore = true; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if ($brackets === 0 && ! in_array($token->value, self::ALLOWED_KEYWORDS, true)) { |
|
| 168 | + if ($brackets === 0 && !in_array($token->value, self::ALLOWED_KEYWORDS, true)) { |
|
| 169 | 169 | break; |
| 170 | 170 | } |
| 171 | 171 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | // Last iteration was not processed. |
| 204 | 204 | $expr->expr = trim($expr->expr); |
| 205 | - if (! empty($expr->expr)) { |
|
| 205 | + if (!empty($expr->expr)) { |
|
| 206 | 206 | $ret[] = $expr; |
| 207 | 207 | } |
| 208 | 208 | |
@@ -113,10 +113,10 @@ discard block |
||
| 113 | 113 | * @param string|null $alias the name of the alias |
| 114 | 114 | */ |
| 115 | 115 | public function __construct( |
| 116 | - string|null $database = null, |
|
| 117 | - string|null $table = null, |
|
| 118 | - string|null $column = null, |
|
| 119 | - string|null $alias = null, |
|
| 116 | + string | null $database = null, |
|
| 117 | + string | null $table = null, |
|
| 118 | + string | null $column = null, |
|
| 119 | + string | null $alias = null, |
|
| 120 | 120 | ) { |
| 121 | 121 | if (($column === null) && ($alias === null)) { |
| 122 | 122 | $this->expr = $database; // case 1 |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * |
| 162 | 162 | * @throws ParserException |
| 163 | 163 | */ |
| 164 | - public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null |
|
| 164 | + public static function parse(Parser $parser, TokensList $list, array $options = []): Expression | null |
|
| 165 | 165 | { |
| 166 | 166 | $ret = new static(); |
| 167 | 167 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | ]; |
| 195 | 195 | |
| 196 | 196 | // When a field is parsed, no parentheses are expected. |
| 197 | - if (! empty($options['parseField'])) { |
|
| 197 | + if (!empty($options['parseField'])) { |
|
| 198 | 198 | $options['breakOnParentheses'] = true; |
| 199 | 199 | $options['field'] = $options['parseField']; |
| 200 | 200 | } |
@@ -221,18 +221,18 @@ discard block |
||
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | if ($token->type === TokenType::Keyword) { |
| 224 | - if (($brackets > 0) && empty($ret->subquery) && ! empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
| 224 | + if (($brackets > 0) && empty($ret->subquery) && !empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
| 225 | 225 | // A `(` was previously found and this keyword is the |
| 226 | 226 | // beginning of a statement, so this is a subquery. |
| 227 | 227 | $ret->subquery = $token->keyword; |
| 228 | 228 | } elseif ( |
| 229 | 229 | ($token->flags & Token::FLAG_KEYWORD_FUNCTION) |
| 230 | 230 | && (empty($options['parseField']) |
| 231 | - && ! $alias) |
|
| 231 | + && !$alias) |
|
| 232 | 232 | ) { |
| 233 | 233 | $isExpr = true; |
| 234 | 234 | } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED) && ($brackets === 0)) { |
| 235 | - if (! in_array($token->keyword, self::ALLOWED_KEYWORDS, true)) { |
|
| 235 | + if (!in_array($token->keyword, self::ALLOWED_KEYWORDS, true)) { |
|
| 236 | 236 | // A reserved keyword that is not allowed in the |
| 237 | 237 | // expression was found so the expression must have |
| 238 | 238 | // ended and a new clause is starting. |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | if ($token->keyword === 'AS') { |
| 243 | - if (! empty($options['breakOnAlias'])) { |
|
| 243 | + if (!empty($options['breakOnAlias'])) { |
|
| 244 | 244 | break; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | $isExpr = true; |
| 266 | - } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) { |
|
| 266 | + } elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && !$alias) { |
|
| 267 | 267 | /* End of expression */ |
| 268 | 268 | break; |
| 269 | 269 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | || (($token->type === TokenType::Operator) |
| 280 | 280 | && ($token->value !== '.')) |
| 281 | 281 | ) { |
| 282 | - if (! empty($options['parseField'])) { |
|
| 282 | + if (!empty($options['parseField'])) { |
|
| 283 | 283 | break; |
| 284 | 284 | } |
| 285 | 285 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | if ($token->type === TokenType::Operator) { |
| 292 | - if (! empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
| 292 | + if (!empty($options['breakOnParentheses']) && (($token->value === '(') || ($token->value === ')'))) { |
|
| 293 | 293 | // No brackets were expected. |
| 294 | 294 | break; |
| 295 | 295 | } |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | --$brackets; |
| 315 | 315 | if ($brackets === 0) { |
| 316 | - if (! empty($options['parenthesesDelimited'])) { |
|
| 316 | + if (!empty($options['parenthesesDelimited'])) { |
|
| 317 | 317 | // The current token is the last bracket, the next |
| 318 | 318 | // one will be outside the expression. |
| 319 | 319 | $ret->expr .= $token->token; |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | |
| 340 | 340 | if ($alias) { |
| 341 | 341 | // An alias is expected (the keyword `AS` was previously found). |
| 342 | - if (! empty($ret->alias)) { |
|
| 342 | + if (!empty($ret->alias)) { |
|
| 343 | 343 | $parser->error('An alias was previously found.', $token); |
| 344 | 344 | break; |
| 345 | 345 | } |
@@ -353,15 +353,15 @@ discard block |
||
| 353 | 353 | && ($prev[0] === null |
| 354 | 354 | || (($prev[0]->type !== TokenType::Operator || $prev[0]->token === ')') |
| 355 | 355 | && ($prev[0]->type !== TokenType::Keyword |
| 356 | - || ! ($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
| 356 | + || !($prev[0]->flags & Token::FLAG_KEYWORD_RESERVED)))) |
|
| 357 | 357 | && (($prev[1]->type === TokenType::String) |
| 358 | 358 | || ($prev[1]->type === TokenType::Symbol |
| 359 | - && ! ($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
| 360 | - && ! ($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER)) |
|
| 359 | + && !($prev[1]->flags & Token::FLAG_SYMBOL_VARIABLE) |
|
| 360 | + && !($prev[1]->flags & Token::FLAG_SYMBOL_PARAMETER)) |
|
| 361 | 361 | || ($prev[1]->type === TokenType::None |
| 362 | 362 | && $prev[1]->token !== 'OVER')) |
| 363 | 363 | ) { |
| 364 | - if (! empty($ret->alias)) { |
|
| 364 | + if (!empty($ret->alias)) { |
|
| 365 | 365 | $parser->error('An alias was previously found.', $token); |
| 366 | 366 | break; |
| 367 | 367 | } |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | // Found a `.` which means we expect a column name and |
| 393 | 393 | // the column name we parsed is actually the table name |
| 394 | 394 | // and the table name is actually a database name. |
| 395 | - if (! empty($ret->database) || $dot) { |
|
| 395 | + if (!empty($ret->database) || $dot) { |
|
| 396 | 396 | $parser->error('Unexpected dot.', $token); |
| 397 | 397 | } |
| 398 | 398 | |
@@ -409,11 +409,11 @@ discard block |
||
| 409 | 409 | $dot = false; |
| 410 | 410 | } else { |
| 411 | 411 | // No alias is expected. |
| 412 | - if (! empty($options['breakOnAlias'])) { |
|
| 412 | + if (!empty($options['breakOnAlias'])) { |
|
| 413 | 413 | break; |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | - if (! empty($ret->alias)) { |
|
| 416 | + if (!empty($ret->alias)) { |
|
| 417 | 417 | $parser->error('An alias was previously found.', $token); |
| 418 | 418 | break; |
| 419 | 419 | } |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $ret = implode('.', Context::escapeAll($fields)); |
| 462 | 462 | } |
| 463 | 463 | |
| 464 | - if (! empty($this->alias)) { |
|
| 464 | + if (!empty($this->alias)) { |
|
| 465 | 465 | $ret .= ' AS ' . Context::escape($this->alias); |
| 466 | 466 | } |
| 467 | 467 | |
@@ -63,23 +63,23 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @see Statement::$statementOptions |
| 65 | 65 | */ |
| 66 | - public OptionsArray|null $options = null; |
|
| 66 | + public OptionsArray | null $options = null; |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * The index of the first token used in this statement. |
| 70 | 70 | */ |
| 71 | - public int|null $first = null; |
|
| 71 | + public int | null $first = null; |
|
| 72 | 72 | |
| 73 | 73 | /** |
| 74 | 74 | * The index of the last token used in this statement. |
| 75 | 75 | */ |
| 76 | - public int|null $last = null; |
|
| 76 | + public int | null $last = null; |
|
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | 79 | * @param Parser|null $parser the instance that requests parsing |
| 80 | 80 | * @param TokensList|null $list the list of tokens to be parsed |
| 81 | 81 | */ |
| 82 | - public function __construct(Parser|null $parser = null, TokensList|null $list = null) |
|
| 82 | + public function __construct(Parser | null $parser = null, TokensList | null $list = null) |
|
| 83 | 83 | { |
| 84 | 84 | if (($parser === null) || ($list === null)) { |
| 85 | 85 | return; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | // Checking if this field was already built. |
| 126 | 126 | if ($type & self::ADD_CLAUSE) { |
| 127 | - if (! empty($built[$field])) { |
|
| 127 | + if (!empty($built[$field])) { |
|
| 128 | 128 | continue; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // Checking if the result of the builder should be added. |
| 140 | - if (! ($type & self::ADD_CLAUSE)) { |
|
| 140 | + if (!($type & self::ADD_CLAUSE)) { |
|
| 141 | 141 | continue; |
| 142 | 142 | } |
| 143 | 143 | |
@@ -260,8 +260,8 @@ discard block |
||
| 260 | 260 | $options = []; |
| 261 | 261 | |
| 262 | 262 | // Looking for duplicated clauses. |
| 263 | - if (isset(Parser::KEYWORD_PARSERS[$token->value]) || ! empty(Parser::STATEMENT_PARSERS[$token->value])) { |
|
| 264 | - if (! empty($parsedClauses[$token->value])) { |
|
| 263 | + if (isset(Parser::KEYWORD_PARSERS[$token->value]) || !empty(Parser::STATEMENT_PARSERS[$token->value])) { |
|
| 264 | + if (!empty($parsedClauses[$token->value])) { |
|
| 265 | 265 | $parser->error('This type of clause was previously parsed.', $token); |
| 266 | 266 | break; |
| 267 | 267 | } |
@@ -277,15 +277,15 @@ discard block |
||
| 277 | 277 | if (isset(Parser::KEYWORD_PARSERS[$tokenValue]) && $list->idx < $list->count) { |
| 278 | 278 | $class = Parser::KEYWORD_PARSERS[$tokenValue]['class']; |
| 279 | 279 | $field = Parser::KEYWORD_PARSERS[$tokenValue]['field']; |
| 280 | - if (! empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) { |
|
| 280 | + if (!empty(Parser::KEYWORD_PARSERS[$tokenValue]['options'])) { |
|
| 281 | 281 | $options = Parser::KEYWORD_PARSERS[$tokenValue]['options']; |
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | // Checking if this is the beginning of the statement. |
| 286 | - if (! empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
| 286 | + if (!empty(Parser::STATEMENT_PARSERS[$token->keyword])) { |
|
| 287 | 287 | if ( |
| 288 | - ! empty(static::$clauses) // Undefined for some statements. |
|
| 288 | + !empty(static::$clauses) // Undefined for some statements. |
|
| 289 | 289 | && empty(static::$clauses[$token->value]) |
| 290 | 290 | ) { |
| 291 | 291 | // Some keywords (e.g. `SET`) may be the beginning of a |
@@ -300,8 +300,8 @@ discard block |
||
| 300 | 300 | break; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - if (! $parsedOptions) { |
|
| 304 | - if (! array_key_exists((string) $token->value, static::$statementOptions)) { |
|
| 303 | + if (!$parsedOptions) { |
|
| 304 | + if (!array_key_exists((string) $token->value, static::$statementOptions)) { |
|
| 305 | 305 | // Skipping keyword because if it is not a option. |
| 306 | 306 | ++$list->idx; |
| 307 | 307 | } |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | if ($minJoin === 0 && stripos($clauseType, 'JOIN')) { |
| 469 | 469 | // First JOIN clause is detected |
| 470 | 470 | $minJoin = $maxJoin = $clauseStartIdx; |
| 471 | - } elseif ($minJoin !== 0 && ! stripos($clauseType, 'JOIN')) { |
|
| 471 | + } elseif ($minJoin !== 0 && !stripos($clauseType, 'JOIN')) { |
|
| 472 | 472 | // After a previous JOIN clause, a non-JOIN clause has been detected |
| 473 | 473 | $maxJoin = $lastIdx; |
| 474 | 474 | } elseif ($maxJoin < $clauseStartIdx && stripos($clauseType, 'JOIN')) { |