in gen_stub.php [1260:1328]
function handleStatements(FileInfo $fileInfo, array $stmts, PrettyPrinterAbstract $prettyPrinter) {
$conds = [];
foreach ($stmts as $stmt) {
if ($stmt instanceof Stmt\Nop) {
continue;
}
if ($stmt instanceof Stmt\Namespace_) {
handleStatements($fileInfo, $stmt->stmts, $prettyPrinter);
continue;
}
$cond = handlePreprocessorConditions($conds, $stmt);
if ($stmt instanceof Stmt\Function_) {
$fileInfo->funcInfos[] = parseFunctionLike(
$prettyPrinter,
new FunctionName($stmt->namespacedName),
0,
0,
$stmt,
$cond
);
continue;
}
if ($stmt instanceof Stmt\ClassLike) {
$className = $stmt->namespacedName;
$methodInfos = [];
foreach ($stmt->stmts as $classStmt) {
$cond = handlePreprocessorConditions($conds, $classStmt);
if ($classStmt instanceof Stmt\Nop) {
continue;
}
if (!$classStmt instanceof Stmt\ClassMethod) {
throw new Exception("Not implemented {$classStmt->getType()}");
}
$classFlags = 0;
if ($stmt instanceof Class_) {
$classFlags = $stmt->flags;
}
$flags = $classStmt->flags;
if ($stmt instanceof Stmt\Interface_) {
$flags |= Class_::MODIFIER_ABSTRACT;
}
if (!($flags & Class_::VISIBILITY_MODIFIER_MASK)) {
throw new Exception("Method visibility modifier is required");
}
$methodInfos[] = parseFunctionLike(
$prettyPrinter,
new MethodName($className, $classStmt->name->toString()),
$classFlags,
$flags,
$classStmt,
$cond
);
}
$fileInfo->classInfos[] = new ClassInfo($className, $methodInfos);
continue;
}
throw new Exception("Unexpected node {$stmt->getType()}");
}
}