Skip to content

Commit e156355

Browse files
committed
fix - invalid curly close added when using "class" as an argument name - kokororin/vscode-phpfmt#173
1 parent 747dcc3 commit e156355

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

fmt.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13204,7 +13204,7 @@ public function format($source) {
1320413204
switch ($id) {
1320513205
case T_TRAIT:
1320613206
case T_CLASS:
13207-
if ($this->leftUsefulTokenIs(T_DOUBLE_COLON)) {
13207+
if ($this->leftUsefulTokenIs(T_DOUBLE_COLON) || $this->rightUsefulTokenIs(ST_COLON)) {
1320813208
$this->appendCode($text);
1320913209
break;
1321013210
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
//passes:StripNewlineWithinClassBody
3+
function bar($class) {
4+
echo $class;
5+
}
6+
7+
function foo() {
8+
bar(class: 'baz');
9+
}
10+
11+
// EOF
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
//passes:StripNewlineWithinClassBody
3+
function bar($class) {
4+
echo $class;
5+
}
6+
7+
function foo() {
8+
bar(class: 'baz');
9+
}
10+
11+
// EOF

0 commit comments

Comments
 (0)