File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -8304,6 +8304,8 @@ public function format($source) {
83048304 $ isAttribute = false ;
83058305 $ quote_stack = false ;
83068306
8307+ $ max = count ($ this ->tkns );
8308+
83078309 while (list ($ index , $ token ) = $ this ->each ($ this ->tkns )) {
83088310 list ($ id , $ text ) = $ this ->getToken ($ token );
83098311 $ this ->ptr = $ index ;;
@@ -8326,9 +8328,19 @@ public function format($source) {
83268328 if ($ this ->hasLnAfter () && $ this ->rightTokenIs (ST_CURLY_CLOSE ) && ! $ isMatch ) {
83278329 $ this ->appendCode (ST_SEMI_COLON );
83288330 }
8331+ else
83298332 if ($ this ->hasLnAfter () && $ this ->rightTokenIs ([T_COMMENT , T_DOC_COMMENT ]) && ! $ isMatch ) {
83308333 $ this ->appendCode (ST_SEMI_COLON );
83318334 }
8335+ else
8336+ if ($ this ->rightUsefulTokenIs (T_VARIABLE ) && $ this ->rightTokenIs ([T_COMMENT , T_DOC_COMMENT ])) {
8337+ $ this ->appendCode (ST_SEMI_COLON );
8338+ }
8339+ else
8340+ if ($ this ->ptr === $ max - 2 && $ this ->rightTokenIs ([T_COMMENT , T_DOC_COMMENT ])) {
8341+ $ this ->appendCode (ST_SEMI_COLON );
8342+ }
8343+
83328344 break ;
83338345
83348346 case T_ATTRIBUTE :
Original file line number Diff line number Diff line change 1+ <?php
2+ //passes:AutoSemicolon
3+
4+ $a = 1//
5+ $B = 2;
6+
7+ $a = 1
8+ //
9+ $B = 2;
10+
11+ $a = 1
12+ //
13+ /** other comment */
14+ $B = 2;
15+
16+ $a = 1// $b=2
Original file line number Diff line number Diff line change 1+ <?php
2+ //passes:AutoSemicolon
3+
4+ $a = 1; //
5+ $B = 2;
6+
7+ $a = 1;
8+ //
9+ $B = 2;
10+
11+ $a = 1;
12+ //
13+ /** other comment */
14+ $B = 2;
15+
16+ $a = 1; // $b=2
You can’t perform that action at this time.
0 commit comments