Skip to content

Commit a11fe43

Browse files
committed
無名のfunctionを分析できるようにする
1 parent 5fd3856 commit a11fe43

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Parse/VariableParser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ public function parse(string $content): ParseResult
3030
$functionLikes = $nodeFinder->findInstanceOf($stmts, FunctionLike::class);
3131

3232
$functions = array_map(function (FunctionLike $function) use ($nodeFinder) {
33-
$func = new Func($function->name->name);
33+
$functionIdentifier = $function->name->name ?? $function->getType() . '@' . $function->getStartLine();
34+
35+
$func = new Func($functionIdentifier);
3436
$variables = $nodeFinder->findInstanceOf($function, Variable::class);
3537
foreach ($variables as $variable) {
3638
$func->addVariable(new VarReference($variable->name, $variable->getLine()));

0 commit comments

Comments
 (0)