Documentation ¶
Index ¶
- Variables
- func NewDoxed(node ast.Vertex) *doxed
- func NodeComments(node ast.Vertex) []string
- func TypeHintToDocType(node ast.Vertex) (phpdoxer.Type, error)
- type ClassConst
- func (m ClassConst) CanBeAccessedFrom(p phprivacy.Privacy) bool
- func (m ClassConst) HasExplicitPrivacy() bool
- func (m ClassConst) IsFinal() bool
- func (m ClassConst) IsStatic() bool
- func (p *ClassConst) Name() string
- func (p *ClassConst) Node() *ast.StmtClassConstList
- func (m ClassConst) Privacy() phprivacy.Privacy
- type ClassLike
- func NewClassLike(root rooter, node ast.Vertex) *ClassLike
- func NewClassLikeFromFQN(r rooter, qualified *fqn.FQN) (*ClassLike, error)
- func NewClassLikeFromMethod(root *ast.Root, method *ast.StmtClassMethod) (*ClassLike, error)
- func NewClassLikeFromName(nameRoot *ast.Root, n ast.Vertex) (*ClassLike, error)
- func NewClassLikeFromProperty(root *ast.Root, property *ast.StmtPropertyList) (*ClassLike, error)
- func (m ClassLike) CanBeAccessedFrom(p phprivacy.Privacy) bool
- func (c *ClassLike) ConstantsIter() ConstantsIterFunc
- func (d ClassLike) Docs() []phpdoxer.Node
- func (i ClassLike) Extends() ast.Vertex
- func (d ClassLike) FindAllDocs(filters ...DocFilter) (results []phpdoxer.Node)
- func (c *ClassLike) FindConstant(filters ...FilterFunc[*ClassConst]) *ClassConst
- func (d ClassLike) FindDoc(filters ...DocFilter) phpdoxer.Node
- func (c *ClassLike) FindMember(filters ...FilterFunc[Member]) Member
- func (c *ClassLike) FindMemberInherit(filters ...FilterFunc[Member]) Member
- func (c *ClassLike) FindMembers(shortCircuit bool, filters ...FilterFunc[Member]) (res []Member)
- func (c *ClassLike) FindMembersInherit(shortCircuit bool, filters ...FilterFunc[Member]) (res []Member)
- func (c *ClassLike) FindMethod(filters ...FilterFunc[*Method]) *Method
- func (c *ClassLike) FindMethods(shortCircuit bool, filters ...FilterFunc[*Method]) (res []*Method)
- func (c *ClassLike) FindProperties(shortCircuit bool, filters ...FilterFunc[*Property]) (res []*Property)
- func (c *ClassLike) FindProperty(filters ...FilterFunc[*Property]) *Property
- func (d ClassLike) FindThrows() []*phpdoxer.NodeThrows
- func (m ClassLike) HasExplicitPrivacy() bool
- func (i ClassLike) Implements() []ast.Vertex
- func (c *ClassLike) InheritsIter() InheritsIterFunc
- func (m ClassLike) IsFinal() bool
- func (m ClassLike) IsStatic() bool
- func (c *ClassLike) Kind() ast.Type
- func (c *ClassLike) MethodsIter() MethodsIterFunc
- func (c *ClassLike) Name() string
- func (m ClassLike) Privacy() phprivacy.Privacy
- func (c *ClassLike) PropertiesIter() PropertiesIterFunc
- func (d ClassLike) RawDocs() string
- func (i ClassLike) Uses() []ast.Vertex
- type ConstantsIterFunc
- type DocFilter
- type FilterFunc
- func FilterCanBeAccessedFrom[T Modified](privacy phprivacy.Privacy) FilterFunc[T]
- func FilterName[T Named](name string) FilterFunc[T]
- func FilterNotPrivacy[T Modified](privacy phprivacy.Privacy) FilterFunc[T]
- func FilterNotStatic[T Modified]() FilterFunc[T]
- func FilterOverwrittenBy[T NamedModified](m T, addDollar ...bool) FilterFunc[T]
- func FilterPrefix[T Named](prefix string) FilterFunc[T]
- func FilterPrivacy[T Modified](privacy phprivacy.Privacy) FilterFunc[T]
- func FilterStatic[T Modified]() FilterFunc[T]
- type Function
- func (d Function) Docs() []phpdoxer.Node
- func (d Function) FindAllDocs(filters ...DocFilter) (results []phpdoxer.Node)
- func (d Function) FindDoc(filters ...DocFilter) phpdoxer.Node
- func (p Function) FindParameter(filters ...FilterFunc[*Parameter]) (*Parameter, error)
- func (d Function) FindThrows() []*phpdoxer.NodeThrows
- func (m *Function) Name() string
- func (m *Function) Node() *ast.StmtFunction
- func (p Function) Parameters() ([]*Parameter, error)
- func (d Function) RawDocs() string
- func (r Function) Returns() (phpdoxer.Type, *ClassLike, error)
- func (r Function) ReturnsClass() ([]*phpdoxer.TypeClassLike, error)
- type InheritsIterFunc
- type Member
- type Method
- func (m Method) CanBeAccessedFrom(p phprivacy.Privacy) bool
- func (d Method) Docs() []phpdoxer.Node
- func (d Method) FindAllDocs(filters ...DocFilter) (results []phpdoxer.Node)
- func (d Method) FindDoc(filters ...DocFilter) phpdoxer.Node
- func (p Method) FindParameter(filters ...FilterFunc[*Parameter]) (*Parameter, error)
- func (d Method) FindThrows() []*phpdoxer.NodeThrows
- func (m Method) HasExplicitPrivacy() bool
- func (m Method) IsFinal() bool
- func (m Method) IsStatic() bool
- func (m *Method) Name() string
- func (m *Method) Node() *ast.StmtClassMethod
- func (p Method) Parameters() ([]*Parameter, error)
- func (m Method) Privacy() phprivacy.Privacy
- func (d Method) RawDocs() string
- func (r Method) Returns() (phpdoxer.Type, *ClassLike, error)
- func (r Method) ReturnsClass() ([]*phpdoxer.TypeClassLike, error)
- func (m *Method) Vertex() ast.Vertex
- type MethodsIterFunc
- type Modified
- type Named
- type NamedModified
- type Parameter
- type PropertiesIterFunc
- type Property
- func (m Property) CanBeAccessedFrom(p phprivacy.Privacy) bool
- func (p *Property) ClsType() ([]*phpdoxer.TypeClassLike, error)
- func (d Property) Docs() []phpdoxer.Node
- func (d Property) FindAllDocs(filters ...DocFilter) (results []phpdoxer.Node)
- func (d Property) FindDoc(filters ...DocFilter) phpdoxer.Node
- func (d Property) FindThrows() []*phpdoxer.NodeThrows
- func (m Property) HasExplicitPrivacy() bool
- func (m Property) IsFinal() bool
- func (m Property) IsStatic() bool
- func (p *Property) Name() string
- func (p *Property) Node() ast.Vertex
- func (m Property) Privacy() phprivacy.Privacy
- func (d Property) RawDocs() string
- func (p *Property) Type() (phpdoxer.Type, *ClassLike, error)
- func (p *Property) Vertex() ast.Vertex
- type Variable
- func (d Variable) Docs() []phpdoxer.Node
- func (d Variable) FindAllDocs(filters ...DocFilter) (results []phpdoxer.Node)
- func (d Variable) FindDoc(filters ...DocFilter) phpdoxer.Node
- func (d Variable) FindThrows() []*phpdoxer.NodeThrows
- func (v *Variable) Name() string
- func (d Variable) RawDocs() string
- func (v *Variable) Type() (phpdoxer.Type, error)
- func (v *Variable) TypeCls(currFqn *fqn.FQN) ([]*phpdoxer.TypeClassLike, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoParam = errors.New("parameter has no type") ErrNotAMethod = errors.New("does not live on a method") )
var ErrNoPropertyType = errors.New("property has no type declaration")
var ErrNoReturn = errors.New("node has no return type")
var ErrNoVarType = errors.New("variable has no @var node")
Functions ¶
func NodeComments ¶
Types ¶
type ClassConst ¶
type ClassConst struct {
// contains filtered or unexported fields
}
func NewClassConst ¶
func NewClassConst(node *ast.StmtClassConstList) *ClassConst
func (ClassConst) CanBeAccessedFrom ¶
func (ClassConst) HasExplicitPrivacy ¶
func (m ClassConst) HasExplicitPrivacy() bool
func (*ClassConst) Name ¶
func (p *ClassConst) Name() string
func (*ClassConst) Node ¶
func (p *ClassConst) Node() *ast.StmtClassConstList
type ClassLike ¶
type ClassLike struct {
// contains filtered or unexported fields
}
func NewClassLike ¶
func NewClassLikeFromFQN ¶
func NewClassLikeFromMethod ¶
func NewClassLikeFromName ¶
func (ClassLike) CanBeAccessedFrom ¶
func (*ClassLike) ConstantsIter ¶
func (c *ClassLike) ConstantsIter() ConstantsIterFunc
func (ClassLike) FindAllDocs ¶
func (*ClassLike) FindConstant ¶
func (c *ClassLike) FindConstant(filters ...FilterFunc[*ClassConst]) *ClassConst
func (*ClassLike) FindMember ¶
func (c *ClassLike) FindMember(filters ...FilterFunc[Member]) Member
func (*ClassLike) FindMemberInherit ¶
func (c *ClassLike) FindMemberInherit(filters ...FilterFunc[Member]) Member
func (*ClassLike) FindMembers ¶
func (c *ClassLike) FindMembers(shortCircuit bool, filters ...FilterFunc[Member]) (res []Member)
TODO: also constants.
func (*ClassLike) FindMembersInherit ¶
func (c *ClassLike) FindMembersInherit( shortCircuit bool, filters ...FilterFunc[Member], ) (res []Member)
func (*ClassLike) FindMethod ¶
func (c *ClassLike) FindMethod(filters ...FilterFunc[*Method]) *Method
func (*ClassLike) FindMethods ¶
func (c *ClassLike) FindMethods(shortCircuit bool, filters ...FilterFunc[*Method]) (res []*Method)
func (*ClassLike) FindProperties ¶
func (c *ClassLike) FindProperties( shortCircuit bool, filters ...FilterFunc[*Property], ) (res []*Property)
func (*ClassLike) FindProperty ¶
func (c *ClassLike) FindProperty(filters ...FilterFunc[*Property]) *Property
func (ClassLike) FindThrows ¶
func (d ClassLike) FindThrows() []*phpdoxer.NodeThrows
func (ClassLike) HasExplicitPrivacy ¶
func (m ClassLike) HasExplicitPrivacy() bool
func (ClassLike) Implements ¶
func (*ClassLike) InheritsIter ¶
func (c *ClassLike) InheritsIter() InheritsIterFunc
InheritsIter returns a generator function that generates the classes/interfaces/traits that this class/interface/trait inherits from.
The classes are generated in the same order that PHP evaluates them, so, if you have a method in the first generated class, it is overwriting any other generated classes that define that method.
This order is:
- Current class/trait/interface
- Any used traits
- If the class extends another 3a. Extended class 3b. Extended class's traits 3c. If the class extends another -> back to 3, otherwise 4.
- Any interface implementations
The generator returns true for done when there are no classes left in the chain. If there was an error generating the next class, the newClsLikeErr argument will be set.
func (*ClassLike) MethodsIter ¶
func (c *ClassLike) MethodsIter() MethodsIterFunc
func (*ClassLike) PropertiesIter ¶
func (c *ClassLike) PropertiesIter() PropertiesIterFunc
type ConstantsIterFunc ¶
type ConstantsIterFunc func() (method *ClassConst, done bool, genErr error)
type FilterFunc ¶
func FilterCanBeAccessedFrom ¶
func FilterCanBeAccessedFrom[T Modified](privacy phprivacy.Privacy) FilterFunc[T]
func FilterName ¶
func FilterName[T Named](name string) FilterFunc[T]
func FilterNotPrivacy ¶
func FilterNotPrivacy[T Modified](privacy phprivacy.Privacy) FilterFunc[T]
func FilterNotStatic ¶
func FilterNotStatic[T Modified]() FilterFunc[T]
func FilterOverwrittenBy ¶
func FilterOverwrittenBy[T NamedModified](m T, addDollar ...bool) FilterFunc[T]
func FilterPrefix ¶
func FilterPrefix[T Named](prefix string) FilterFunc[T]
func FilterPrivacy ¶
func FilterPrivacy[T Modified](privacy phprivacy.Privacy) FilterFunc[T]
func FilterStatic ¶
func FilterStatic[T Modified]() FilterFunc[T]
type Function ¶
type Function struct {
// contains filtered or unexported fields
}
func NewFunction ¶
func NewFunction(root rooter, node *ast.StmtFunction) *Function
func NewFunctionFromFQN ¶
func (Function) FindAllDocs ¶
func (Function) FindParameter ¶
func (p Function) FindParameter(filters ...FilterFunc[*Parameter]) (*Parameter, error)
func (Function) FindThrows ¶
func (d Function) FindThrows() []*phpdoxer.NodeThrows
func (*Function) Node ¶
func (m *Function) Node() *ast.StmtFunction
func (Function) Parameters ¶
func (Function) Returns ¶
Returns gets the return type of this callable. Traversing through inherited methods with {@inheritdoc}.
If the node is a method, the 2nd argument is the enclosing class of the method that had the type definition on it.
func (Function) ReturnsClass ¶
func (r Function) ReturnsClass() ([]*phpdoxer.TypeClassLike, error)
ReturnsClass resolves and unpacks the raw type returned from Returns into the classes it represents. See doxcontext.ApplyContext for more.
type InheritsIterFunc ¶
type Member ¶
type Member interface { NamedModified Vertex() ast.Vertex // contains filtered or unexported methods }
type Method ¶
type Method struct {
// contains filtered or unexported fields
}
func NewMethod ¶
func NewMethod(root rooter, node *ast.StmtClassMethod) *Method
func (Method) CanBeAccessedFrom ¶
func (Method) FindAllDocs ¶
func (Method) FindParameter ¶
func (p Method) FindParameter(filters ...FilterFunc[*Parameter]) (*Parameter, error)
func (Method) FindThrows ¶
func (d Method) FindThrows() []*phpdoxer.NodeThrows
func (Method) HasExplicitPrivacy ¶
func (m Method) HasExplicitPrivacy() bool
func (*Method) Node ¶
func (m *Method) Node() *ast.StmtClassMethod
func (Method) Parameters ¶
func (Method) Returns ¶
Returns gets the return type of this callable. Traversing through inherited methods with {@inheritdoc}.
If the node is a method, the 2nd argument is the enclosing class of the method that had the type definition on it.
func (Method) ReturnsClass ¶
func (r Method) ReturnsClass() ([]*phpdoxer.TypeClassLike, error)
ReturnsClass resolves and unpacks the raw type returned from Returns into the classes it represents. See doxcontext.ApplyContext for more.
type MethodsIterFunc ¶
type NamedModified ¶
type Parameter ¶
type Parameter struct {
// contains filtered or unexported fields
}
func NewParameter ¶
func (*Parameter) Type ¶
Type will get the parameter's type, if Parameter.funcOrMeth is a *Method, it also checks any inherited methods for a type definition.
If the funcOrMeth is a method, the containing class of method that had a type definition is returned as the 2nd return. This is nil when the funcOrMeth is a function.
type PropertiesIterFunc ¶
type Property ¶
type Property struct {
// contains filtered or unexported fields
}
func NewProperty ¶
node should either be a *ast.Parameter or *ast.StmtPropertyList. *ast.Parameter is a constructor promoted property.
func (Property) CanBeAccessedFrom ¶
func (Property) FindAllDocs ¶
func (Property) FindThrows ¶
func (d Property) FindThrows() []*phpdoxer.NodeThrows
func (Property) HasExplicitPrivacy ¶
func (m Property) HasExplicitPrivacy() bool
type Variable ¶
type Variable struct {
// contains filtered or unexported fields
}
func NewVariable ¶
func NewVariable(root rooter, node *ast.ExprVariable) *Variable
func (Variable) FindAllDocs ¶
func (Variable) FindThrows ¶
func (d Variable) FindThrows() []*phpdoxer.NodeThrows