Skip to content

Commit

Permalink
Improve types for Psalm and error's message improvement
Browse files Browse the repository at this point in the history
Signed-off-by: Fawzi E. Abdulfattah <[email protected]>
  • Loading branch information
iifawzi committed Dec 6, 2021
1 parent 2961130 commit 85a6461
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 9 deletions.
9 changes: 8 additions & 1 deletion src/Statements/WithStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,14 @@ public function parse(Parser $parser, TokensList $list)

// 5 is the only valid end state
if ($state !== 5) {
$parser->error('Unexpected end of WITH CTE.', $list->tokens[$list->idx]);
/**
* Token parsed at this moment.
*
* @var Token
*/
$token = $list->tokens[$list->idx];

$parser->error('Unexpected end of the WITH CTE.', $token);
}

--$list->idx;
Expand Down
2 changes: 1 addition & 1 deletion tests/data/parser/parseWithStatement4.out
Original file line number Diff line number Diff line change
Expand Up @@ -1699,7 +1699,7 @@
0
],
[
"Unexpected end of WITH CTE.",
"Unexpected end of the WITH CTE.",
{
"@type": "@34"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/data/parser/parseWithStatementErr.out
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@
0
],
[
"Unexpected end of WITH CTE.",
"Unexpected end of the WITH CTE.",
{
"@type": "@12"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/data/parser/parseWithStatementErr1.out
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,7 @@
0
],
[
"Unexpected end of WITH CTE.",
"Unexpected end of the WITH CTE.",
{
"@type": "@16"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/data/parser/parseWithStatementErr2.out
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@
0
],
[
"Unexpected end of WITH CTE.",
"Unexpected end of the WITH CTE.",
{
"@type": "@25"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/data/parser/parseWithStatementErr3.out
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@
0
],
[
"Unexpected end of WITH CTE.",
"Unexpected end of the WITH CTE.",
{
"@type": "@32"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/data/parser/parseWithStatementErr4.out
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,7 @@
0
],
[
"Unexpected end of WITH CTE.",
"Unexpected end of the WITH CTE.",
{
"@type": "@32"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/data/parser/parseWithStatementErr5.out
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@
0
],
[
"Unexpected end of WITH CTE.",
"Unexpected end of the WITH CTE.",
{
"@type": "@10"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/data/parser/parseWithStatementErr6.out
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,7 @@
0
],
[
"Unexpected end of WITH CTE.",
"Unexpected end of the WITH CTE.",
{
"@type": "@18"
},
Expand Down

0 comments on commit 85a6461

Please sign in to comment.