Skip to content

Commit eda0fff

Browse files
committed
fix - invalid visibility - edge cases - kokororin/vscode-phpfmt#172
1 parent fcc2ca4 commit eda0fff

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

fmt.stub.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6589,8 +6589,9 @@ public function format($source) {
65896589
}
65906590
break;
65916591
case '?':
6592-
if ($this->rightUsefulTokenIs([T_STRING, T_ARRAY, T_NAME_RELATIVE, T_NAME_QUALIFIED, T_NAME_FULLY_QUALIFIED])) {
6593-
$this->tkns[$this->ptr + 1][1] = $text . $this->tkns[$this->ptr + 1][1];
6592+
$tidx = $this->rightUsefulTokenIdx();
6593+
if (in_array($this->tkns[$tidx][0], [T_STRING, T_ARRAY, T_NAME_RELATIVE, T_NAME_QUALIFIED, T_NAME_FULLY_QUALIFIED]) && (! isset($this->tkns[$tidx + 1]) || $this->tkns[$tidx + 1][0] !== '(')) {
6594+
$this->tkns[$tidx][1] = $text . $this->tkns[$tidx][1];
65946595
} else {
65956596
$this->appendCode($text);
65966597
}

0 commit comments

Comments
 (0)