phpdoc

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: MIT Imports: 7 Imported by: 1

README

phpdoc

A PHPDoc parser and printer, implemented in Go. It aims to be compatible with PHPStan.

Instalation

$ go get mibk.io/phpdoc

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 added in v0.2.0

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 added in v0.2.0

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

An ExtendsTag represents an @extends tag.

type ImplementsTag added in v0.2.0

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 added in v0.2.0

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 UsesTag added in v0.2.0

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
cmd
phpdocfmt
PHPDocfmt formats PHPDoc comments in PHP files.
PHPDocfmt formats PHPDoc comments in PHP files.
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