Skip to content

Commit 85a6461

Browse files
committed
Improve types for Psalm and error's message improvement
Signed-off-by: Fawzi E. Abdulfattah <[email protected]>
1 parent 2961130 commit 85a6461

9 files changed

+16
-9
lines changed

src/Statements/WithStatement.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,14 @@ public function parse(Parser $parser, TokensList $list)
240240

241241
// 5 is the only valid end state
242242
if ($state !== 5) {
243-
$parser->error('Unexpected end of WITH CTE.', $list->tokens[$list->idx]);
243+
/**
244+
* Token parsed at this moment.
245+
*
246+
* @var Token
247+
*/
248+
$token = $list->tokens[$list->idx];
249+
250+
$parser->error('Unexpected end of the WITH CTE.', $token);
244251
}
245252

246253
--$list->idx;

tests/data/parser/parseWithStatement4.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@
16991699
0
17001700
],
17011701
[
1702-
"Unexpected end of WITH CTE.",
1702+
"Unexpected end of the WITH CTE.",
17031703
{
17041704
"@type": "@34"
17051705
},

tests/data/parser/parseWithStatementErr.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@
796796
0
797797
],
798798
[
799-
"Unexpected end of WITH CTE.",
799+
"Unexpected end of the WITH CTE.",
800800
{
801801
"@type": "@12"
802802
},

tests/data/parser/parseWithStatementErr1.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1594,7 +1594,7 @@
15941594
0
15951595
],
15961596
[
1597-
"Unexpected end of WITH CTE.",
1597+
"Unexpected end of the WITH CTE.",
15981598
{
15991599
"@type": "@16"
16001600
},

tests/data/parser/parseWithStatementErr2.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,7 @@
13471347
0
13481348
],
13491349
[
1350-
"Unexpected end of WITH CTE.",
1350+
"Unexpected end of the WITH CTE.",
13511351
{
13521352
"@type": "@25"
13531353
},

tests/data/parser/parseWithStatementErr3.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,7 @@
16721672
0
16731673
],
16741674
[
1675-
"Unexpected end of WITH CTE.",
1675+
"Unexpected end of the WITH CTE.",
16761676
{
16771677
"@type": "@32"
16781678
},

tests/data/parser/parseWithStatementErr4.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@
16811681
0
16821682
],
16831683
[
1684-
"Unexpected end of WITH CTE.",
1684+
"Unexpected end of the WITH CTE.",
16851685
{
16861686
"@type": "@32"
16871687
},

tests/data/parser/parseWithStatementErr5.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@
909909
0
910910
],
911911
[
912-
"Unexpected end of WITH CTE.",
912+
"Unexpected end of the WITH CTE.",
913913
{
914914
"@type": "@10"
915915
},

tests/data/parser/parseWithStatementErr6.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1421,7 +1421,7 @@
14211421
0
14221422
],
14231423
[
1424-
"Unexpected end of WITH CTE.",
1424+
"Unexpected end of the WITH CTE.",
14251425
{
14261426
"@type": "@18"
14271427
},

0 commit comments

Comments
 (0)