Skip to content

Commit 5a3db2d

Browse files
committed
feat - improve auto semicolon
1 parent ae2e531 commit 5a3db2d

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

fmt.stub.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8392,6 +8392,9 @@ public function format($source) {
83928392
$this->appendCode(ST_SEMI_COLON);
83938393
break;
83948394
}
8395+
} else
8396+
if ($this->rightUsefulTokenIs(T_VARIABLE) && $this->rightTokenIs([T_COMMENT, T_DOC_COMMENT])) {
8397+
$this->appendCode(ST_SEMI_COLON);
83958398
}
83968399
break;
83978400

tests/Original/512-add-semicolons.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?php
22
//passes:AutoSemicolon
33

4+
$this->call()
5+
//
6+
/** other comment */
7+
$B = 2;
8+
49
$a = 1//
510
$B = 2;
611

tests/Original/512-add-semicolons.out

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?php
22
//passes:AutoSemicolon
33

4+
$this->call();
5+
//
6+
/** other comment */
7+
$B = 2;
8+
49
$a = 1; //
510
$B = 2;
611

0 commit comments

Comments
 (0)