Expand description
AST-level class-structure queries: parent class, members (methods, properties, constants, mixins), enclosing class at a cursor position, enum backing type, and function/method parameter lists. These answer structural facts directly from the parsed source and don’t depend on mir.
Structs§
- Class
Members - All members of a named class split by kind and static-ness.
Functions§
- collect_
all_ class_ ranges - Return the LSP range of every class/interface/trait/enum declaration in the file (recursing into braced-namespace bodies). Used by linked-editing to drop highlights that fall inside an other class than the cursor’s.
- enclosing_
class_ at - Return the name of the class whose body contains
position, orNone. - enclosing_
class_ fqn_ at - Like
enclosing_class_atbut returns the fully-qualified name ("Ns\\ClassName") when the class lives inside a namespace. Used by the__constructcall-site path so thatconstruct_referencescan apply namespace-level filtering and avoid matching a same-short-named class in a different namespace. - enclosing_
class_ range_ at - Return the LSP range of the class/interface/trait/enum declaration
whose body contains
position, orNoneif the cursor is outside any. Used by linked-editing to scope same-name member rewrites to the enclosing class instead of every class in the file. - enum_
backing_ type - Returns the declared backing type (
"string"/"int") ofclass_nameif it is a backed enum indoc, orNoneif it is not an enum, or is an unbacked (pure) enum. - is_
backed_ enum - Returns
trueifclass_nameis a backed enum (enum Foo: string/enum Foo: int) indoc. Backed enums have a->valueproperty. - is_enum
- Returns
trueifclass_nameis declared as anenumindoc. - members_
of_ class - Return all members (methods, properties, constants) of
class_name. Also returns the direct parent class name viaClassMembers::parent. - mixin_
classes_ of - Return the
@mixinclass names declared inclass_name’s docblock. - params_
of_ function - Return the parameter names of the function or method named
func_name. - params_
of_ method - Return the parameter names of
method_nameon classclass_name. Primarily used to offer named-argument completions for attribute constructors. - parent_
class_ name