Skip to content

Commit f950785

Browse files
committed
Apply fix and update out files to show that fix is correct.
1 parent 616512c commit f950785

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

src/Components/AlterOperation.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,13 @@ 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+
432439
if ($token->value === 'SET' && $nextToken !== null && $nextToken->value === '(') {
433440
// To avoid adding the tokens between the SET() parentheses to the unknown tokens
434441
$list->getNextOfTypeAndValue(Token::TYPE_OPERATOR, ')');

tests/data/parser/parseAlterTableModifyColumnEnum2.out

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,12 @@
250250
},
251251
{
252252
"@type": "@15"
253+
},
254+
{
255+
"@type": "@16"
256+
},
257+
{
258+
"@type": "@19"
253259
}
254260
]
255261
}
@@ -270,14 +276,6 @@
270276
},
271277
"errors": {
272278
"lexer": [],
273-
"parser": [
274-
[
275-
"A new statement was found, but no delimiter between it and the previous one.",
276-
{
277-
"@type": "@16"
278-
},
279-
0
280-
]
281-
]
279+
"parser": []
282280
}
283281
}

tests/data/parser/parseAlterTableModifyColumnEnum3.out

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,12 @@
250250
},
251251
{
252252
"@type": "@15"
253+
},
254+
{
255+
"@type": "@16"
256+
},
257+
{
258+
"@type": "@19"
253259
}
254260
]
255261
}
@@ -270,14 +276,6 @@
270276
},
271277
"errors": {
272278
"lexer": [],
273-
"parser": [
274-
[
275-
"A new statement was found, but no delimiter between it and the previous one.",
276-
{
277-
"@type": "@16"
278-
},
279-
0
280-
]
281-
]
279+
"parser": []
282280
}
283281
}

0 commit comments

Comments
 (0)