This is an automated email from the ASF dual-hosted git repository. junichi11 pushed a commit to branch php-nb21-features in repository https://gitbox.apache.org/repos/asf/netbeans.git
commit ec679fe153f0826730f85a0fc94b9b58641db384 Author: Junichi Yamamoto <[email protected]> AuthorDate: Sun Oct 15 14:36:50 2023 +0900 PHP 8.2 Support: Disjunctive Normal Form Types (Part 7) - https://github.com/apache/netbeans/issues/4725 - https://wiki.php.net/rfc/dnf_types - Fix documentation of code completion for parameter DNF types - Add unit tests - Increment the spec version to 2.27.0 --- .../modules/php/editor/completion/DocRenderer.java | 120 ++++++++------------- .../editor/parser/astnodes/PHPDocMethodTag.java | 20 ++++ .../php/editor/parser/astnodes/PHPDocTypeTag.java | 34 +++--- .../completion/documentation/arrayReturnType.php | 14 ++- ...turnType.php.testArrayReturnTypeWithTab_01.html | 9 ++ ...turnType.php.testArrayReturnTypeWithTab_02.html | 9 ++ ....testFunctionIntersectionTypeWithoutPhpDoc.html | 2 +- ...tPhpDoc.php.testFunctionTypedWithoutPhpDoc.html | 2 +- ...Doc.php.testFunctionUnionTypeWithoutPhpDoc.html | 2 +- ...hp.testMethodIntersectionTypeWithoutPhpDoc.html | 2 +- ...oc.php.testMethodNullableTypeWithoutPhpDoc.html | 2 +- ...hpDoc.php.testMethodUnionTypeWithoutPhpDoc.html | 2 +- .../completion/documentation/php82/dnfTypes.php | 101 +++++++++++++++++ .../php82/dnfTypes.php.testDNFTypesField.html | 9 ++ .../dnfTypes.php.testDNFTypesInheritdocMethod.html | 15 +++ .../php82/dnfTypes.php.testDNFTypesMethod.html | 14 +++ .../php82/dnfTypes.php.testDNFTypesMethodTag.html | 14 +++ .../dnfTypes.php.testDNFTypesPhpdocField.html | 9 ++ .../dnfTypes.php.testDNFTypesPhpdocMethod.html | 16 +++ ...dnfTypes.php.testDNFTypesPhpdocStaticField.html | 9 ++ ...nfTypes.php.testDNFTypesPhpdocStaticMethod.html | 16 +++ .../dnfTypes.php.testDNFTypesPropertyTag.html | 6 ++ .../dnfTypes.php.testDNFTypesStaticField.html | 9 ++ .../dnfTypes.php.testDNFTypesStaticMethod.html | 14 +++ .../dnfTypes.php.testDNFTypesStaticMethodTag.html | 14 +++ .../editor/completion/PHPCCDocumentationTest.java | 56 ++++++++++ 26 files changed, 419 insertions(+), 101 deletions(-) diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/completion/DocRenderer.java b/php/php.editor/src/org/netbeans/modules/php/editor/completion/DocRenderer.java index c16340c68a..5bfc5d23da 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/completion/DocRenderer.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/completion/DocRenderer.java @@ -91,7 +91,6 @@ import org.netbeans.modules.php.editor.parser.astnodes.PHPDocBlock; import org.netbeans.modules.php.editor.parser.astnodes.PHPDocMethodTag; import org.netbeans.modules.php.editor.parser.astnodes.PHPDocNode; import org.netbeans.modules.php.editor.parser.astnodes.PHPDocTag; -import org.netbeans.modules.php.editor.parser.astnodes.PHPDocTypeNode; import org.netbeans.modules.php.editor.parser.astnodes.PHPDocTypeTag; import org.netbeans.modules.php.editor.parser.astnodes.PHPDocVarTypeTag; import org.netbeans.modules.php.editor.parser.astnodes.Program; @@ -366,7 +365,12 @@ final class DocRenderer { } else { if (node instanceof PHPDocVarTypeTag) { PHPDocVarTypeTag varTypeTag = (PHPDocVarTypeTag) node; - String type = composeType(varTypeTag.getTypes(), getTypeKind(varTypeTag)); + // e.g. @property (A&B)|C $property something + String[] values = CodeUtils.WHITE_SPACES_PATTERN.split(varTypeTag.getValue().trim(), 2); + String type = ""; // NOI18N + if (!values[0].startsWith("$")) { // NOI18N + type = putTypeSeparatorBetweenWhitespaces(values[0]); + } phpDoc.append(processPhpDoc(String.format("%s<br /><table><tr><th align=\"left\">Type:</th><td>%s</td></tr></table>", // NOI18N varTypeTag.getDocumentation(), type))); @@ -388,14 +392,12 @@ final class DocRenderer { description = processPhpDoc(description); } - if (methodTag.getParameters() != null && methodTag.getParameters().size() > 0) { + if (methodTag.getParameters() != null && !methodTag.getParameters().isEmpty()) { for (PHPDocVarTypeTag tag : methodTag.getParameters()) { params.append(composeParameterLine(tag)); } } - - returnValue.append(composeTypesAndDescription(methodTag.getTypes(), null, methodTag)); - + returnValue.append(composeTypesAndDescription(putTypeSeparatorBetweenWhitespaces(methodTag.getReturnType()), null)); phpDoc.append(composeFunctionDoc(description, params.toString(), returnValue.toString(), null)); } @@ -422,7 +424,7 @@ final class DocRenderer { returns.add(returnTag); } else if (kind.equals(PHPDocTag.Type.VAR)) { PHPDocTypeTag typeTag = (PHPDocTypeTag) tag; - others.append(composeTypesAndDescription(typeTag.getTypes(), typeTag.getDocumentation(), typeTag)); + others.append(composeTypesAndDescription(getType(typeTag), typeTag.getDocumentation())); } else if (kind.equals(PHPDocTag.Type.DEPRECATED)) { String oline = String.format("<tr><th align=\"left\">%s</th><td>%s</td></tr>%n", //NOI18N processPhpDoc(tag.getKind().getName()), processPhpDoc(tag.getDocumentation(), "")); //NOI18N @@ -443,8 +445,8 @@ final class DocRenderer { if ((phpDocBlock == null || !tagInTagsList(tags, PHPDocTag.Type.VAR)) && indexedElement instanceof FieldElement) { FieldElement fieldElement = (FieldElement) indexedElement; - Set<TypeResolver> types = fieldElement.getInstanceTypes(); - others.append(composeTypesAndDescription(composeType(types, getTypeKind(fieldElement)), "")); // NOI18N + String declaredType = putTypeSeparatorBetweenWhitespaces(fieldElement.getDeclaredType()); + others.append(composeTypesAndDescription(declaredType, "")); // NOI18N } phpDoc.append(composeFunctionDoc(processDescription( @@ -454,6 +456,12 @@ final class DocRenderer { others.toString())); } + private String getType(PHPDocTypeTag typeTag) { + // e.g. @var (A&B)|C description + String[] split = CodeUtils.WHITE_SPACES_PATTERN.split(typeTag.getValue().trim(), 2); + return putTypeSeparatorBetweenWhitespaces(split[0]); + } + private boolean tagInTagsList(List<PHPDocTag> tags, AnnotationParsedLine tagKind) { boolean hasVarTag = false; @@ -535,13 +543,14 @@ final class DocRenderer { } private String composeParameterLine(PHPDocVarTypeTag param, String documentation) { - return composeParameterLine(composeType(param.getTypes(), getTypeKind(param)), param.getVariable().getValue(), documentation); + return composeParameterLine(composeParamType(param), param.getVariable().getValue(), documentation); } - private String composeParameterLine(String type, String variableValue, String documentation) { + private String composeParameterLine(@NullAllowed String type, String variableValue, String documentation) { + String typeString = type == null ? "" : putTypeSeparatorBetweenWhitespaces(type); // NOI18N String pline = String.format("<tr><td> </td><td valign=\"top\" %s><nobr>%s</nobr></td><td valign=\"top\" %s><nobr><b>%s</b></nobr></td><td valign=\"top\" %s>%s</td></tr>%n", //NOI18N TD_STYLE, - type, + typeString, TD_STYLE, variableValue, TD_STYLE_MAX_WIDTH, @@ -549,10 +558,6 @@ final class DocRenderer { return pline; } - private String composeTypesAndDescription(List<PHPDocTypeNode> types, String description, PHPDocTypeTag tag) { - return composeTypesAndDescription(composeType(types, getTypeKind(tag)), description); - } - @NbBundle.Messages({ "Type=Type", "Description=Description" @@ -571,31 +576,6 @@ final class DocRenderer { return returnValue.toString(); } - /** - * Create a string from the list of types. - * - * @param types types - * @param typeKind type kind - * @return types separated with "|" or "&" - */ - private String composeType(List<PHPDocTypeNode> types, Type.Kind typeKind) { - StringBuilder type = new StringBuilder(); - if (types != null) { - for (PHPDocTypeNode typeNode : types) { - if (type.length() > 0 - && (typeKind == Type.Kind.UNION - || typeKind == Type.Kind.INTERSECTION)) { - type.append(" ").append(typeKind.getSign()).append(" "); //NOI18N - } - type.append(typeNode.getValue()); - if (typeNode.isArray()) { - type.append("[]"); //NOI18N - } - } - } - return type.toString(); - } - /** * Create types separated with "|" or "&". * @@ -634,6 +614,15 @@ final class DocRenderer { return sb.toString(); } + private String composeParamType(PHPDocVarTypeTag param) { + // (X&Y)|Z $param + String[] split = CodeUtils.WHITE_SPACES_PATTERN.split(param.getValue().trim(), 2); + if (!split[0].startsWith("$")) { // NOI18N + return split[0]; + } + return ""; // NOI18N + } + // because of unit tests static String processPhpDoc(String phpDoc) { return processPhpDoc(phpDoc, Bundle.PHPDocNotFound()); @@ -725,8 +714,7 @@ final class DocRenderer { params.append(paramLine); } else { // use actual parameter types - Set<TypeResolver> types = parameter.getTypes(); - String paramLine = composeParameterLine(composeType(types, getTypeKind(parameter)), name, ""); // NOI18N + String paramLine = composeParameterLine(parameter.getDeclaredType(), name, ""); // NOI18N params.append(paramLine); } } @@ -789,7 +777,7 @@ final class DocRenderer { } } for (PHPDocTypeTag fallback : fallbacks) { - returnValue.append(composeTypesAndDescription(fallback.getTypes(), fallback.getDocumentation(), fallback)); + returnValue.append(composeTypesAndDescription(getType(fallback), fallback.getDocumentation())); } if (fallbacks.isEmpty()) { @@ -797,7 +785,13 @@ final class DocRenderer { if (indexedElement instanceof BaseFunctionElement) { BaseFunctionElement functionElement = (BaseFunctionElement) indexedElement; // currently, fully qualified type names are shown - returnValue.append(composeTypesAndDescription(composeType(functionElement.getReturnTypes(), getTypeKind(functionElement)), "")); // NOI18N + String returnType = putTypeSeparatorBetweenWhitespaces(functionElement.getDeclaredReturnType()); + if (StringUtils.hasText(returnType)) { + returnValue.append(composeTypesAndDescription(returnType, "")); // NOI18N + } else { + // GH-5355 + returnValue.append(composeTypesAndDescription(composeType(functionElement.getReturnTypes(), getTypeKind(functionElement)), "")); // NOI18N + } } } return returnValue.toString(); @@ -813,35 +807,6 @@ final class DocRenderer { return kind; } - private Type.Kind getTypeKind(ParameterElement element) { - Type.Kind kind = Type.Kind.NORMAL; - if (element.isIntersectionType()) { - kind = Type.Kind.INTERSECTION; - } else if (element.isUnionType()) { - kind = Type.Kind.UNION; - } - return kind; - } - - private Type.Kind getTypeKind(FieldElement element) { - Type.Kind kind = Type.Kind.NORMAL; - if (element.isIntersectionType()) { - kind = Type.Kind.INTERSECTION; - } else if (element.isUnionType()) { - kind = Type.Kind.UNION; - } - return kind; - } - - private Type.Kind getTypeKind(PHPDocTypeTag tag) { - String value = tag.getValue().trim(); - String[] values = value.split(" "); // NOI18N - if (values.length > 0) { - return Type.Kind.fromTypes(values[0]); - } - return Type.Kind.NORMAL; - } - private List<PhpElement> getInheritedElements() { if (!needInheritedElements()) { return Collections.emptyList(); @@ -1126,6 +1091,13 @@ final class DocRenderer { } return null; } + + private static String putTypeSeparatorBetweenWhitespaces(@NullAllowed String type) { + if (type == null) { + return null; + } + return type.replace("&", " & ").replace("|", " | "); // NOI18N + } } private static final class ASTNodeFinder extends UserTask { diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/PHPDocMethodTag.java b/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/PHPDocMethodTag.java index f1e0f4706a..6a5ada21ba 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/PHPDocMethodTag.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/PHPDocMethodTag.java @@ -19,6 +19,7 @@ package org.netbeans.modules.php.editor.parser.astnodes; import java.util.List; +import org.netbeans.modules.php.editor.CodeUtils; import org.netbeans.modules.php.spi.annotation.AnnotationParsedLine; /** @@ -30,6 +31,7 @@ public class PHPDocMethodTag extends PHPDocTypeTag { private final List<PHPDocVarTypeTag> params; private final PHPDocNode name; private final boolean isStatic; + private final String returnType; public PHPDocMethodTag(int start, int end, AnnotationParsedLine kind, List<PHPDocTypeNode> returnTypes, PHPDocNode methodName, @@ -57,6 +59,20 @@ public class PHPDocMethodTag extends PHPDocTypeTag { this.params = parameters; this.name = methodName; this.isStatic = isStatic; + this.returnType = getReturnType(documentation); + } + + private String getReturnType(String documentation) { + String type = documentation.trim(); + String[] split = CodeUtils.WHITE_SPACES_PATTERN.split(type, 2); + if (split[0].equals(org.netbeans.modules.php.editor.model.impl.Type.STATIC)) { + type = split[1]; + } + if (type.startsWith(name.getValue() + "(")) { // NOI18N + return ""; // NOI18N + } + split = CodeUtils.WHITE_SPACES_PATTERN.split(type, 2); + return split[0]; } /** @@ -96,6 +112,10 @@ public class PHPDocMethodTag extends PHPDocTypeTag { visitor.visit(this); } + public String getReturnType() { + return returnType; + } + private static class CommentExtractorImpl implements CommentExtractor { private final String methodName; diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/PHPDocTypeTag.java b/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/PHPDocTypeTag.java index ab96d4f9c4..0887e8073d 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/PHPDocTypeTag.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/PHPDocTypeTag.java @@ -20,6 +20,7 @@ package org.netbeans.modules.php.editor.parser.astnodes; import java.util.List; +import org.netbeans.modules.php.editor.CodeUtils; import org.netbeans.modules.php.spi.annotation.AnnotationParsedLine; /** @@ -49,33 +50,26 @@ public class PHPDocTypeTag extends PHPDocTag { @Override public String getDocumentation() { - if (documentation == null && types.size() > 0) { + if (documentation == null && !types.isEmpty()) { PHPDocTypeNode lastType = types.get(0); - boolean isLastNodeArray = lastType.isArray(); for (PHPDocTypeNode node : types) { if (lastType.getEndOffset() < node.getEndOffset()) { lastType = node; - isLastNodeArray = node.isArray(); } } - int indexAfterTypeWithoutArrayPostfix = getValue().indexOf(lastType.getValue()) + lastType.getValue().length(); - if (isLastNodeArray) { - String documentationWithArrayPrefix = getValue().substring(indexAfterTypeWithoutArrayPostfix).trim(); - int firstSpace = documentationWithArrayPrefix.indexOf(" "); //NOI18N - int firstTab = documentationWithArrayPrefix.indexOf("\t"); //NOI18N - int min = -1; - if (firstSpace > 0 && (firstSpace < firstTab || firstTab == -1)) { - min = firstSpace; - } else if (firstTab > 0 && (firstTab < firstSpace || firstSpace == -1)) { - min = firstTab; - } - if (min == -1) { - documentation = ""; //NOI18N - } else { - documentation = getValue().substring(indexAfterTypeWithoutArrayPostfix + min).trim(); - } + // e.g. (A&B&C)|(A&B) description + // arr[] description + // The last type is `B`. If we get the position using String.indexOf(), we get the wrong position + String[] split = CodeUtils.WHITE_SPACES_PATTERN.split(getValue().trim(), 2); + String value = lastType.getValue(); + if (split[0]. contains(value)) { + value = split[0]; + } + int indexAfterType = getValue().indexOf(value) + value.length(); + if (indexAfterType < 0) { + documentation = ""; // NOI18N } else { - documentation = getValue().substring(indexAfterTypeWithoutArrayPostfix).trim(); + documentation = getValue().substring(indexAfterType).trim(); } } return documentation; diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/arrayReturnType.php b/php/php.editor/test/unit/data/testfiles/completion/documentation/arrayReturnType.php index 2c2fa219d4..9400b7e03f 100644 --- a/php/php.editor/test/unit/data/testfiles/completion/documentation/arrayReturnType.php +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/arrayReturnType.php @@ -11,4 +11,16 @@ function functionName() { functionName(); -?> \ No newline at end of file +/** + * @return arr[] test description + */ +function withTabSpace01() {} + +withTabSpace01(); + +/** + * @return arr[] test description + */ +function withTabSpace02() {} + +withTabSpace02(); diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/arrayReturnType.php.testArrayReturnTypeWithTab_01.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/arrayReturnType.php.testArrayReturnTypeWithTab_01.html new file mode 100644 index 0000000000..aa189acc77 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/arrayReturnType.php.testArrayReturnTypeWithTab_01.html @@ -0,0 +1,9 @@ +<html><body> +<pre>Code completion result for source line: +withTabSpace01|(); +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +METHOD withTabSpace01() [PUBLIC] arrayReturnType.php +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>withTabSpace01</b><br/><br/><br /> +<h3>Returns:</h3> +<table> +<tr><th align="left">Type:</th><td>arr[]</td></tr><tr><th align="left" valign="top">Description:</th><td>test description</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/arrayReturnType.php.testArrayReturnTypeWithTab_02.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/arrayReturnType.php.testArrayReturnTypeWithTab_02.html new file mode 100644 index 0000000000..d3775de29e --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/arrayReturnType.php.testArrayReturnTypeWithTab_02.html @@ -0,0 +1,9 @@ +<html><body> +<pre>Code completion result for source line: +withTabSpace02|(); +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +METHOD withTabSpace02() [PUBLIC] arrayReturnType.php +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>withTabSpace02</b><br/><br/><br /> +<h3>Returns:</h3> +<table> +<tr><th align="left">Type:</th><td>arr[]</td></tr><tr><th align="left" valign="top">Description:</th><td>test description</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testFunctionIntersectionTypeWithoutPhpDoc.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testFunctionIntersectionTypeWithoutPhpDoc.html index b3896bfa13..014e77cec6 100644 --- a/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testFunctionIntersectionTypeWithoutPhpDoc.html +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testFunctionIntersectionTypeWithoutPhpDoc.html @@ -11,4 +11,4 @@ METHOD testIntersectionType(Foo&Bar $ [PUBLIC] functionWithoutPhpDoc.php </table> <h3>Returns:</h3> <table> -<tr><th align="left">Type:</th><td>\Foo & \Test\Bar</td></tr></table></body></html> \ No newline at end of file +<tr><th align="left">Type:</th><td>Foo & \Test\Bar</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testFunctionTypedWithoutPhpDoc.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testFunctionTypedWithoutPhpDoc.html index 48965c62e1..107c725ed7 100644 --- a/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testFunctionTypedWithoutPhpDoc.html +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testFunctionTypedWithoutPhpDoc.html @@ -12,4 +12,4 @@ METHOD testTyped(int $param1, Baz $pa [PUBLIC] functionWithoutPhpDoc.php </table> <h3>Returns:</h3> <table> -<tr><th align="left">Type:</th><td>\Foo</td></tr></table></body></html> +<tr><th align="left">Type:</th><td>Foo</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testFunctionUnionTypeWithoutPhpDoc.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testFunctionUnionTypeWithoutPhpDoc.html index 22d2ba6473..28f9971e70 100644 --- a/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testFunctionUnionTypeWithoutPhpDoc.html +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testFunctionUnionTypeWithoutPhpDoc.html @@ -12,4 +12,4 @@ METHOD testUnionType(int|float $param [PUBLIC] functionWithoutPhpDoc.php </table> <h3>Returns:</h3> <table> -<tr><th align="left">Type:</th><td>int | \Foo | \Test\Bar</td></tr></table></body></html> \ No newline at end of file +<tr><th align="left">Type:</th><td>int | Foo | \Test\Bar</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testMethodIntersectionTypeWithoutPhpDoc.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testMethodIntersectionTypeWithoutPhpDoc.html index 6f5615c513..342a0ff298 100644 --- a/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testMethodIntersectionTypeWithoutPhpDoc.html +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testMethodIntersectionTypeWithoutPhpDoc.html @@ -11,4 +11,4 @@ METHOD testIntersectionType(Foo&Bar $ [PUBLIC] TestClass </table> <h3>Returns:</h3> <table> -<tr><th align="left">Type:</th><td>\Foo & \Test\Bar</td></tr></table></body></html> \ No newline at end of file +<tr><th align="left">Type:</th><td>Foo & \Test\Bar</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testMethodNullableTypeWithoutPhpDoc.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testMethodNullableTypeWithoutPhpDoc.html index 174f85e6fa..497c54ec21 100644 --- a/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testMethodNullableTypeWithoutPhpDoc.html +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testMethodNullableTypeWithoutPhpDoc.html @@ -12,4 +12,4 @@ METHOD testNullableType(?int $param1, [STATIC] TestClass </table> <h3>Returns:</h3> <table> -<tr><th align="left">Type:</th><td>?\Foo</td></tr></table></body></html> +<tr><th align="left">Type:</th><td>?Foo</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testMethodUnionTypeWithoutPhpDoc.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testMethodUnionTypeWithoutPhpDoc.html index 5b3a96ef6e..b5e83e0eeb 100644 --- a/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testMethodUnionTypeWithoutPhpDoc.html +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/functionWithoutPhpDoc.php.testMethodUnionTypeWithoutPhpDoc.html @@ -12,4 +12,4 @@ METHOD testUnionType(int|float $param [PUBLIC] TestClass </table> <h3>Returns:</h3> <table> -<tr><th align="left">Type:</th><td>int | \Foo | \Test\Bar</td></tr></table></body></html> \ No newline at end of file +<tr><th align="left">Type:</th><td>int | Foo | \Test\Bar</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php new file mode 100644 index 0000000000..71cea0a155 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php @@ -0,0 +1,101 @@ +<?php +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +abstract class ParentClass { + /** + * inheritdocMethod description. + * + * @param (A&B|C) $param Description + * @return null|(B&C) Description + */ + public abstract function inheritdocMethod((A&B)|C $param): null|(B&C); + +} + +/** + * Description of CCDoc + * + * @method (A&B)|C methodTag(A|(B&C&D)|C $param1, (A&B)|null $param2) test description + * @method static (A&B)|C staticMethodTag(A|(B&C&D)|C $param1, (A&B)|null $param2) static test description + * @property (A&B)|(A&C) $property Description + */ +class DNFTypes extends ParentClass { + + private (A&B)|C $privateField; + /** + * @var (A&B&C)|(A&B)|(A&C) + */ + private $phpdocField; + private static null|(A&B) $privateStaticField; + /** + * @var null|(A&B) test description + */ + private static $phpdocStaticField; + + public function methodTest((A&B)|null $param1, null|(B&C) $param2 = null): (A&B&C)|A { + } + + /** + * Description. + * + * @param (A&B)|null $param1 + * @param null|(B&C) $param2 + * @return (A&B&C)|A + */ + public function phpdocMethodTest($param1, $param2 = null) { + } + + /** + * @param (A&B)|null $param1 description + */ + public static function staticMethodTest((A&B)|null $param1, null|(B&C) $param2 = null): (A&\B&C)|A { + } + + /** + * PhpDoc static method. + * + * @param (A&B)|null $param1 param1 description + * @param null|(B&C) $param2 param2 description + * @return (A&\B&C)|A + */ + public static function phpdocStaticMethodTest($param1, $param2 = null) { + } + + /** + * {@inheritDoc} + */ + public function inheritdocMethod((A&B)|C $param): null|(B&C) { + } + + public function test(): U&V { + $this->property; + $this->methodTag($param1, $param2); + self::staticMethodTag($param1, $param2); + $this->methodTest(null); + $this->phpdocMethodTest(null); + $this->inheritdocMethod(null); + self::staticMethodTest(null); + self::phpdocStaticMethodTest(null); + $this->privateField; + $this->phpdocField; + static::$privateStaticField; + static::$phpdocStaticField; + } +} diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesField.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesField.html new file mode 100644 index 0000000000..caf24ec348 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesField.html @@ -0,0 +1,9 @@ +<html><body> +<pre>Code completion result for source line: +$this->privateFiel|d; +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +VARIABLE (A&B)|C privateField [PRIVATE] DNFTypes +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>$privateField</b><br/><br/><br /> +<table> +<tr><th align="left">Type:</th><td>(A & B) | C</td></tr></table> +</body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesInheritdocMethod.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesInheritdocMethod.html new file mode 100644 index 0000000000..6b887a7526 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesInheritdocMethod.html @@ -0,0 +1,15 @@ +<html><body> +<pre>Code completion result for source line: +$this->inheritdocMetho|d(null); +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +METHOD inheritdocMethod((A&B)|C $para [PUBLIC] DNFTypes +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>inheritdocMethod</b><br/><br/> +inheritdocMethod description. +<br /> +<h3>Parameters:</h3> +<table cellspacing=0 style="border: 0px; width: 100%;"> +<tr><td> </td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr>(A & B | C)</nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr><b>$param</b></nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;width:80%;" >Description</td></tr> +</table> +<h3>Returns:</h3> +<table> +<tr><th align="left">Type:</th><td>null | (B & C)</td></tr><tr><th align="left" valign="top">Description:</th><td>Description</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesMethod.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesMethod.html new file mode 100644 index 0000000000..6e675a4a74 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesMethod.html @@ -0,0 +1,14 @@ +<html><body> +<pre>Code completion result for source line: +$this->methodTe|st(null); +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +METHOD methodTest((A&B)|null $param1) [PUBLIC] DNFTypes +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>methodTest</b><br/><br/><br /> +<h3>Parameters:</h3> +<table cellspacing=0 style="border: 0px; width: 100%;"> +<tr><td> </td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr>(A & B) | null</nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr><b>$param1</b></nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;width:80%;" >PHPDoc not found</td></tr> +<tr><td> </td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr>null | (B & C)</nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr><b>$param2</b></nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;width:80%;" >PHPDoc not found</td></tr> +</table> +<h3>Returns:</h3> +<table> +<tr><th align="left">Type:</th><td>(A & B & C) | A</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesMethodTag.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesMethodTag.html new file mode 100644 index 0000000000..7cac9f32a2 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesMethodTag.html @@ -0,0 +1,14 @@ +<html><body> +<pre>Code completion result for source line: +$this->methodT|ag($param1, $param2); +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +METHOD methodTag(A|(B&C&D)|C $param1, [PUBLIC] DNFTypes +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>methodTag</b><br/><br/>test description<br /> +<h3>Parameters:</h3> +<table cellspacing=0 style="border: 0px; width: 100%;"> +<tr><td> </td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr>A | (B & C & D) | C</nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr><b>$param1</b></nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;width:80%;" >PHPDoc not found</td></tr> +<tr><td> </td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr>(A & B) | null</nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr><b>$param2</b></nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;width:80%;" >PHPDoc not found</td></tr> +</table> +<h3>Returns:</h3> +<table> +<tr><th align="left">Type:</th><td>(A & B) | C</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPhpdocField.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPhpdocField.html new file mode 100644 index 0000000000..1aace4ac80 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPhpdocField.html @@ -0,0 +1,9 @@ +<html><body> +<pre>Code completion result for source line: +$this->phpdocFie|ld; +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +VARIABLE (A&B&C)|(A&B)|(A&C) phpdocFiel [PRIVATE] DNFTypes +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>$phpdocField</b><br/><br/><br /> +<table> +<tr><th align="left">Type:</th><td>(A & B & C) | (A & B) | (A & C)</td></tr></table> +</body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPhpdocMethod.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPhpdocMethod.html new file mode 100644 index 0000000000..46059b892e --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPhpdocMethod.html @@ -0,0 +1,16 @@ +<html><body> +<pre>Code completion result for source line: +$this->phpdocMethodTe|st(null); +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +METHOD phpdocMethodTest($param1) [PUBLIC] DNFTypes +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>phpdocMethodTest</b><br/><br/> +Description. +<br /> +<h3>Parameters:</h3> +<table cellspacing=0 style="border: 0px; width: 100%;"> +<tr><td> </td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr>(A & B) | null</nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr><b>$param1</b></nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;width:80%;" >PHPDoc not found</td></tr> +<tr><td> </td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr>null | (B & C)</nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr><b>$param2</b></nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;width:80%;" >PHPDoc not found</td></tr> +</table> +<h3>Returns:</h3> +<table> +<tr><th align="left">Type:</th><td>(A & B & C) | A</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPhpdocStaticField.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPhpdocStaticField.html new file mode 100644 index 0000000000..45780d5038 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPhpdocStaticField.html @@ -0,0 +1,9 @@ +<html><body> +<pre>Code completion result for source line: +static::$phpdocStaticFiel|d; +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +VARIABLE null|(A&B) $phpdocStaticField [PRIVATE, DNFTypes +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>$phpdocStaticField</b><br/><br/><br /> +<table> +<tr><th align="left">Type:</th><td>null | (A & B)</td></tr><tr><th align="left" valign="top">Description:</th><td>test description</td></tr></table> +</body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPhpdocStaticMethod.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPhpdocStaticMethod.html new file mode 100644 index 0000000000..efb74f74e8 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPhpdocStaticMethod.html @@ -0,0 +1,16 @@ +<html><body> +<pre>Code completion result for source line: +self::phpdocStaticMethodTe|st(null); +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +METHOD phpdocStaticMethodTest($param1 [STATIC] DNFTypes +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>phpdocStaticMethodTest</b><br/><br/> +PhpDoc static method. +<br /> +<h3>Parameters:</h3> +<table cellspacing=0 style="border: 0px; width: 100%;"> +<tr><td> </td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr>(A & B) | null</nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr><b>$param1</b></nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;width:80%;" >param1 description</td></tr> +<tr><td> </td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr>null | (B & C)</nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr><b>$param2</b></nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;width:80%;" >param2 description</td></tr> +</table> +<h3>Returns:</h3> +<table> +<tr><th align="left">Type:</th><td>(A & \B & C) | A</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPropertyTag.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPropertyTag.html new file mode 100644 index 0000000000..b4f7530a27 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesPropertyTag.html @@ -0,0 +1,6 @@ +<html><body> +<pre>Code completion result for source line: +$this->prop|erty; +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +VARIABLE (A&B)|(A&C) property [PUBLIC] DNFTypes +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>$property</b><br/><br/>Description<br /><table><tr><th align="left">Type:</th><td>(A & B) | (A & C)</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesStaticField.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesStaticField.html new file mode 100644 index 0000000000..fa52155710 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesStaticField.html @@ -0,0 +1,9 @@ +<html><body> +<pre>Code completion result for source line: +static::$privateStaticFi|eld; +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +VARIABLE null|(A&B) $privateStaticField [PRIVATE, DNFTypes +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>$privateStaticField</b><br/><br/><br /> +<table> +<tr><th align="left">Type:</th><td>null | (A & B)</td></tr></table> +</body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesStaticMethod.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesStaticMethod.html new file mode 100644 index 0000000000..cd7b4b0beb --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesStaticMethod.html @@ -0,0 +1,14 @@ +<html><body> +<pre>Code completion result for source line: +self::staticMethodTes|t(null); +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +METHOD staticMethodTest((A&B)|null $p [STATIC] DNFTypes +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>staticMethodTest</b><br/><br/><br /> +<h3>Parameters:</h3> +<table cellspacing=0 style="border: 0px; width: 100%;"> +<tr><td> </td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr>(A & B) | null</nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr><b>$param1</b></nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;width:80%;" >description</td></tr> +<tr><td> </td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr>null | (B & C)</nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr><b>$param2</b></nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;width:80%;" >PHPDoc not found</td></tr> +</table> +<h3>Returns:</h3> +<table> +<tr><th align="left">Type:</th><td>(A & \B & C) | A</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesStaticMethodTag.html b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesStaticMethodTag.html new file mode 100644 index 0000000000..2ffac045b4 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/documentation/php82/dnfTypes.php.testDNFTypesStaticMethodTag.html @@ -0,0 +1,14 @@ +<html><body> +<pre>Code completion result for source line: +self::staticMethodTa|g($param1, $param2); +(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true) +METHOD staticMethodTag(A|(B&C&D)|C $p [STATIC] DNFTypes +</pre><h2>Documentation:</h2><div align="right"><font size=-1></font></div><b>staticMethodTag</b><br/><br/>static test description<br /> +<h3>Parameters:</h3> +<table cellspacing=0 style="border: 0px; width: 100%;"> +<tr><td> </td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr>A | (B & C & D) | C</nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr><b>$param1</b></nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;width:80%;" >PHPDoc not found</td></tr> +<tr><td> </td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr>(A & B) | null</nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;" ><nobr><b>$param2</b></nobr></td><td valign="top" style="text-aling:left; border-width: 0px;padding: 1px;padding:3px;width:80%;" >PHPDoc not found</td></tr> +</table> +<h3>Returns:</h3> +<table> +<tr><th align="left">Type:</th><td>(A & B) | C</td></tr></table></body></html> diff --git a/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCCDocumentationTest.java b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCCDocumentationTest.java index d31390e0d6..90d6a38718 100644 --- a/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCCDocumentationTest.java +++ b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCCDocumentationTest.java @@ -48,6 +48,14 @@ public class PHPCCDocumentationTest extends PHPCodeCompletionTestBase { checkCompletionDocumentation("testfiles/completion/documentation/arrayReturnType.php", "functionNam^e();", false, ""); } + public void testArrayReturnTypeWithTab_01() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/arrayReturnType.php", "withTabSpace01^();", false, ""); + } + + public void testArrayReturnTypeWithTab_02() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/arrayReturnType.php", "withTabSpace02^();", false, ""); + } + public void testFieldWithDesc() throws Exception { checkCompletionDocumentation("testfiles/completion/documentation/fieldVar.php", "$c->fieldWithDes^c;", false, ""); } @@ -546,6 +554,54 @@ public class PHPCCDocumentationTest extends PHPCodeCompletionTestBase { checkCompletionDocumentation("testfiles/completion/documentation/deprecatedTypedFields/deprecatedTypedFields.php", "self::$intersectionTypeStat^icField; // trait", false, ""); } + public void testDNFTypesPropertyTag() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/php82/dnfTypes.php", "$this->prop^erty;", false, ""); + } + + public void testDNFTypesMethodTag() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/php82/dnfTypes.php", "$this->methodT^ag($param1, $param2);", false, ""); + } + + public void testDNFTypesStaticMethodTag() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/php82/dnfTypes.php", "self::staticMethodTa^g($param1, $param2);", false, ""); + } + + public void testDNFTypesMethod() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/php82/dnfTypes.php", "$this->methodTe^st(null);", false, ""); + } + + public void testDNFTypesPhpdocMethod() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/php82/dnfTypes.php", "$this->phpdocMethodTe^st(null);", false, ""); + } + + public void testDNFTypesInheritdocMethod() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/php82/dnfTypes.php", "$this->inheritdocMetho^d(null);", false, ""); + } + + public void testDNFTypesStaticMethod() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/php82/dnfTypes.php", "self::staticMethodTes^t(null);", false, ""); + } + + public void testDNFTypesPhpdocStaticMethod() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/php82/dnfTypes.php", "self::phpdocStaticMethodTe^st(null);", false, ""); + } + + public void testDNFTypesField() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/php82/dnfTypes.php", "$this->privateFiel^d;", false, ""); + } + + public void testDNFTypesPhpdocField() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/php82/dnfTypes.php", "$this->phpdocFie^ld;", false, ""); + } + + public void testDNFTypesStaticField() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/php82/dnfTypes.php", "static::$privateStaticFi^eld;", false, ""); + } + + public void testDNFTypesPhpdocStaticField() throws Exception { + checkCompletionDocumentation("testfiles/completion/documentation/php82/dnfTypes.php", "static::$phpdocStaticFiel^d;", false, ""); + } + @Override protected String alterDocumentationForTest(String documentation) { int start = documentation.indexOf("file:"); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
