Skip to main content

Module walk

Module walk 

Source

Functionsยง

class_refs_in_stmts
Collect spans where class_name is used as a class-type reference: new ClassName, extends ClassName, implements ClassName, type hints, and $x instanceof ClassName. Does NOT match free function calls or method names with the same spelling.
collect_var_refs_in_scope
Collect all $var_name spans within the innermost function/method scope that contains byte_off. If byte_off is not inside any function, collects from the top-level stmts (respecting scope boundaries). Also collects the parameter declaration span when the variable is a parameter of the scope.
function_refs_in_stmts
Collect spans where name is called as a free function (not a method). Only matches name(...) calls where the callee is a bare identifier, not $obj->name() or Class::name().
method_refs_in_stmts
Collect spans where name is used as a method: ->name(), ?->name(), ::name(). Does NOT match free function calls or class-name identifiers.
property_refs_in_stmts
Collect all spans where prop_name is accessed (->prop, ?->prop) or declared as a class/trait property, across all statements. Because PropertyAccess.property is a &'src str sub-slice of source, we use str_offset (pointer arithmetic) to obtain its byte offset.
refs_in_expr
refs_in_stmts
refs_in_stmts_with_use
Like refs_in_stmts, but also matches spans inside use statements. Needed so that renaming a class also renames its use import.
var_refs_in_stmts
Collect all spans where $var_name (the variable name WITHOUT $) appears as an ExprKind::Variable within stmts. Stops at nested function/closure/arrow-function scope boundaries so that $x in an inner function is not conflated with $x in the outer function.