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(
736736 $ result .= $ extraLeft ;
737737
738738 $ origIndentLevel = $ this ->indentLevel ;
739- $ this ->setIndentLevel ($ this ->origTokens ->getIndentationBefore ($ subStartPos ) + $ indentAdjustment );
739+ $ this ->setIndentLevel (max ( $ this ->origTokens ->getIndentationBefore ($ subStartPos ) + $ indentAdjustment, 0 ) );
740740
741741 // If it's the same node that was previously in this position, it certainly doesn't
742742 // need fixup. It's important to check this here, because our fixup checks are more
@@ -839,7 +839,7 @@ protected function pArray(
839839 \assert ($ itemStartPos >= 0 && $ itemEndPos >= 0 && $ itemStartPos >= $ pos );
840840
841841 $ origIndentLevel = $ this ->indentLevel ;
842- $ lastElemIndentLevel = $ this ->origTokens ->getIndentationBefore ($ itemStartPos ) + $ indentAdjustment ;
842+ $ lastElemIndentLevel = max ( $ this ->origTokens ->getIndentationBefore ($ itemStartPos ) + $ indentAdjustment, 0 ) ;
843843 $ this ->setIndentLevel ($ lastElemIndentLevel );
844844
845845 $ comments = $ arrItem ->getComments ();
Original file line number Diff line number Diff line change @@ -35,3 +35,36 @@ if ($a) {
3535@@{"\t"}@@$x;
3636@@{"\t"}@@$y;
3737}
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