MCPcopy Create free account
hub / github.com/z7zmey/php-parser / printStmtClassMethod

Method printStmtClassMethod

printer/pretty_printer.go:1510–1545  ·  view source on GitHub ↗
(n node.Node)

Source from the content-addressed store, hash-verified

1508}
1509
1510func (p *PrettyPrinter) printStmtClassMethod(n node.Node) {
1511 nn := n.(*stmt.ClassMethod)
1512
1513 if nn.Modifiers != nil {
1514 p.joinPrint(" ", nn.Modifiers)
1515 io.WriteString(p.w, " ")
1516 }
1517 io.WriteString(p.w, "function ")
1518
1519 if nn.ReturnsRef {
1520 io.WriteString(p.w, "&")
1521 }
1522
1523 p.Print(nn.MethodName)
1524 io.WriteString(p.w, "(")
1525 p.joinPrint(", ", nn.Params)
1526 io.WriteString(p.w, ")")
1527
1528 if nn.ReturnType != nil {
1529 io.WriteString(p.w, ": ")
1530 p.Print(nn.ReturnType)
1531 }
1532
1533 switch s := nn.Stmt.(type) {
1534 case *stmt.StmtList:
1535 io.WriteString(p.w, "\n")
1536 p.printIndent()
1537 io.WriteString(p.w, "{\n")
1538 p.printNodes(s.Stmts)
1539 io.WriteString(p.w, "\n")
1540 p.printIndent()
1541 io.WriteString(p.w, "}")
1542 default:
1543 p.Print(s)
1544 }
1545}
1546
1547func (p *PrettyPrinter) printStmtClass(n node.Node) {
1548 nn := n.(*stmt.Class)

Callers 1

printNodeMethod · 0.95

Calls 4

joinPrintMethod · 0.95
PrintMethod · 0.95
printIndentMethod · 0.95
printNodesMethod · 0.95

Tested by

no test coverage detected