Collect every class-typed name reference (extends, implements, new,
instanceof, type hints, static method/property/const access, catch types).
Each entry is the source-spelling of the reference (Foo, Sub\Foo, or
\Foo) — callers apply namespace/use resolution to obtain an FQN.
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 every fully-qualified class name (i.e. starting with \) that
appears as the class argument of a new expression in stmts.
Returns de-duplicated FQCN strings with the leading \ stripped, ready to
pass to session.lazy_load_class.
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 spans where const_name is used as a global/namespace-level constant.
Matches bare identifiers (MAX_SIZE) and, when const_fqn is supplied,
also qualified names (\Config\DB_HOST, Config\DB_HOST). Emits the span
of just the constant name portion (not any namespace qualifier prefix).
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.