Skip to content

Commit eaa4f2a

Browse files
committed
fix - invalid auto semicolon - #94
1 parent 77d06ca commit eaa4f2a

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

fmt.stub.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8509,6 +8509,19 @@ public function format($source) {
85098509
$this->appendCode($text);
85108510
break;
85118511
}
8512+
8513+
if ($this->rightUsefulTokenIs([
8514+
ST_BITWISE_OR, ST_BITWISE_XOR, ST_CONCAT, ST_DIVIDE, ST_EQUAL, ST_MINUS, ST_PLUS, ST_QUESTION,
8515+
ST_TIMES, T_AND_EQUAL, T_BOOLEAN_AND, T_BOOLEAN_OR, T_COALESCE, T_COALESCE_EQUAL, T_CONCAT_EQUAL,
8516+
T_DIV_EQUAL, T_IS_EQUAL, T_IS_GREATER_OR_EQUAL, T_IS_IDENTICAL, T_IS_NOT_EQUAL,
8517+
T_IS_NOT_IDENTICAL, T_IS_SMALLER_OR_EQUAL, T_LOGICAL_AND, T_LOGICAL_OR, T_LOGICAL_XOR, T_MOD_EQUAL,
8518+
T_MUL_EQUAL, T_OR_EQUAL, T_PLUS_EQUAL, T_POW, T_POW_EQUAL, T_SL, T_SL_EQUAL, T_SPACESHIP, T_SR_EQUAL,
8519+
T_XOR_EQUAL, ST_IS_GREATER, ST_IS_SMALLER
8520+
])) {
8521+
$this->appendCode($text);
8522+
break;
8523+
}
8524+
85128525
if ($touchedSingleColon && $ternary) {
85138526
$touchedSingleColon = false;
85148527
--$ternary;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
//passes:AutoSemicolon
3+
4+
$j->first(fn($a) => $a === 2) ?? 3;
5+
6+
$j->first(fn($a) => $a === 1)
7+
?? 1;
8+
9+
$j->first(fn($a) => $a === 1)
10+
< 1;
11+
12+
$j->first(fn($a) => $a === 1)
13+
??= 1;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
//passes:AutoSemicolon
3+
4+
$j->first(fn($a) => $a === 2) ?? 3;
5+
6+
$j->first(fn($a) => $a === 1) ?? 1;
7+
8+
$j->first(fn($a) => $a === 1)
9+
< 1;
10+
11+
$j->first(fn($a) => $a === 1) ??= 1;

0 commit comments

Comments
 (0)