Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private static String formatName(final MethodElement method, PhpVersion phpVersi
final String nameAndParams = method.asString(PrintAs.NameAndParamsDeclaration, TypeNameResolverImpl.forNull(), phpVersion);
final String returnTypeString = method.asString(PrintAs.ReturnTypes, TypeNameResolverImpl.forNull(), phpVersion);
final String[] split = nameAndParams.split("\\(");
if (returnTypes.isEmpty() || returnTypeString.isEmpty()) {
if (returnTypes.isEmpty() || returnTypeString.isEmpty() || method.isConstructor()) {
return String.format("<html><b>%s</b>(%s</html>", split[0], split[1]); // NOI18N
}
return String.format("<html><b>%s</b>(%s : %s</html>", split[0], split[1], returnTypeString); // NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public final String asString(PrintAs as, BaseFunctionElement element, TypeNameRe
Collection<TypeResolver> returns1 = getReturnTypes();
// we can also write the union type in phpdoc e.g. @return int|float
// check whether the union type is the actual declared return type to avoid adding the union type for phpdoc
if (returns1.size() == 1 || isReturnUnionType() || isReturnIntersectionType()) {
// I also prevent the return type from being generated in the PHPDoc when it is a constructor.
if (!element.getName().equals(MethodElement.CONSTRUCTOR_NAME) && (returns1.size() == 1 || isReturnUnionType() || isReturnIntersectionType())) {
String returnType = asString(PrintAs.ReturnTypes, element, typeNameResolver, phpVersion);
if (StringUtils.hasText(returnType)) {
boolean isNullableType = CodeUtils.isNullableType(returnType);
Expand Down