@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | ) { |
95 | 95 | $expr->type = $token->keyword; |
96 | 96 | } elseif (($token->type === Token::TYPE_OPERATOR) && ($token->value === ',')) { |
97 | - if (! empty($expr->expr)) { |
|
97 | + if (!empty($expr->expr)) { |
|
98 | 98 | $ret[] = $expr; |
99 | 99 | } |
100 | 100 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | // Last iteration was not processed. |
110 | - if (! empty($expr->expr)) { |
|
110 | + if (!empty($expr->expr)) { |
|
111 | 111 | $ret[] = $expr; |
112 | 112 | } |
113 | 113 |
@@ -22,7 +22,6 @@ discard block |
||
22 | 22 | |
23 | 23 | /** |
24 | 24 | * `WITH` statement. |
25 | - |
|
26 | 25 | * WITH [RECURSIVE] query_name [ (column_name [,...]) ] AS (SELECT ...) [, ...] |
27 | 26 | */ |
28 | 27 | final class WithStatement extends Statement |
@@ -263,9 +262,9 @@ discard block |
||
263 | 262 | |
264 | 263 | // 5 is the only valid end state |
265 | 264 | if ($state !== 5) { |
266 | - /** |
|
267 | - * Token parsed at this moment. |
|
268 | - */ |
|
265 | + /** |
|
266 | + * Token parsed at this moment. |
|
267 | + */ |
|
269 | 268 | $token = $list->tokens[$list->idx]; |
270 | 269 | |
271 | 270 | $parser->error('Unexpected end of the WITH CTE.', $token); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | if ($state === 0) { |
115 | - if ($token->type !== Token::TYPE_NONE || ! preg_match('/^[a-zA-Z0-9_$]+$/', $token->token)) { |
|
115 | + if ($token->type !== Token::TYPE_NONE || !preg_match('/^[a-zA-Z0-9_$]+$/', $token->token)) { |
|
116 | 116 | $parser->error('The name of the CTE was expected.', $token); |
117 | 117 | break; |
118 | 118 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | break; |
137 | 137 | } |
138 | 138 | } elseif ($state === 2) { |
139 | - if (! ($token->type === Token::TYPE_KEYWORD && $token->keyword === 'AS')) { |
|
139 | + if (!($token->type === Token::TYPE_KEYWORD && $token->keyword === 'AS')) { |
|
140 | 140 | $parser->error('AS keyword was expected.', $token); |
141 | 141 | break; |
142 | 142 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $list->idx++; // Ignore the current token |
149 | 149 | $nextKeyword = $list->getNext(); |
150 | 150 | |
151 | - if (! ($token->value === '(' && ($nextKeyword && $nextKeyword->value === 'SELECT'))) { |
|
151 | + if (!($token->value === '(' && ($nextKeyword && $nextKeyword->value === 'SELECT'))) { |
|
152 | 152 | $parser->error('Subquery of the CTE was expected.', $token); |
153 | 153 | $list->idx = $idxBeforeGetNext; |
154 | 154 | break; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | /** |
296 | 296 | * Get tokens within the WITH expression to use them in another parser |
297 | 297 | */ |
298 | - private function getSubTokenList(TokensList $list): ParserException|TokensList |
|
298 | + private function getSubTokenList(TokensList $list): ParserException | TokensList |
|
299 | 299 | { |
300 | 300 | $idx = $list->idx; |
301 | 301 | $token = $list->tokens[$list->idx]; |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | } |
312 | 312 | |
313 | 313 | ++$list->idx; |
314 | - if (! isset($list->tokens[$list->idx])) { |
|
314 | + if (!isset($list->tokens[$list->idx])) { |
|
315 | 315 | break; |
316 | 316 | } |
317 | 317 |
@@ -42,7 +42,7 @@ |
||
42 | 42 | $this->assertEquals([ |
43 | 43 | Token::TYPE_KEYWORD | Token::FLAG_KEYWORD_RESERVED => [ |
44 | 44 | 8 => ['RESERVED'], |
45 | - 9 => ['RESERVED2','RESERVED3','RESERVED4','RESERVED5'], |
|
45 | + 9 => ['RESERVED2', 'RESERVED3', 'RESERVED4', 'RESERVED5'], |
|
46 | 46 | ], |
47 | 47 | Token::TYPE_KEYWORD | Token::FLAG_KEYWORD_FUNCTION => [8 => ['FUNCTION']], |
48 | 48 | Token::TYPE_KEYWORD | Token::FLAG_KEYWORD_DATA_TYPE => [8 => ['DATATYPE']], |
@@ -26,7 +26,7 @@ |
||
26 | 26 | { |
27 | 27 | $str1 = new UtfString($this->testContents); |
28 | 28 | for ($i = 0; $i < $str1->length(); $i++) { |
29 | - $str1[$i];// Make offset offsetGet work |
|
29 | + $str1[$i]; // Make offset offsetGet work |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | foreach ($parser->statements as $statement) { |
65 | 65 | if ($statement instanceof TransactionStatement) { |
66 | 66 | foreach ($statement->statements as $transactionStatement) { |
67 | - if (! $transactionStatement instanceof SetStatement) { |
|
67 | + if (!$transactionStatement instanceof SetStatement) { |
|
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | continue; |
75 | 75 | } |
76 | 76 | |
77 | - if (! $statement instanceof SetStatement) { |
|
77 | + if (!$statement instanceof SetStatement) { |
|
78 | 78 | continue; |
79 | 79 | } |
80 | 80 |
@@ -89,7 +89,7 @@ |
||
89 | 89 | if ($token->type === Token::TYPE_OPERATOR && $token->value === '(') { |
90 | 90 | --$list->idx; // ArrayObj needs to start with `(` |
91 | 91 | $state = 1; |
92 | - continue;// do not add this token to the name |
|
92 | + continue; // do not add this token to the name |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $ret->name .= $token->value; |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | // Flags. |
50 | - return ! isset($pattern['flags']) |
|
51 | - || (! (($pattern['flags'] & $token->flags) === 0)); |
|
50 | + return !isset($pattern['flags']) |
|
51 | + || (!(($pattern['flags'] & $token->flags) === 0)); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -56,17 +56,17 @@ discard block |
||
56 | 56 | * @param Token[] $replace |
57 | 57 | */ |
58 | 58 | public static function replaceTokens( |
59 | - TokensList|string|UtfString $list, |
|
59 | + TokensList | string | UtfString $list, |
|
60 | 60 | array $find, |
61 | 61 | array $replace |
62 | - ): TokensList|string { |
|
62 | + ): TokensList | string { |
|
63 | 63 | /** |
64 | 64 | * Whether the first parameter is a list. |
65 | 65 | */ |
66 | 66 | $isList = $list instanceof TokensList; |
67 | 67 | |
68 | 68 | // Parsing the tokens. |
69 | - if (! $isList) { |
|
69 | + if (!$isList) { |
|
70 | 70 | $list = Lexer::getTokens($list); |
71 | 71 | } |
72 | 72 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | ++$j; |
125 | 125 | } |
126 | 126 | |
127 | - if (! static::match($list->tokens[$j], $find[$k])) { |
|
127 | + if (!static::match($list->tokens[$j], $find[$k])) { |
|
128 | 128 | // This token does not match the pattern. |
129 | 129 | break; |
130 | 130 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | * @param Token $token the token that produced this exception |
25 | 25 | * @param int $code the code of this error |
26 | 26 | */ |
27 | - public function __construct($msg = '', Token|null $token = null, $code = 0) |
|
27 | + public function __construct($msg = '', Token | null $token = null, $code = 0) |
|
28 | 28 | { |
29 | 29 | parent::__construct($msg, $code); |
30 | 30 | $this->token = $token; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | foreach ($longopts as $value) { |
41 | 41 | $value = rtrim($value, ':'); |
42 | - if (! isset($params[$value])) { |
|
42 | + if (!isset($params[$value])) { |
|
43 | 43 | continue; |
44 | 44 | } |
45 | 45 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string[]|false[]|false |
64 | 64 | */ |
65 | - public function getopt($opt, $long): array|false |
|
65 | + public function getopt($opt, $long): array | false |
|
66 | 66 | { |
67 | 67 | return getopt($opt, $long); |
68 | 68 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | /** |
71 | 71 | * @return string[]|false[]|false |
72 | 72 | */ |
73 | - public function parseHighlight(): array|false |
|
73 | + public function parseHighlight(): array | false |
|
74 | 74 | { |
75 | 75 | $longopts = [ |
76 | 76 | 'help', |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | $this->mergeLongOpts($params, $longopts); |
87 | - if (! isset($params['f'])) { |
|
87 | + if (!isset($params['f'])) { |
|
88 | 88 | $params['f'] = 'cli'; |
89 | 89 | } |
90 | 90 | |
91 | - if (! in_array($params['f'], ['html', 'cli', 'text'])) { |
|
91 | + if (!in_array($params['f'], ['html', 'cli', 'text'])) { |
|
92 | 92 | echo "ERROR: Invalid value for format!\n"; |
93 | 93 | |
94 | 94 | return false; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return 0; |
114 | 114 | } |
115 | 115 | |
116 | - if (! isset($params['q'])) { |
|
116 | + if (!isset($params['q'])) { |
|
117 | 117 | $stdIn = $this->readStdin(); |
118 | 118 | |
119 | 119 | if ($stdIn) { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | /** |
154 | 154 | * @return string[]|false[]|false |
155 | 155 | */ |
156 | - public function parseLint(): array|false |
|
156 | + public function parseLint(): array | false |
|
157 | 157 | { |
158 | 158 | $longopts = [ |
159 | 159 | 'help', |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | Context::load($params['c']); |
188 | 188 | } |
189 | 189 | |
190 | - if (! isset($params['q'])) { |
|
190 | + if (!isset($params['q'])) { |
|
191 | 191 | $stdIn = $this->readStdin(); |
192 | 192 | |
193 | 193 | if ($stdIn) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | /** |
233 | 233 | * @return string[]|false[]|false |
234 | 234 | */ |
235 | - public function parseTokenize(): array|false |
|
235 | + public function parseTokenize(): array | false |
|
236 | 236 | { |
237 | 237 | $longopts = [ |
238 | 238 | 'help', |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | return 0; |
262 | 262 | } |
263 | 263 | |
264 | - if (! isset($params['q'])) { |
|
264 | + if (!isset($params['q'])) { |
|
265 | 265 | $stdIn = $this->readStdin(); |
266 | 266 | |
267 | 267 | if ($stdIn) { |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | return 1; |
298 | 298 | } |
299 | 299 | |
300 | - public function readStdin(): string|false|null |
|
300 | + public function readStdin(): string | false | null |
|
301 | 301 | { |
302 | 302 | $read = [STDIN]; |
303 | 303 | $write = []; |