Skip to content

Commit 0ace60f

Browse files
authored
Update PHP parser to allow for dangling comma in use block (#1796)
This was fixed in glayzzle/php-parser#776 Fixes #1795
1 parent d57e587 commit 0ace60f

4 files changed

Lines changed: 41 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dependencies": {
1414
"linguist-languages": "^7.5.1",
1515
"mem": "^8.0.0",
16-
"php-parser": "https://github.com/glayzzle/php-parser#cca83041d938b972c7ef74648f29de03777b0ea4"
16+
"php-parser": "https://github.com/glayzzle/php-parser#e61e26102144f267ecf5e09020865a9baa6ca2f1"
1717
},
1818
"devDependencies": {
1919
"@babel/preset-env": "^7.7.5",

tests/trailing_comma_func/__snapshots__/jsfmt.spec.js.snap

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ f3(
4141
"abcdefghijklmnopqrstuvwxyz",
4242
);
4343
44+
$f4 = function () use (
45+
$closureUseBlockVariableOne,
46+
$closureUseBlockVariableTwo,
47+
$closureUseBlockVariableThree,
48+
$closureUseBlockVariableFour,
49+
) {
50+
};
51+
4452
=====================================output=====================================
4553
<?php
4654
@@ -75,6 +83,13 @@ f3(
7583
"abcdefghijklmnopqrstuvwxyz"
7684
);
7785
86+
$f4 = function () use (
87+
$closureUseBlockVariableOne,
88+
$closureUseBlockVariableTwo,
89+
$closureUseBlockVariableThree,
90+
$closureUseBlockVariableFour
91+
) {};
92+
7893
================================================================================
7994
`;
8095

@@ -119,6 +134,14 @@ f3(
119134
"abcdefghijklmnopqrstuvwxyz",
120135
);
121136
137+
$f4 = function () use (
138+
$closureUseBlockVariableOne,
139+
$closureUseBlockVariableTwo,
140+
$closureUseBlockVariableThree,
141+
$closureUseBlockVariableFour,
142+
) {
143+
};
144+
122145
=====================================output=====================================
123146
<?php
124147
@@ -153,5 +176,12 @@ f3(
153176
"abcdefghijklmnopqrstuvwxyz",
154177
);
155178
179+
$f4 = function () use (
180+
$closureUseBlockVariableOne,
181+
$closureUseBlockVariableTwo,
182+
$closureUseBlockVariableThree,
183+
$closureUseBlockVariableFour,
184+
) {};
185+
156186
================================================================================
157187
`;

tests/trailing_comma_func/function.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,11 @@ function f3(
2929
"abcdefghijklmnopqrstuvwxyz",
3030
"abcdefghijklmnopqrstuvwxyz",
3131
);
32+
33+
$f4 = function () use (
34+
$closureUseBlockVariableOne,
35+
$closureUseBlockVariableTwo,
36+
$closureUseBlockVariableThree,
37+
$closureUseBlockVariableFour,
38+
) {
39+
};

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4013,9 +4013,9 @@ path-type@^4.0.0:
40134013
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
40144014
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==
40154015

4016-
"php-parser@https://github.com/glayzzle/php-parser#cca83041d938b972c7ef74648f29de03777b0ea4":
4016+
"php-parser@https://github.com/glayzzle/php-parser#e61e26102144f267ecf5e09020865a9baa6ca2f1":
40174017
version "3.0.2"
4018-
resolved "https://github.com/glayzzle/php-parser#cca83041d938b972c7ef74648f29de03777b0ea4"
4018+
resolved "https://github.com/glayzzle/php-parser#e61e26102144f267ecf5e09020865a9baa6ca2f1"
40194019

40204020
picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1:
40214021
version "2.2.2"

0 commit comments

Comments
 (0)