Skip to content

Commit 2d185e4

Browse files
DanielEScherzerkocsismate
authored andcommitted
gen_stub: merge parseDocComment() into parseDocComments()
Reduce the number of global functions merging `parseDocComment()` into its only caller
1 parent d154603 commit 2d185e4

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

build/gen_stub.php

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4253,22 +4253,15 @@ public static function extractExposedComment(array $comments): ?ExposedDocCommen
42534253
function parseDocComments(array $comments): array {
42544254
$tags = [];
42554255
foreach ($comments as $comment) {
4256-
if ($comment instanceof DocComment) {
4257-
$tags = array_merge($tags, parseDocComment($comment));
4256+
if (!($comment instanceof DocComment)) {
4257+
continue;
42584258
}
4259-
}
4260-
4261-
return $tags;
4262-
}
4263-
4264-
/** @return DocCommentTag[] */
4265-
function parseDocComment(DocComment $comment): array {
4266-
$commentText = substr($comment->getText(), 2, -2);
4267-
$tags = [];
4268-
foreach (explode("\n", $commentText) as $commentLine) {
4269-
$regex = '/^\*\s*@([a-z-]+)(?:\s+(.+))?$/';
4270-
if (preg_match($regex, trim($commentLine), $matches)) {
4271-
$tags[] = new DocCommentTag($matches[1], $matches[2] ?? null);
4259+
$commentText = substr($comment->getText(), 2, -2);
4260+
foreach (explode("\n", $commentText) as $commentLine) {
4261+
$regex = '/^\*\s*@([a-z-]+)(?:\s+(.+))?$/';
4262+
if (preg_match($regex, trim($commentLine), $matches)) {
4263+
$tags[] = new DocCommentTag($matches[1], $matches[2] ?? null);
4264+
}
42724265
}
42734266
}
42744267

0 commit comments

Comments
 (0)