phpdoc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsPHPDoc

func IsPHPDoc(doc string) bool

IsPHPDoc checks if the string is a doc comment

Types

type ArrayType added in v0.2.0

type ArrayType struct{ Elem TypeExpr }

ArrayType is `elem[]` type.

func (*ArrayType) String added in v0.2.0

func (typ *ArrayType) String() string

type CommentPart

type CommentPart struct {
	Line       int      // Comment part location inside phpdoc comment
	Name       string   // e.g. "param" for "* @param something bla-bla-bla"
	Params     []string // {"something", "bla-bla-bla"} in example above
	ParamsText string   // "something bla-bla-bla" in example above
}

func Parse

func Parse(doc string) (res []CommentPart)

Parse returns parsed doc comment with interesting parts (ones that start "* @")

func (*CommentPart) ContainsParam

func (part *CommentPart) ContainsParam(name string) bool

ContainsParam reports whether comment part contains param of specified name.

type InterType added in v0.2.0

type InterType struct{ X, Y TypeExpr }

InterType is `x&y` type. Intersection type requires a type to "implement" both X and Y.

func (*InterType) String added in v0.2.0

func (typ *InterType) String() string

type NamedType added in v0.2.0

type NamedType struct{ Name string }

NamedType is a type that is identified by its name.

func (*NamedType) String added in v0.2.0

func (typ *NamedType) String() string

type NotType added in v0.2.0

type NotType struct{ Expr TypeExpr }

NotType is `!expr` type.

func (*NotType) String added in v0.2.0

func (typ *NotType) String() string

type NullableType added in v0.2.0

type NullableType struct{ Expr TypeExpr }

NullableType is `?expr` type.

func (*NullableType) String added in v0.2.0

func (typ *NullableType) String() string

type TypeExpr added in v0.2.0

type TypeExpr interface {

	// String returns a textual representation of a type.
	String() string
	// contains filtered or unexported methods
}

TypeExpr is an arbitrary type expression.

type TypeParser added in v0.2.0

type TypeParser struct {
	// contains filtered or unexported fields
}

TypeParser handles phpdoc type expressions parsing.

See https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md#abnf

func (*TypeParser) ParseType added in v0.2.0

func (p *TypeParser) ParseType(s string) (result TypeExpr, err error)

ParseType parses a phpdoc type out of a sting s.

type UnionType added in v0.2.0

type UnionType struct{ X, Y TypeExpr }

UnionType is `x|y` type. Union type requires a type to "implement" either X or Y.

func (*UnionType) String added in v0.2.0

func (typ *UnionType) String() string

Jump to

Keyboard shortcuts

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