Skip to content

Commit 3177180

Browse files
DanielEScherzerkocsismate
authored andcommitted
gen_stub: simplify getFileDocComments() with array_filter
1 parent 6d2c1ed commit 3177180

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

build/gen_stub.php

+4-10
Original file line numberDiff line numberDiff line change
@@ -4770,16 +4770,10 @@ function getFileDocComments(array $stmts): array {
47704770
return [];
47714771
}
47724772

4773-
$comments = $stmts[0]->getComments();
4774-
4775-
$result = [];
4776-
foreach ($comments as $comment) {
4777-
if ($comment instanceof DocComment) {
4778-
$result[] = $comment;
4779-
}
4780-
}
4781-
4782-
return $result;
4773+
return array_filter(
4774+
$stmts[0]->getComments(),
4775+
static fn ( $comment ): bool => $comment instanceof DocComment
4776+
);
47834777
}
47844778

47854779
function handleStatements(FileInfo $fileInfo, array $stmts, PrettyPrinterAbstract $prettyPrinter) {

0 commit comments

Comments
 (0)