File tree Expand file tree Collapse file tree 2 files changed +35
-2
lines changed
test/code/formatPreservation Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -736,7 +736,7 @@ protected function p(
736
736
$ result .= $ extraLeft ;
737
737
738
738
$ origIndentLevel = $ this ->indentLevel ;
739
- $ this ->setIndentLevel ($ this ->origTokens ->getIndentationBefore ($ subStartPos ) + $ indentAdjustment );
739
+ $ this ->setIndentLevel (max ( $ this ->origTokens ->getIndentationBefore ($ subStartPos ) + $ indentAdjustment, 0 ) );
740
740
741
741
// If it's the same node that was previously in this position, it certainly doesn't
742
742
// need fixup. It's important to check this here, because our fixup checks are more
@@ -839,7 +839,7 @@ protected function pArray(
839
839
\assert ($ itemStartPos >= 0 && $ itemEndPos >= 0 && $ itemStartPos >= $ pos );
840
840
841
841
$ origIndentLevel = $ this ->indentLevel ;
842
- $ lastElemIndentLevel = $ this ->origTokens ->getIndentationBefore ($ itemStartPos ) + $ indentAdjustment ;
842
+ $ lastElemIndentLevel = max ( $ this ->origTokens ->getIndentationBefore ($ itemStartPos ) + $ indentAdjustment, 0 ) ;
843
843
$ this ->setIndentLevel ($ lastElemIndentLevel );
844
844
845
845
$ comments = $ arrItem ->getComments ();
Original file line number Diff line number Diff line change @@ -35,3 +35,36 @@ if ($a) {
35
35
@@{"\t"}@@$x;
36
36
@@{"\t"}@@$y;
37
37
}
38
+ -----
39
+ <?php
40
+ array_merge(
41
+ [
42
+ $x,
43
+ $y,
44
+ ]
45
+ );
46
+ -----
47
+ $call = $stmts[0]->expr;
48
+ $stmts[0]->expr = new Expr\StaticCall(new Node\Name\FullyQualified('Compat'), $call->name, $call->args);
49
+ -----
50
+ <?php
51
+ \Compat::array_merge([
52
+ $x,
53
+ $y,
54
+ ]);
55
+ -----
56
+ <?php
57
+ if ($a) {
58
+ if (
59
+ $b
60
+ ) {}
61
+ }
62
+ -----
63
+ $stmts[0] = new Stmt\While_($stmts[0]->cond, $stmts[0]->stmts);
64
+ -----
65
+ <?php
66
+ while ($a) {
67
+ if (
68
+ $b
69
+ ) {}
70
+ }
You can’t perform that action at this time.
0 commit comments