Skip to content

Commit b7300b4

Browse files
committed
gen_stub: support use statements in stub files
Stmt\Use_ and Stmt\GroupUse nodes were not handled in handleStatements(), causing an "Unexpected node" exception when use statements appeared in stub files. Since NameResolver resolves all names to their fully qualified form before handleStatements() runs, these nodes can simply be skipped.
1 parent af28c15 commit b7300b4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

build/gen_stub.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4387,6 +4387,11 @@ private function handleStatements(array $stmts, PrettyPrinterAbstract $prettyPri
43874387
}
43884388
}
43894389

4390+
if ($stmt instanceof Stmt\Use_ || $stmt instanceof Stmt\GroupUse) {
4391+
// use statements are resolved by NameResolver before this point
4392+
continue;
4393+
}
4394+
43904395
throw new Exception("Unexpected node {$stmt->getType()}");
43914396
}
43924397
if (!empty($conds)) {

0 commit comments

Comments
 (0)