@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @var ArrayObj[]|null |
65 | 65 | */ |
66 | - public array|null $values = null; |
|
66 | + public array | null $values = null; |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * If SET clause is present |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @var SetOperation[]|null |
73 | 73 | */ |
74 | - public array|null $set = null; |
|
74 | + public array | null $set = null; |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * If SELECT clause is present |
@@ -30,7 +30,7 @@ |
||
30 | 30 | * Test for loading closest SQL context |
31 | 31 | */ |
32 | 32 | #[DataProvider('contextLoadingProvider')] |
33 | - public function testLoadClosest(string $context, string|null $expected): void |
|
33 | + public function testLoadClosest(string $context, string | null $expected): void |
|
34 | 34 | { |
35 | 35 | $this->assertEquals($expected, Context::loadClosest($context)); |
36 | 36 | if ($expected !== null) { |
@@ -86,7 +86,7 @@ |
||
86 | 86 | * Test access to string. |
87 | 87 | */ |
88 | 88 | #[DataProvider('utf8StringsProvider')] |
89 | - public function testAccess(string $text, string|null $pos10, string|null $pos20): void |
|
89 | + public function testAccess(string $text, string | null $pos10, string | null $pos20): void |
|
90 | 90 | { |
91 | 91 | $str = new UtfString($text); |
92 | 92 | $this->assertEquals($pos10, $str->offsetGet(10)); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * |
78 | 78 | * @var ArrayObj[]|null |
79 | 79 | */ |
80 | - public array|null $values = null; |
|
80 | + public array | null $values = null; |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * If SET clause is present |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @var SetOperation[]|null |
87 | 87 | */ |
88 | - public array|null $set = null; |
|
88 | + public array | null $set = null; |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * If SELECT clause is present |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @var SetOperation[]|null |
111 | 111 | */ |
112 | - public array|null $onDuplicateSet = null; |
|
112 | + public array | null $onDuplicateSet = null; |
|
113 | 113 | |
114 | 114 | public function build(): string |
115 | 115 | { |
@@ -49,7 +49,7 @@ |
||
49 | 49 | * |
50 | 50 | * @return ArrayObj|Component[] |
51 | 51 | */ |
52 | - public static function parse(Parser $parser, TokensList $list, array $options = []): ArrayObj|array |
|
52 | + public static function parse(Parser $parser, TokensList $list, array $options = []): ArrayObj | array |
|
53 | 53 | { |
54 | 54 | $ret = empty($options['type']) ? new static() : []; |
55 | 55 |
@@ -47,7 +47,7 @@ |
||
47 | 47 | |
48 | 48 | public function build(): string |
49 | 49 | { |
50 | - if (! isset($this->statement)) { |
|
50 | + if (!isset($this->statement)) { |
|
51 | 51 | throw new RuntimeException('No statement inside WITH'); |
52 | 52 | } |
53 | 53 |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | if ($lastOption === null) { |
110 | 110 | $upper = strtoupper($token->token); |
111 | - if (! isset($options[$upper])) { |
|
111 | + if (!isset($options[$upper])) { |
|
112 | 112 | // There is no option to be processed. |
113 | 113 | break; |
114 | 114 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | if ($state === 0) { |
148 | - if (! is_array($lastOption)) { |
|
148 | + if (!is_array($lastOption)) { |
|
149 | 149 | // This is a just keyword option without any value. |
150 | 150 | // This is the beginning and the end of it. |
151 | 151 | $ret->options[$lastOptionId] = $token->value; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $ret->options[$lastOptionId]['expr'] .= $token->token; |
223 | 223 | |
224 | 224 | if ( |
225 | - ! (($token->token === '(') && ($brackets === 1) |
|
225 | + !(($token->token === '(') && ($brackets === 1) |
|
226 | 226 | || (($token->token === ')') && ($brackets === 0))) |
227 | 227 | ) { |
228 | 228 | // First pair of brackets is being skipped. |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | |
275 | 275 | $options = []; |
276 | 276 | foreach ($this->options as $option) { |
277 | - if (! is_array($option)) { |
|
277 | + if (!is_array($option)) { |
|
278 | 278 | $options[] = $option; |
279 | 279 | } else { |
280 | 280 | $options[] = $option['name'] |
281 | - . (! empty($option['equals']) ? '=' : ' ') |
|
282 | - . (! empty($option['expr']) ? $option['expr'] : $option['value']); |
|
281 | + . (!empty($option['equals']) ? '=' : ' ') |
|
282 | + . (!empty($option['expr']) ? $option['expr'] : $option['value']); |
|
283 | 283 | } |
284 | 284 | } |
285 | 285 | |
@@ -299,10 +299,10 @@ discard block |
||
299 | 299 | { |
300 | 300 | foreach ($this->options as $option) { |
301 | 301 | if (is_array($option)) { |
302 | - if (! strcasecmp($key, $option['name'])) { |
|
302 | + if (!strcasecmp($key, $option['name'])) { |
|
303 | 303 | return $getExpr ? $option['expr'] : $option['value']; |
304 | 304 | } |
305 | - } elseif (! strcasecmp($key, $option)) { |
|
305 | + } elseif (!strcasecmp($key, $option)) { |
|
306 | 306 | return true; |
307 | 307 | } |
308 | 308 | } |
@@ -321,12 +321,12 @@ discard block |
||
321 | 321 | { |
322 | 322 | foreach ($this->options as $idx => $option) { |
323 | 323 | if (is_array($option)) { |
324 | - if (! strcasecmp($key, $option['name'])) { |
|
324 | + if (!strcasecmp($key, $option['name'])) { |
|
325 | 325 | unset($this->options[$idx]); |
326 | 326 | |
327 | 327 | return true; |
328 | 328 | } |
329 | - } elseif (! strcasecmp($key, $option)) { |
|
329 | + } elseif (!strcasecmp($key, $option)) { |
|
330 | 330 | unset($this->options[$idx]); |
331 | 331 | |
332 | 332 | return true; |
@@ -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')) { |
@@ -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']], |