Skip to content

Commit

Permalink
Fix empty SET operations now throw error.
Browse files Browse the repository at this point in the history
  • Loading branch information
niconoe- committed Aug 26, 2024
1 parent b82f356 commit ea61748
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Components/SetOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$parser->error('Unexpected token.', $commaLastSeenAt);
}

// We got a SET operation without any assignment
if ($ret === []) {
$parser->error('Missing assignment in SET operation.', $list->tokens[$list->idx]);
}

return $ret;
}

Expand Down
10 changes: 9 additions & 1 deletion tests/data/parser/parseUpdateEmptySet.out
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@
},
"errors": {
"lexer": [],
"parser": []
"parser": [
[
"Missing assignment in SET operation.",
{
"@type": "@7"
},
0
]
]
}
}

0 comments on commit ea61748

Please sign in to comment.