Skip to content

Commit efa6823

Browse files
gen_stub: move generateClassEntryCode() into FileInfo
Reduce the number of global functions by moving it to instance method `FileInfo::generateClassEntryCode()`.
1 parent 2f8e7cc commit efa6823

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

build/gen_stub.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4522,6 +4522,17 @@ private static function handlePreprocessorConditions(array &$conds, Stmt $stmt):
45224522

45234523
return empty($conds) ? null : implode(' && ', $conds);
45244524
}
4525+
4526+
/** @param array<string, ConstInfo> $allConstInfos */
4527+
public function generateClassEntryCode(array $allConstInfos): string {
4528+
$code = "";
4529+
4530+
foreach ($this->classInfos as $class) {
4531+
$code .= "\n" . $class->getRegistration($allConstInfos);
4532+
}
4533+
4534+
return $code;
4535+
}
45254536
}
45264537

45274538
class DocCommentTag {
@@ -5236,18 +5247,7 @@ static function (FuncInfo $funcInfo) use ($fileInfo, &$generatedFunctionDeclarat
52365247
$code .= "}\n";
52375248
}
52385249

5239-
$code .= generateClassEntryCode($fileInfo, $allConstInfos);
5240-
}
5241-
5242-
return $code;
5243-
}
5244-
5245-
/** @param array<string, ConstInfo> $allConstInfos */
5246-
function generateClassEntryCode(FileInfo $fileInfo, array $allConstInfos): string {
5247-
$code = "";
5248-
5249-
foreach ($fileInfo->classInfos as $class) {
5250-
$code .= "\n" . $class->getRegistration($allConstInfos);
5250+
$code .= $fileInfo->generateClassEntryCode($allConstInfos);
52515251
}
52525252

52535253
return $code;

0 commit comments

Comments
 (0)