fixed bug when heredoc starts by \; removing \n from a heredoc value end
This commit is contained in:
@@ -665,6 +665,7 @@ func (p *Printer) printScalarHeredoc(n node.Node) {
|
||||
}
|
||||
}
|
||||
|
||||
io.WriteString(p.w, "\n")
|
||||
io.WriteString(p.w, strings.Trim(nn.Label, "\"'"))
|
||||
|
||||
p.printMeta(nn, meta.NodeEnd)
|
||||
|
||||
@@ -575,7 +575,7 @@ func TestPrinterPrintScalarHeredoc(t *testing.T) {
|
||||
Parts: []node.Node{
|
||||
&scalar.EncapsedStringPart{Value: "hello "},
|
||||
&expr.Variable{VarName: &node.Identifier{Value: "var"}},
|
||||
&scalar.EncapsedStringPart{Value: " world\n"},
|
||||
&scalar.EncapsedStringPart{Value: " world"},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -602,7 +602,7 @@ func TestPrinterPrintScalarNowdoc(t *testing.T) {
|
||||
},
|
||||
Label: "'LBL'",
|
||||
Parts: []node.Node{
|
||||
&scalar.EncapsedStringPart{Value: "hello world\n"},
|
||||
&scalar.EncapsedStringPart{Value: "hello world"},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user