From a2d4285d34f595e0c9b254c641dfca187fd00fce Mon Sep 17 00:00:00 2001 From: Alexey Borokhvostov Date: Sun, 16 Mar 2025 13:16:05 +0700 Subject: [PATCH] PHP: If a function or method does not have a return operator, the @return void tag is generated when generating a phpDoc. --- .../typinghooks/PhpCommentGenerator.java | 2 + .../issue193118_01.php.indented | 3 +- .../issue193118_02.php.indented | 3 +- .../issue197924_01.php.indented | 3 +- .../issue197924_02.php.indented | 3 +- .../typinghooks/PhpCommentGeneratorTest.java | 39 ++++++++++++------- 6 files changed, 36 insertions(+), 17 deletions(-) diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/typinghooks/PhpCommentGenerator.java b/php/php.editor/src/org/netbeans/modules/php/editor/typinghooks/PhpCommentGenerator.java index f23dcae025c8..0104ae0385be 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/typinghooks/PhpCommentGenerator.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/typinghooks/PhpCommentGenerator.java @@ -114,6 +114,8 @@ private static void generateFunctionDoc(BaseDocument doc, int offset, int indent if (i.hasReturn) { generateDocEntry(doc, toAdd, "@return", indent, null, i.getReturnType()); // NOI18N + } else { + generateDocEntry(doc, toAdd, "@return", indent, null, Type.VOID); // NOI18N } addVariables(doc, toAdd, "@throws", indent, i.throwsExceptions); diff --git a/php/php.editor/test/unit/data/testfiles/bracketCompleter/issue193118_01.php.indented b/php/php.editor/test/unit/data/testfiles/bracketCompleter/issue193118_01.php.indented index daed0c06326e..12113c242790 100644 --- a/php/php.editor/test/unit/data/testfiles/bracketCompleter/issue193118_01.php.indented +++ b/php/php.editor/test/unit/data/testfiles/bracketCompleter/issue193118_01.php.indented @@ -1,7 +1,8 @@ ", "