Skip to content

Commit 6844b88

Browse files
committed
Merge management of SET and ENUM at the same location.
1 parent f950785 commit 6844b88

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
@@ -429,17 +429,18 @@ public static function parse(Parser $parser, TokensList $list, array $options =
429429
$list->idx++; // Ignore the current token
430430
$nextToken = $list->getNext();
431431

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

0 commit comments

Comments
 (0)