Index

CallGraphAnalyzer

MMO\doc · 1 symbol · generated 30 Sep 2026

class

CallGraphAnalyzer

CallGraphAnalyzer.php:14

Best-effort static call-graph scanner.

class MMO\doc\CallGraphAnalyzer
Namespace
MMO\doc
For a known set of reflections (functions/methods/classes), tokenizes each function or method body (via `token_get_all()`) and looks for calls to *other symbols in that same set*. This is a documentation aid, not a full static analyzer: calls that can't be resolved without type inference (calls through a variable other than `$this`, calls built from a dynamic string, interface calls resolved to a concrete implementation, etc.) are silently skipped rather than guessed at.

Constants1

NAME_TOKENS

protected const NAME_TOKENS = [262, 265, 263, 264]

Properties2

importCache

protected array $importCache = []
Type
array

tokenCache

protected array $tokenCache = []
Type
array

Methods14

candidateNames($raw, $currentNs, $useMap, $isFunction)

CallGraphAnalyzer.php:147
protected function candidateNames(string $raw, string $currentNs, array $useMap, bool $isFunction): array
$rawstring
$currentNsstring
$useMaparray
$isFunctionbool
returnsarrayfully-qualified names to try, in priority order (best-effort PHP name-resolution rules)

indexSymbols($reflections)

CallGraphAnalyzer.php:50
protected function indexSymbols(array $reflections): array
$reflectionsarray
returnsarrayarray<string,string>, classes: array<string,true>} lowercased-FQN lookup sets

parseImports($tokens)

CallGraphAnalyzer.php:224

Parse every use ...; import in a file (plain, aliased, and grouped use A\{B, C as D} forms, including use function/use const). Only class and function imports are kept (constants aren't callable).

protected function parseImports(array $tokens): array
$tokensarray
returnsarrayarray<string,string>, functions: array<string,string>} lowercased-alias => FQN

parseUseList($tokens, $i, $prefix, $kind, $classes, $functions)

CallGraphAnalyzer.php:246

Parses a comma-separated use name list (recursing once for a prefix\{...} group). @return int index just past the list

protected function parseUseList( array $tokens, int $i, string $prefix, string $kind, array &$classes, array &$functions ): int
$tokensarray
$iint
$prefixstring
$kindstring
$classesarray
$functionsarray
returnsint

resolveMethod($classFqn, $method, $known)

CallGraphAnalyzer.php:181

Resolve $classFqn::$method/$classFqn->$method to its actual declaring symbol, if that declaring class is itself indexed.

protected function resolveMethod(?string $classFqn, string $method, array $known): ?string
$classFqnnull | string
$methodstring
$knownarray
returnsnull | string

scan($reflections)

CallGraphAnalyzer.php:26
function scan(array $reflections): array
$reflectionsarraya list of \ReflectionFunction|\ReflectionMethod(via classes)|\ReflectionClass
returnsarraymap of FQN symbol name (Ns\func or Ns\Class::method) => list of FQN callees