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

Method printStmtClassMethod

printer/printer.go:2200–2248  ·  view source on GitHub ↗
(n node.Node)

Source from the content-addressed store, hash-verified

2198}
2199
2200func (p *Printer) printStmtClassMethod(n node.Node) {
2201 nn := n.(*stmt.ClassMethod)
2202 p.printFreeFloating(nn, freefloating.Start)
2203
2204 if nn.Modifiers != nil {
2205 for k, m := range nn.Modifiers {
2206 if k > 0 && m.GetFreeFloating().IsEmpty() {
2207 io.WriteString(p.w, " ")
2208 }
2209 p.Print(m)
2210 }
2211
2212 if nn.GetFreeFloating().IsEmpty() {
2213 io.WriteString(p.w, " ")
2214 }
2215 }
2216 p.printFreeFloating(nn, freefloating.ModifierList)
2217 io.WriteString(p.w, "function")
2218 p.printFreeFloating(nn, freefloating.Function)
2219
2220 if nn.ReturnsRef {
2221 if nn.GetFreeFloating().IsEmpty() {
2222 io.WriteString(p.w, " ")
2223 }
2224 io.WriteString(p.w, "&")
2225 p.printFreeFloating(nn, freefloating.Ampersand)
2226 } else {
2227 if nn.GetFreeFloating().IsEmpty() {
2228 io.WriteString(p.w, " ")
2229 }
2230 }
2231
2232 p.Print(nn.MethodName)
2233 p.printFreeFloating(nn, freefloating.Name)
2234 io.WriteString(p.w, "(")
2235 p.joinPrint(",", nn.Params)
2236 p.printFreeFloating(nn, freefloating.ParameterList)
2237 io.WriteString(p.w, ")")
2238 p.printFreeFloating(nn, freefloating.Params)
2239
2240 if nn.ReturnType != nil {
2241 io.WriteString(p.w, ":")
2242 p.Print(nn.ReturnType)
2243 }
2244
2245 p.Print(nn.Stmt)
2246
2247 p.printFreeFloating(nn, freefloating.End)
2248}
2249
2250func (p *Printer) printStmtClass(n node.Node) {
2251 nn := n.(*stmt.Class)

Callers 1

printNodeMethod · 0.95

Calls 5

printFreeFloatingMethod · 0.95
PrintMethod · 0.95
joinPrintMethod · 0.95
IsEmptyMethod · 0.80
GetFreeFloatingMethod · 0.65

Tested by

no test coverage detected