@@ -4498,21 +4498,22 @@ function handlePreprocessorConditions(array &$conds, Stmt $stmt): ?string {
4498
4498
return empty($conds) ? null : implode(' && ', $conds);
4499
4499
}
4500
4500
4501
- function getFileDocComment(array $stmts): ?DocComment {
4501
+ /** @return DocComment[] */
4502
+ function getFileDocComments(array $stmts): array {
4502
4503
if (empty($stmts)) {
4503
- return null ;
4504
+ return [] ;
4504
4505
}
4505
4506
4506
4507
$comments = $stmts[0]->getComments();
4507
- if (empty($comments)) {
4508
- return null;
4509
- }
4510
4508
4511
- if ($comments[0] instanceof DocComment) {
4512
- return $comments[0];
4509
+ $result = [];
4510
+ foreach ($comments as $comment) {
4511
+ if ($comment instanceof DocComment) {
4512
+ $result[] = $comment;
4513
+ }
4513
4514
}
4514
4515
4515
- return null ;
4516
+ return $result ;
4516
4517
}
4517
4518
4518
4519
function handleStatements(FileInfo $fileInfo, array $stmts, PrettyPrinterAbstract $prettyPrinter) {
@@ -4665,9 +4666,9 @@ protected function pName_FullyQualified(Name\FullyQualified $node): string {
4665
4666
$nodeTraverser->traverse($stmts);
4666
4667
4667
4668
$fileInfo = new FileInfo;
4668
- $fileDocComment = getFileDocComment ($stmts);
4669
- if ($fileDocComment ) {
4670
- $fileTags = parseDocComment($fileDocComment );
4669
+ $fileDocComments = getFileDocComments ($stmts);
4670
+ if ($fileDocComments !== [] ) {
4671
+ $fileTags = parseDocComments($fileDocComments );
4671
4672
foreach ($fileTags as $tag) {
4672
4673
if ($tag->name === 'generate-function-entries') {
4673
4674
$fileInfo->generateFunctionEntries = true;
0 commit comments