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 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.
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().
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.
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.