phpdoc

package
v0.0.0-...-520d0b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package phpdoc implements parsing and printing of PHPDoc comments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fprint

func Fprint(w io.Writer, node interface{}) error

Fprint "pretty-prints" an AST node to w.

Types

type Block

type Block struct {
	Lines         []Line
	Indent        string // … each line
	PreferOneline bool
}

A Block represents a PHPDoc comment block.

func Parse

func Parse(r io.Reader) (*Block, error)

Parse parses a single PHPDoc comment.

type ExtendsTag

type ExtendsTag struct {
	Class phptype.Type
	Desc  string
	// contains filtered or unexported fields
}

An ExtendsTag represents an @extends tag.

type ImplementsTag

type ImplementsTag struct {
	Interface phptype.Type
	Desc      string
	// contains filtered or unexported fields
}

An ImplementsTag represents an @implements tag.

type Line

type Line interface {
	// contains filtered or unexported methods
}

A Line represents a line in a PHPDoc comment.

type MethodTag

type MethodTag struct {
	Static bool
	Result phptype.Type // or nil
	Name   string
	Params []*phptype.Param
	Desc   string
	// contains filtered or unexported fields
}

A MethodTag represents a @method tag.

type OtherTag

type OtherTag struct {
	Name string
	Desc string
	// contains filtered or unexported fields
}

A OtherTag represents an arbitrary tag without a special meaning.

type ParamTag

type ParamTag struct {
	Param *phptype.Param
	Desc  string
	// contains filtered or unexported fields
}

A ParamTag represents a @param tag.

type PropertyTag

type PropertyTag struct {
	ReadOnly, WriteOnly bool
	Type                phptype.Type
	Var                 string
	Desc                string
	// contains filtered or unexported fields
}

A PropertyTag represents a @property tag, as well as its variants @property-read and @property-write.

type ReturnTag

type ReturnTag struct {
	Type phptype.Type
	Desc string
	// contains filtered or unexported fields
}

A ReturnTag represents a @return tag.

type SyntaxError

type SyntaxError struct {
	Line, Column int
	Err          error
}

SyntaxError records an error and the position it occured on.

func (*SyntaxError) Error

func (e *SyntaxError) Error() string

type Tag

type Tag interface {
	Line
	// contains filtered or unexported methods
}

A Tag represents a tag line in a PHPDoc comment (e.g. @author).

type TemplateTag

type TemplateTag struct {
	Param string
	Bound phptype.Type // or nil
	Desc  string
	// contains filtered or unexported fields
}

A TemplateTag represents a @template tag.

type TextLine

type TextLine struct {
	Value string
	// contains filtered or unexported fields
}

A TextLine represents a regular, text-only line in a PHPDoc comment.

type ThrowsTag

type ThrowsTag struct {
	Class phptype.Type
	Desc  string
	// contains filtered or unexported fields
}

A ThrowsTag represents a @throws tag.

type TypeDefTag

type TypeDefTag struct {
	Name string
	Type phptype.Type
	Desc string
	// contains filtered or unexported fields
}

A TemplateTag represents a @phpstan-type tag.

type UsesTag

type UsesTag struct {
	Trait phptype.Type
	Desc  string
	// contains filtered or unexported fields
}

A UsesTag represents a @uses tag.

type VarTag

type VarTag struct {
	Type phptype.Type
	Var  string
	Desc string
	// contains filtered or unexported fields
}

A VarTag represents a @var tag.

Directories

Path Synopsis
internal
Package phptype declares PHP types that can be used in PHPDoc syntax trees.
Package phptype declares PHP types that can be used in PHPDoc syntax trees.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL