Skip to content

Commit b3a9eb6

Browse files
niconoe-williamdes
authored andcommitted
Merge management of SET and ENUM at the same location.
1 parent 6c2f74a commit b3a9eb6

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/Components/AlterOperation.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -431,17 +431,18 @@ public static function parse(Parser $parser, TokensList $list, array $options =
431431
$list->idx++; // Ignore the current token
432432
$nextToken = $list->getNext();
433433

434-
if ($token->type === Token::TYPE_STRING) {
435-
// To avoid string options, like in ENUMs, to be interpreted as statements when they
436-
// actually are just strings.
437-
$ret->unknown[] = $token;
438-
continue;
439-
}
440-
441-
if ($token->value === 'SET' && $nextToken !== null && $nextToken->value === '(') {
442-
// To avoid adding the tokens between the SET() parentheses to the unknown tokens
434+
if (
435+
in_array($token->value, ['SET', 'ENUM'], true)
436+
&& $nextToken !== null
437+
&& $nextToken->value === '('
438+
) {
439+
// To avoid adding the tokens between the SET() or ENUM() parentheses to the unknown tokens
443440
$list->getNextOfTypeAndValue(Token::TYPE_OPERATOR, ')');
444-
} elseif ($token->value === 'SET' && $nextToken !== null && $nextToken->value === 'DEFAULT') {
441+
} elseif (
442+
in_array($token->value, ['SET', 'ENUM'], true)
443+
&& $nextToken !== null
444+
&& $nextToken->value === 'DEFAULT'
445+
) {
445446
// to avoid adding the `DEFAULT` token to the unknown tokens.
446447
++$list->idx;
447448
} else {

0 commit comments

Comments
 (0)