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 cefe6a1b819c9138f88dc6afe48aedd5d611d12e Author: Junichi Yamamoto <junich...@apache.org> AuthorDate: Thu Oct 12 15:09:29 2023 +0900 PHP 8.2 Support: Disjunctive Normal Form Types (Part 6) - https://github.com/apache/netbeans/issues/4725 - https://wiki.php.net/rfc/dnf_types - Fix code completion for parameter DNF types - Add unit tests --- .../org/netbeans/modules/php/editor/CodeUtils.java | 1 + .../php/editor/elements/ParameterElementImpl.java | 34 ++---- .../php/editor/elements/TypeResolverImpl.java | 4 +- .../modules/php/editor/model/impl/Type.java | 17 +++ .../php/editor/model/impl/VariousUtils.java | 7 +- .../completion/lib/php82/testDNFTypes/dnfTypes.php | 49 +++++++- ...pes.php.testDNFTypes_ParameterType01.completion | 9 ++ ...pes.php.testDNFTypes_ParameterType02.completion | 9 ++ ...pes.php.testDNFTypes_ParameterType03.completion | 13 +++ ...pes.php.testDNFTypes_ParameterType04.completion | 13 +++ ...pes.php.testDNFTypes_ParameterType05.completion | 12 ++ ...pes.php.testDNFTypes_ParameterType06.completion | 18 +++ ...pes.php.testDNFTypes_ParameterType07.completion | 9 ++ ...pes.php.testDNFTypes_ParameterType08.completion | 12 ++ ...pes.php.testDNFTypes_ParameterType09.completion | 12 ++ ...pes.php.testDNFTypes_ParameterType10.completion | 18 +++ ...pes.php.testDNFTypes_ParameterType11.completion | 12 ++ ...pes.php.testDNFTypes_ParameterType12.completion | 9 ++ ...pes.php.testDNFTypes_ParameterType13.completion | 18 +++ ...pes.php.testDNFTypes_ParameterType14.completion | 18 +++ ...pes.php.testDNFTypes_ParameterType15.completion | 18 +++ ...pes.php.testDNFTypes_ParameterType16.completion | 9 ++ ...pes.php.testDNFTypes_ParameterType17.completion | 13 +++ ...pes.php.testDNFTypes_ParameterType18.completion | 12 ++ ...pes.php.testDNFTypes_ParameterType19.completion | 18 +++ ...pes.php.testDNFTypes_ParameterType20.completion | 9 ++ ...pes.php.testDNFTypes_ParameterType21.completion | 13 +++ ...pes.php.testDNFTypes_ParameterType22.completion | 12 ++ ...es.php.testDNFTypes_ParameterType23a.completion | 18 +++ ...es.php.testDNFTypes_ParameterType23b.completion | 4 + ...pes.php.testDNFTypes_ParameterType24.completion | 12 ++ ...pes.php.testDNFTypes_ParameterType25.completion | 18 +++ ...pes.php.testDNFTypes_ParameterType26.completion | 9 ++ ...pes.php.testDNFTypes_ParameterType27.completion | 12 ++ ...pes.php.testDNFTypes_ParameterType28.completion | 9 ++ ...pes.php.testDNFTypes_ParameterType29.completion | 12 ++ ...testDNFTypes_ParameterTypeInCCList01.completion | 5 + .../testPHP82DNFParameterTypes.php.indexed | 14 +-- .../editor/completion/PHP82CodeCompletionTest.java | 124 +++++++++++++++++++++ .../modules/php/editor/model/impl/TypeTest.java | 100 +++++++++++++++++ 40 files changed, 696 insertions(+), 39 deletions(-) diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/CodeUtils.java b/php/php.editor/src/org/netbeans/modules/php/editor/CodeUtils.java index fb2c27caaa..49731d9552 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/CodeUtils.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/CodeUtils.java @@ -91,6 +91,7 @@ public final class CodeUtils { public static final Pattern WHITE_SPACES_PATTERN = Pattern.compile("\\s+"); // NOI18N public static final Pattern SPLIT_TYPES_PATTERN = Pattern.compile("[()|&]+"); // NOI18N + public static final Pattern TYPE_NAMES_IN_TYPE_DECLARATION_PATTERN = Pattern.compile("[^?()|&]+"); // NOI18N private static final Logger LOGGER = Logger.getLogger(CodeUtils.class.getName()); diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/elements/ParameterElementImpl.java b/php/php.editor/src/org/netbeans/modules/php/editor/elements/ParameterElementImpl.java index b8a69c0acf..69c27825f8 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/elements/ParameterElementImpl.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/elements/ParameterElementImpl.java @@ -26,7 +26,6 @@ import java.util.Set; import org.netbeans.api.annotations.common.CheckForNull; import org.netbeans.modules.csl.api.OffsetRange; import org.netbeans.modules.php.api.util.StringUtils; -import org.netbeans.modules.php.editor.CodeUtils; import org.netbeans.modules.php.editor.api.elements.ParameterElement; import org.netbeans.modules.php.editor.api.elements.TypeNameResolver; import org.netbeans.modules.php.editor.api.elements.TypeResolver; @@ -357,30 +356,17 @@ public final class ParameterElementImpl implements ParameterElement { } } if (forDeclaration && hasDeclaredType()) { - if (isUnionType || isIntersectionType) { - boolean firstType = true; - for (TypeResolver typeResolver : typesResolvers) { - if (typeResolver.isResolved()) { - if (firstType) { - firstType = false; - } else { - sb.append(Type.getTypeSeparator(isIntersectionType)); - } - sb.append(typeNameResolver.resolve(typeResolver.getTypeName(false))); - } - } - sb.append(' '); - } else if (typesResolvers.size() > 1 && !isUnionType && !isIntersectionType) { - sb.append(Type.MIXED).append(' '); - } else { - for (TypeResolver typeResolver : typesResolvers) { - if (typeResolver.isResolved()) { - if (typeResolver.isNullableType()) { - sb.append(CodeUtils.NULLABLE_TYPE_PREFIX); - } - sb.append(typeNameResolver.resolve(typeResolver.getTypeName(false))).append(' '); //NOI18N - break; + if (StringUtils.hasText(getDeclaredType())) { + String[] splitTypes = Type.splitTypes(getDeclaredType()); + List<String> resolvedTypes = new ArrayList<>(); + if (splitTypes.length == typesResolvers.size()) { + String template = Type.toTypeTemplate(getDeclaredType()); + for (TypeResolver typeResolver : typesResolvers) { + resolvedTypes.add(typeNameResolver.resolve(typeResolver.getTypeName(false)).toString()); } + sb.append(String.format(template, resolvedTypes.toArray(new String[0]))).append(' '); + } else { + sb.append(getDeclaredType()).append(' '); } } } diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/elements/TypeResolverImpl.java b/php/php.editor/src/org/netbeans/modules/php/editor/elements/TypeResolverImpl.java index a1cf9707e0..3bc4f3dd01 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/elements/TypeResolverImpl.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/elements/TypeResolverImpl.java @@ -29,6 +29,7 @@ import org.netbeans.modules.php.editor.CodeUtils; import org.netbeans.modules.php.editor.api.QualifiedName; import org.netbeans.modules.php.editor.api.elements.TypeResolver; import org.netbeans.modules.php.editor.elements.PhpElementImpl.Separator; +import org.netbeans.modules.php.editor.model.impl.Type; import org.netbeans.modules.php.editor.model.impl.VariousUtils; import org.openide.util.Pair; @@ -47,8 +48,7 @@ public final class TypeResolverImpl implements TypeResolver { // avoid being changed type order(e.g. int|float|Foo|Bar) when an override method is generated Set<TypeResolver> retval = new LinkedHashSet<>(); if (typeSignature != null && typeSignature.length() > 0) { - final String regexp = "[|&]"; // NOI18N - for (String type : typeSignature.split(regexp)) { + for (String type : Type.splitTypes(typeSignature)) { String typeName = type; boolean isNullableType = CodeUtils.isNullableType(typeName); if (isNullableType) { diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/Type.java b/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/Type.java index 3fb5f48e9c..d66822d84f 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/Type.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/Type.java @@ -257,4 +257,21 @@ public final class Type { } return CodeUtils.SPLIT_TYPES_PATTERN.split(type.replace(" ", "")); // NOI18N } + + /** + * Convert the type declaration to the type template. e.g. + * <pre> + * - Type1|Type2|Type3 -> %s|%s|%s + * - Type1&Type2&Type3 -> %s&%s&%s + * - (Type1&Type2)|Type3 -> (%s&%s)|%s + * - ?Type1 -> ?%s + * </pre> + * + * @param typeDeclaration the type declaration (e.g. + * {@code (X&Y)|Z, X|Y|Z, ?Nullable}) + * @return the type template (e.g. {@code (%s&%s)|%s, %s|%s|%s, ?%s}) + */ + public static String toTypeTemplate(String typeDeclaration) { + return CodeUtils.TYPE_NAMES_IN_TYPE_DECLARATION_PATTERN.matcher(typeDeclaration.replace(" ", "")).replaceAll("%s"); // NOI18N + } } diff --git a/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/VariousUtils.java b/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/VariousUtils.java index 3f48d78e32..fb44e62736 100644 --- a/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/VariousUtils.java +++ b/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/VariousUtils.java @@ -304,11 +304,8 @@ public final class VariousUtils { public static List<Pair<QualifiedName, Boolean/* isNullableType */>> getParamTypesFromUnionTypes(UnionType unionType) { List<Pair<QualifiedName, Boolean>> types = new ArrayList<>(); - for (Expression type : unionType.getTypes()) { - QualifiedName name = QualifiedName.create(type); - if (name != null) { - types.add(Pair.of(name, false)); - } + for (QualifiedName type : QualifiedName.create(unionType)) { + types.add(Pair.of(type, false)); } return types; } diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php index fb7feb5048..4332c5d79b 100644 --- a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php @@ -133,9 +133,44 @@ class TestClass implements TestInterface { private null|(ClassZ&ClassX) $privatePromotedFiled, protected ClassZ|(ClassZ&ClassY)|ClassX $protectedPromotedFiled, ) { + $publicPromotedFiled->publicYMethod(); // ClassZ|(ClassZ&ClassY) + $publicPromotedFiled->publicYMethod()->publicXMethod(); // ClassX|(ClassY&ClassX) + $publicPromotedFiled->publicYMethod()::$publicStaticXField; // ClassX|(ClassY&ClassX) + $publicPromotedFiled::publicStaticYMethod(); // ClassZ|(ClassZ&ClassY) + $publicPromotedFiled::$publicStaticYField->publicYField; // (ClassY&ClassZ)|ClassX + $publicPromotedFiled::$publicStaticYField::PUBLIC_Z_CONSTANT; // (ClassY&ClassZ)|ClassX + $privatePromotedFiled->publicXField; // null|(ClassZ&ClassX) + $privatePromotedFiled->publicXField->publicZMethod(); // (ClassY&ClassZ)|ClassX + $privatePromotedFiled->publicXField::$publicStaticYField; // (ClassY&ClassZ)|ClassX + $protectedPromotedFiled->publicXMethod(); // ClassZ|(ClassZ&ClassY)|ClassX + $protectedPromotedFiled::$publicStaticZField(); // ClassZ|(ClassZ&ClassY)|ClassX } - public function paramType(ClassX|(ClassY&ClassZ) $param1): void { + public function paramType(ClassX|(ClassY&ClassZ) $param1, (ClassY&ClassZ)|ClassZ $param2, (ClassX&ClassY)|null|(ClassX&ClassZ) $param3): void { + $param1->publicXMethod(); // ClassX|(ClassY&ClassZ) + $param1->publicYMethod()->publicZMethod(); // ClassX|(ClassY&ClassX) + $param1->publicXMethod()::PUBLIC_Y_CONSTANT; // ClassX|(ClassY&ClassZ) + $param1::publicStaticYMethod(); // ClassX|(ClassY&ClassZ) + $param1::publicStaticYMethod()::$publicStaticYField; // (ClassY&ClassZ)|ClassX + $param2->publicYField; // (ClassY&ClassZ)|ClassZ + $param2::IMPLICIT_Y_CONSTANT; // (ClassY&ClassZ)|ClassZ + $param3?->publicZField; // (ClassX&ClassY)|null|(ClassX&ClassZ) + $param3::$publicStaticZField; // (ClassX&ClassY)|null|(ClassX&ClassZ) + } + + public function param(X|(X&Y)|(Y&Z) $param): void {} + + /** + * PHPDoc test. + * + * @param null|ClassX|(ClassX&ClassZ) $phpdoc1 + * @param (ClassX&ClassY&ClassZ)|null|(ClassX&ClassZ) $phpdoc2 + */ + public function phpdocParamType($phpdoc1, $phpdoc2) { + $phpdoc1->publicXMethod(); // null|ClassX|(ClassX&ClassZ) + $phpdoc1::publicStaticZMethod(); // null|ClassX|(ClassX&ClassZ) + $phpdoc2->publicYField; // (ClassX&ClassY&ClassZ)|null|(ClassX&ClassZ) + $phpdoc2::PUBLIC_Y_CONSTANT; // (ClassX&ClassY&ClassZ)|null|(ClassX&ClassZ) } /** @@ -184,6 +219,8 @@ class TestClass implements TestInterface { self::$publicPhpdocStaticField::$publicStaticXField; // (ClassX&ClassY)|ClassZ self::$publicPhpdocStaticField->publicZField; // (ClassX&ClassY)|ClassZ self::$publicStaticTraitField->publicXMethod(); // ClassY|(ClassX&ClassY)|ClassX + // display in CC list + $this->param(null); } } @@ -213,3 +250,13 @@ $vardoc5::$publicStaticXField; // ClassZ|(ClassX&ClassY)|null /* @var $vardoc6 ClassZ|(ClassX&ClassY)|(ClassX&ClassY&ClassZ) */ $vardoc6->publicXField; // ClassZ|(ClassX&ClassY)|(ClassX&ClassY&ClassZ) $vardoc6::$publicStaticXField; // ClassZ|(ClassX&ClassY)|(ClassX&ClassY&ClassZ) + +$closure = function((ClassX&ClassY&ClassZ)|ClassY $closure1, ClassX|(ClassX&ClassZ)|(ClassY&ClassZ) $closure2): void { + $closure1->publicXField; // (ClassX&ClassY&ClassZ)|ClassY + $closure1::PUBLIC_Y_CONSTANT; // (ClassX&ClassY&ClassZ)|ClassY + $closure2->publicYMethod()->publicXField; // ClassX|(ClassY&ClassX) + $closure2::$publicStaticYField->publicZField; // (ClassY&ClassZ)|ClassX +}; + +$arrow1 = fn((ClassX&ClassY)|ClassX $test) => $test->publicXField; // (ClassX&ClassY)|ClassX +$arrow2 = fn((ClassX&ClassY)|ClassX $test) => $test::publicStaticXMethod()->publicZField; // (ClassY&ClassZ)|ClassX diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType01.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType01.completion new file mode 100644 index 0000000000..31c92acbe4 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType01.completion @@ -0,0 +1,9 @@ +Code completion result for source line: +$publicPromotedFiled->|publicYMethod(); // ClassZ|(ClassZ&ClassY) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +METHOD publicYMethod() [PUBLIC] ClassY +METHOD publicZMethod() [PUBLIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicZ [PUBLIC] ClassZ diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType02.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType02.completion new file mode 100644 index 0000000000..3d20bc3589 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType02.completion @@ -0,0 +1,9 @@ +Code completion result for source line: +$publicPromotedFiled->publicYMethod()->|publicXMethod(); // ClassX|(ClassY&ClassX) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicYMethod() [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType03.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType03.completion new file mode 100644 index 0000000000..b38885b1dd --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType03.completion @@ -0,0 +1,13 @@ +Code completion result for source line: +$publicPromotedFiled->publicYMethod()::|$publicStaticXField; // ClassX|(ClassY&ClassX) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassY +CONSTANT IMPLICIT_X_CONSTANT "implicit [PUBLIC] ClassX +CONSTANT IMPLICIT_Y_CONSTANT "implicit [PUBLIC] ClassY +CONSTANT PUBLIC_X_CONSTANT "public cons [PUBLIC] ClassX +CONSTANT PUBLIC_Y_CONSTANT "public cons [PUBLIC] ClassY +CONSTANT class \ClassX [PUBLIC] Magic Constant +CONSTANT class \ClassY [PUBLIC] Magic Constant diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType04.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType04.completion new file mode 100644 index 0000000000..7f422933dc --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType04.completion @@ -0,0 +1,13 @@ +Code completion result for source line: +$publicPromotedFiled::|publicStaticYMethod(); // ClassZ|(ClassZ&ClassY) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassZ +CONSTANT IMPLICIT_Y_CONSTANT "implicit [PUBLIC] ClassY +CONSTANT IMPLICIT_Z_CONSTANT "implicit [PUBLIC] ClassZ +CONSTANT PUBLIC_Y_CONSTANT "public cons [PUBLIC] ClassY +CONSTANT PUBLIC_Z_CONSTANT "public cons [PUBLIC] ClassZ +CONSTANT class \ClassY [PUBLIC] Magic Constant +CONSTANT class \ClassZ [PUBLIC] Magic Constant diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType05.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType05.completion new file mode 100644 index 0000000000..c6253ad4b1 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType05.completion @@ -0,0 +1,12 @@ +Code completion result for source line: +$publicPromotedFiled::$publicStaticYField->|publicYField; // (ClassY&ClassZ)|ClassX +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicYMethod() [PUBLIC] ClassY +METHOD publicZMethod() [PUBLIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicZ [PUBLIC] ClassZ diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType06.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType06.completion new file mode 100644 index 0000000000..51495ae3ba --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType06.completion @@ -0,0 +1,18 @@ +Code completion result for source line: +$publicPromotedFiled::$publicStaticYField::|PUBLIC_Z_CONSTANT; // (ClassY&ClassZ)|ClassX +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassZ +CONSTANT IMPLICIT_X_CONSTANT "implicit [PUBLIC] ClassX +CONSTANT IMPLICIT_Y_CONSTANT "implicit [PUBLIC] ClassY +CONSTANT IMPLICIT_Z_CONSTANT "implicit [PUBLIC] ClassZ +CONSTANT PUBLIC_X_CONSTANT "public cons [PUBLIC] ClassX +CONSTANT PUBLIC_Y_CONSTANT "public cons [PUBLIC] ClassY +CONSTANT PUBLIC_Z_CONSTANT "public cons [PUBLIC] ClassZ +CONSTANT class \ClassX [PUBLIC] Magic Constant +CONSTANT class \ClassY [PUBLIC] Magic Constant +CONSTANT class \ClassZ [PUBLIC] Magic Constant diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType07.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType07.completion new file mode 100644 index 0000000000..e993e742eb --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType07.completion @@ -0,0 +1,9 @@ +Code completion result for source line: +$privatePromotedFiled->|publicXField; // null|(ClassZ&ClassX) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticZMethod() [STATIC] ClassZ +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicZMethod() [PUBLIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicZ [PUBLIC] ClassZ diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType08.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType08.completion new file mode 100644 index 0000000000..90fb186938 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType08.completion @@ -0,0 +1,12 @@ +Code completion result for source line: +$privatePromotedFiled->publicXField->|publicZMethod(); // (ClassY&ClassZ)|ClassX +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicYMethod() [PUBLIC] ClassY +METHOD publicZMethod() [PUBLIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicZ [PUBLIC] ClassZ diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType09.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType09.completion new file mode 100644 index 0000000000..3dc0c319fc --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType09.completion @@ -0,0 +1,12 @@ +Code completion result for source line: +$protectedPromotedFiled->|publicXMethod(); // ClassZ|(ClassZ&ClassY)|ClassX +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicYMethod() [PUBLIC] ClassY +METHOD publicZMethod() [PUBLIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicZ [PUBLIC] ClassZ diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType10.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType10.completion new file mode 100644 index 0000000000..b935d5090e --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType10.completion @@ -0,0 +1,18 @@ +Code completion result for source line: +$protectedPromotedFiled::|$publicStaticZField(); // ClassZ|(ClassZ&ClassY)|ClassX +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassZ +CONSTANT IMPLICIT_X_CONSTANT "implicit [PUBLIC] ClassX +CONSTANT IMPLICIT_Y_CONSTANT "implicit [PUBLIC] ClassY +CONSTANT IMPLICIT_Z_CONSTANT "implicit [PUBLIC] ClassZ +CONSTANT PUBLIC_X_CONSTANT "public cons [PUBLIC] ClassX +CONSTANT PUBLIC_Y_CONSTANT "public cons [PUBLIC] ClassY +CONSTANT PUBLIC_Z_CONSTANT "public cons [PUBLIC] ClassZ +CONSTANT class \ClassX [PUBLIC] Magic Constant +CONSTANT class \ClassY [PUBLIC] Magic Constant +CONSTANT class \ClassZ [PUBLIC] Magic Constant diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType11.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType11.completion new file mode 100644 index 0000000000..aee6bbd2b6 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType11.completion @@ -0,0 +1,12 @@ +Code completion result for source line: +$param1->|publicXMethod(); // ClassX|(ClassY&ClassZ) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicYMethod() [PUBLIC] ClassY +METHOD publicZMethod() [PUBLIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicZ [PUBLIC] ClassZ diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType12.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType12.completion new file mode 100644 index 0000000000..c3fd3e24f0 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType12.completion @@ -0,0 +1,9 @@ +Code completion result for source line: +$param1->publicYMethod()->|publicZMethod(); // ClassX|(ClassY&ClassX) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicYMethod() [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType13.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType13.completion new file mode 100644 index 0000000000..332a5a15a3 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType13.completion @@ -0,0 +1,18 @@ +Code completion result for source line: +$param1->publicXMethod()::|PUBLIC_Y_CONSTANT; // ClassX|(ClassY&ClassZ) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassZ +CONSTANT IMPLICIT_X_CONSTANT "implicit [PUBLIC] ClassX +CONSTANT IMPLICIT_Y_CONSTANT "implicit [PUBLIC] ClassY +CONSTANT IMPLICIT_Z_CONSTANT "implicit [PUBLIC] ClassZ +CONSTANT PUBLIC_X_CONSTANT "public cons [PUBLIC] ClassX +CONSTANT PUBLIC_Y_CONSTANT "public cons [PUBLIC] ClassY +CONSTANT PUBLIC_Z_CONSTANT "public cons [PUBLIC] ClassZ +CONSTANT class \ClassX [PUBLIC] Magic Constant +CONSTANT class \ClassY [PUBLIC] Magic Constant +CONSTANT class \ClassZ [PUBLIC] Magic Constant diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType14.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType14.completion new file mode 100644 index 0000000000..53b96449d6 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType14.completion @@ -0,0 +1,18 @@ +Code completion result for source line: +$param1::|publicStaticYMethod(); // ClassX|(ClassY&ClassZ) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassZ +CONSTANT IMPLICIT_X_CONSTANT "implicit [PUBLIC] ClassX +CONSTANT IMPLICIT_Y_CONSTANT "implicit [PUBLIC] ClassY +CONSTANT IMPLICIT_Z_CONSTANT "implicit [PUBLIC] ClassZ +CONSTANT PUBLIC_X_CONSTANT "public cons [PUBLIC] ClassX +CONSTANT PUBLIC_Y_CONSTANT "public cons [PUBLIC] ClassY +CONSTANT PUBLIC_Z_CONSTANT "public cons [PUBLIC] ClassZ +CONSTANT class \ClassX [PUBLIC] Magic Constant +CONSTANT class \ClassY [PUBLIC] Magic Constant +CONSTANT class \ClassZ [PUBLIC] Magic Constant diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType15.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType15.completion new file mode 100644 index 0000000000..12a542465d --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType15.completion @@ -0,0 +1,18 @@ +Code completion result for source line: +$param1::publicStaticYMethod()::|$publicStaticYField; // (ClassY&ClassZ)|ClassX +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassZ +CONSTANT IMPLICIT_X_CONSTANT "implicit [PUBLIC] ClassX +CONSTANT IMPLICIT_Y_CONSTANT "implicit [PUBLIC] ClassY +CONSTANT IMPLICIT_Z_CONSTANT "implicit [PUBLIC] ClassZ +CONSTANT PUBLIC_X_CONSTANT "public cons [PUBLIC] ClassX +CONSTANT PUBLIC_Y_CONSTANT "public cons [PUBLIC] ClassY +CONSTANT PUBLIC_Z_CONSTANT "public cons [PUBLIC] ClassZ +CONSTANT class \ClassX [PUBLIC] Magic Constant +CONSTANT class \ClassY [PUBLIC] Magic Constant +CONSTANT class \ClassZ [PUBLIC] Magic Constant diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType16.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType16.completion new file mode 100644 index 0000000000..5f410c7efd --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType16.completion @@ -0,0 +1,9 @@ +Code completion result for source line: +$param2->|publicYField; // (ClassY&ClassZ)|ClassZ +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +METHOD publicYMethod() [PUBLIC] ClassY +METHOD publicZMethod() [PUBLIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicZ [PUBLIC] ClassZ diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType17.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType17.completion new file mode 100644 index 0000000000..3f4e9b5228 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType17.completion @@ -0,0 +1,13 @@ +Code completion result for source line: +$param2::|IMPLICIT_Y_CONSTANT; // (ClassY&ClassZ)|ClassZ +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassZ +CONSTANT IMPLICIT_Y_CONSTANT "implicit [PUBLIC] ClassY +CONSTANT IMPLICIT_Z_CONSTANT "implicit [PUBLIC] ClassZ +CONSTANT PUBLIC_Y_CONSTANT "public cons [PUBLIC] ClassY +CONSTANT PUBLIC_Z_CONSTANT "public cons [PUBLIC] ClassZ +CONSTANT class \ClassY [PUBLIC] Magic Constant +CONSTANT class \ClassZ [PUBLIC] Magic Constant diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType18.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType18.completion new file mode 100644 index 0000000000..c454bda52f --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType18.completion @@ -0,0 +1,12 @@ +Code completion result for source line: +$param3?->|publicZField; // (ClassX&ClassY)|null|(ClassX&ClassZ) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicYMethod() [PUBLIC] ClassY +METHOD publicZMethod() [PUBLIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicZ [PUBLIC] ClassZ diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType19.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType19.completion new file mode 100644 index 0000000000..847bb32cb4 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType19.completion @@ -0,0 +1,18 @@ +Code completion result for source line: +$param3::|$publicStaticZField; // (ClassX&ClassY)|null|(ClassX&ClassZ) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassZ +CONSTANT IMPLICIT_X_CONSTANT "implicit [PUBLIC] ClassX +CONSTANT IMPLICIT_Y_CONSTANT "implicit [PUBLIC] ClassY +CONSTANT IMPLICIT_Z_CONSTANT "implicit [PUBLIC] ClassZ +CONSTANT PUBLIC_X_CONSTANT "public cons [PUBLIC] ClassX +CONSTANT PUBLIC_Y_CONSTANT "public cons [PUBLIC] ClassY +CONSTANT PUBLIC_Z_CONSTANT "public cons [PUBLIC] ClassZ +CONSTANT class \ClassX [PUBLIC] Magic Constant +CONSTANT class \ClassY [PUBLIC] Magic Constant +CONSTANT class \ClassZ [PUBLIC] Magic Constant diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType20.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType20.completion new file mode 100644 index 0000000000..3c3b0d79ce --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType20.completion @@ -0,0 +1,9 @@ +Code completion result for source line: +$phpdoc1->|publicXMethod(); // null|ClassX|(ClassX&ClassZ) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticZMethod() [STATIC] ClassZ +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicZMethod() [PUBLIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicZ [PUBLIC] ClassZ diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType21.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType21.completion new file mode 100644 index 0000000000..5968fb1933 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType21.completion @@ -0,0 +1,13 @@ +Code completion result for source line: +$phpdoc1::|publicStaticZMethod(); // null|ClassX|(ClassX&ClassZ) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticZMethod() [STATIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassZ +CONSTANT IMPLICIT_X_CONSTANT "implicit [PUBLIC] ClassX +CONSTANT IMPLICIT_Z_CONSTANT "implicit [PUBLIC] ClassZ +CONSTANT PUBLIC_X_CONSTANT "public cons [PUBLIC] ClassX +CONSTANT PUBLIC_Z_CONSTANT "public cons [PUBLIC] ClassZ +CONSTANT class \ClassX [PUBLIC] Magic Constant +CONSTANT class \ClassZ [PUBLIC] Magic Constant diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType22.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType22.completion new file mode 100644 index 0000000000..3116ffcc09 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType22.completion @@ -0,0 +1,12 @@ +Code completion result for source line: +$phpdoc2->|publicYField; // (ClassX&ClassY&ClassZ)|null|(ClassX&ClassZ) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicYMethod() [PUBLIC] ClassY +METHOD publicZMethod() [PUBLIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicZ [PUBLIC] ClassZ diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType23a.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType23a.completion new file mode 100644 index 0000000000..130a7547be --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType23a.completion @@ -0,0 +1,18 @@ +Code completion result for source line: +$phpdoc2::|PUBLIC_Y_CONSTANT; // (ClassX&ClassY&ClassZ)|null|(ClassX&ClassZ) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassZ +CONSTANT IMPLICIT_X_CONSTANT "implicit [PUBLIC] ClassX +CONSTANT IMPLICIT_Y_CONSTANT "implicit [PUBLIC] ClassY +CONSTANT IMPLICIT_Z_CONSTANT "implicit [PUBLIC] ClassZ +CONSTANT PUBLIC_X_CONSTANT "public cons [PUBLIC] ClassX +CONSTANT PUBLIC_Y_CONSTANT "public cons [PUBLIC] ClassY +CONSTANT PUBLIC_Z_CONSTANT "public cons [PUBLIC] ClassZ +CONSTANT class \ClassX [PUBLIC] Magic Constant +CONSTANT class \ClassY [PUBLIC] Magic Constant +CONSTANT class \ClassZ [PUBLIC] Magic Constant diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType23b.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType23b.completion new file mode 100644 index 0000000000..94d02f1672 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType23b.completion @@ -0,0 +1,4 @@ +Code completion result for source line: +$phpdoc2::PUBLIC_Y_|CONSTANT; // (ClassX&ClassY&ClassZ)|null|(ClassX&ClassZ) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +CONSTANT PUBLIC_Y_CONSTANT "public cons [PUBLIC] ClassY diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType24.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType24.completion new file mode 100644 index 0000000000..ae84c97b64 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType24.completion @@ -0,0 +1,12 @@ +Code completion result for source line: +$closure1->|publicXField; // (ClassX&ClassY&ClassZ)|ClassY +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicYMethod() [PUBLIC] ClassY +METHOD publicZMethod() [PUBLIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicZ [PUBLIC] ClassZ diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType25.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType25.completion new file mode 100644 index 0000000000..054448822a --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType25.completion @@ -0,0 +1,18 @@ +Code completion result for source line: +$closure1::|PUBLIC_Y_CONSTANT; // (ClassX&ClassY&ClassZ)|ClassY +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX $public [STATIC] ClassZ +CONSTANT IMPLICIT_X_CONSTANT "implicit [PUBLIC] ClassX +CONSTANT IMPLICIT_Y_CONSTANT "implicit [PUBLIC] ClassY +CONSTANT IMPLICIT_Z_CONSTANT "implicit [PUBLIC] ClassZ +CONSTANT PUBLIC_X_CONSTANT "public cons [PUBLIC] ClassX +CONSTANT PUBLIC_Y_CONSTANT "public cons [PUBLIC] ClassY +CONSTANT PUBLIC_Z_CONSTANT "public cons [PUBLIC] ClassZ +CONSTANT class \ClassX [PUBLIC] Magic Constant +CONSTANT class \ClassY [PUBLIC] Magic Constant +CONSTANT class \ClassZ [PUBLIC] Magic Constant diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType26.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType26.completion new file mode 100644 index 0000000000..0bb8898c29 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType26.completion @@ -0,0 +1,9 @@ +Code completion result for source line: +$closure2->publicYMethod()->|publicXField; // ClassX|(ClassY&ClassX) +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicYMethod() [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType27.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType27.completion new file mode 100644 index 0000000000..1242714357 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType27.completion @@ -0,0 +1,12 @@ +Code completion result for source line: +$closure2::$publicStaticYField->|publicZField; // (ClassY&ClassZ)|ClassX +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicYMethod() [PUBLIC] ClassY +METHOD publicZMethod() [PUBLIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicZ [PUBLIC] ClassZ diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType28.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType28.completion new file mode 100644 index 0000000000..6c65aa2317 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType28.completion @@ -0,0 +1,9 @@ +Code completion result for source line: +$arrow1 = fn((ClassX&ClassY)|ClassX $test) => $test->|publicXField; // (ClassX&ClassY)|ClassX +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicYMethod() [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType29.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType29.completion new file mode 100644 index 0000000000..13afbb06bf --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterType29.completion @@ -0,0 +1,12 @@ +Code completion result for source line: +$arrow2 = fn((ClassX&ClassY)|ClassX $test) => $test::publicStaticXMethod()->|publicZField; // (ClassY&ClassZ)|ClassX +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD publicStaticXMethod() [STATIC] ClassX +METHOD publicStaticYMethod() [STATIC] ClassY +METHOD publicStaticZMethod() [STATIC] ClassZ +METHOD publicXMethod() [PUBLIC] ClassX +METHOD publicYMethod() [PUBLIC] ClassY +METHOD publicZMethod() [PUBLIC] ClassZ +VARIABLE (ClassY&ClassZ)|ClassX publicX [PUBLIC] ClassX +VARIABLE (ClassY&ClassZ)|ClassX publicY [PUBLIC] ClassY +VARIABLE (ClassY&ClassZ)|ClassX publicZ [PUBLIC] ClassZ diff --git a/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterTypeInCCList01.completion b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterTypeInCCList01.completion new file mode 100644 index 0000000000..1f78ab9882 --- /dev/null +++ b/php/php.editor/test/unit/data/testfiles/completion/lib/php82/testDNFTypes/dnfTypes.php.testDNFTypes_ParameterTypeInCCList01.completion @@ -0,0 +1,5 @@ +Code completion result for source line: +$this->param|(null); +(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true) +METHOD param(X|(X&Y)|(Y&Z) $param) [PUBLIC] TestClass +METHOD paramType(ClassX|(ClassY&Class [PUBLIC] TestClass diff --git a/php/php.editor/test/unit/data/testfiles/index/testPHP82DNFParameterTypes/testPHP82DNFParameterTypes.php.indexed b/php/php.editor/test/unit/data/testfiles/index/testPHP82DNFParameterTypes/testPHP82DNFParameterTypes.php.indexed index f25f5e9dd6..1224741b8a 100644 --- a/php/php.editor/test/unit/data/testfiles/index/testPHP82DNFParameterTypes/testPHP82DNFParameterTypes.php.indexed +++ b/php/php.editor/test/unit/data/testfiles/index/testPHP82DNFParameterTypes/testPHP82DNFParameterTypes.php.indexed @@ -2,9 +2,9 @@ Document 0 Searchable Keys: - base : arrowfunctiondeclaration:1449;ArrowFunctionDeclaration:1449;1449;$test::1::1:0:0:1:0:0:(X&Y)|(Y&Z)|(X&Z):;(X&Y)|(Y&Z)|(X&Z);;0;<TESTURL>/testPHP82DNFParameterTypes.php;1;0;(X&Y)|(Y&Z)|(X&Z); - base : lambdafunctiondeclaration:1390;LambdaFunctionDeclaration:1390;1390;$test::1::1:0:0:1:0:0:(X&Y&Z)|(X&Z):;(X&Y&Z)|(X&Z);;0;<TESTURL>/testPHP82DNFParameterTypes.php;1;0;(X&Y&Z)|(X&Z); - base : parametertype;parameterType;871;$param::1::1:0:0:1:0:0:(X&Y&Test)|(X&Z):;void;;0;<TESTURL>/testPHP82DNFParameterTypes.php;0;0;void; + base : arrowfunctiondeclaration:1449;ArrowFunctionDeclaration:1449;1449;$test:X|Y|Y|Z|X|Z:1::1:0:0:1:0:0:(X&Y)|(Y&Z)|(X&Z):;(X&Y)|(Y&Z)|(X&Z);;0;<TESTURL>/testPHP82DNFParameterTypes.php;1;0;(X&Y)|(Y&Z)|(X&Z); + base : lambdafunctiondeclaration:1390;LambdaFunctionDeclaration:1390;1390;$test:X|Y|Z|X|Z:1::1:0:0:1:0:0:(X&Y&Z)|(X&Z):;(X&Y&Z)|(X&Z);;0;<TESTURL>/testPHP82DNFParameterTypes.php;1;0;(X&Y&Z)|(X&Z); + base : parametertype;parameterType;871;$param:X|Y|Test|X|Z:1::1:0:0:1:0:0:(X&Y&Test)|(X&Z):;void;;0;<TESTURL>/testPHP82DNFParameterTypes.php;0;0;void; top : $arrow top : $closure top : arrowfunctiondeclaration:1449 @@ -46,7 +46,7 @@ Not Searchable Keys: Document 3 Searchable Keys: clz : testclass;TestClass;927;;;;1;;0;<TESTURL>/testPHP82DNFParameterTypes.php;; - method : parametertype;parameterType;959;$param1:Z|X:1::1:0:0:1:0:0:(Test&Y)|Z|X:,$param2:bool:1::1:0:0:0:0:0:bool:;(\Test&\Y)|\Z|\X;1;0;<TESTURL>/testPHP82DNFParameterTypes.php;1;0;(Test&Y)|Z|X; + method : parametertype;parameterType;959;$param1:Test|Y|Z|X:1::1:0:0:1:0:0:(Test&Y)|Z|X:,$param2:bool:1::1:0:0:0:0:0:bool:;(\Test&\Y)|\Z|\X;1;0;<TESTURL>/testPHP82DNFParameterTypes.php;1;0;(Test&Y)|Z|X; top : testclass Not Searchable Keys: @@ -80,7 +80,7 @@ Document 7 Searchable Keys: enum : testenum;TestEnum;1273;;;;1;;0;<TESTURL>/testPHP82DNFParameterTypes.php; enum.case : case1;Case1;1293;?;0;<TESTURL>/testPHP82DNFParameterTypes.php;1; - method : parametertype;parameterType;1320;$param1:X&Y:1::1:0:0:0:0:1:X&Y:,$param2:Z:1::1:0:0:1:0:0:(X&Y)|Z:;(\X&\Y)|\Z;1;0;<TESTURL>/testPHP82DNFParameterTypes.php;1;0;(X&Y)|Z; + method : parametertype;parameterType;1320;$param1:X&Y:1::1:0:0:0:0:1:X&Y:,$param2:X|Y|Z:1::1:0:0:1:0:0:(X&Y)|Z:;(\X&\Y)|\Z;1;0;<TESTURL>/testPHP82DNFParameterTypes.php;1;0;(X&Y)|Z; top : testenum Not Searchable Keys: @@ -266,7 +266,7 @@ Not Searchable Keys: Document 9 Searchable Keys: iface : testinterfase;TestInterfase;1194;;;0;<TESTURL>/testPHP82DNFParameterTypes.php; - method : parametertype;parameterType;1230;$param:X|Z:1::1:0:0:1:0:0:X|(X&Y&Z)|Z:;;1025;0;<TESTURL>/testPHP82DNFParameterTypes.php;0;0;; + method : parametertype;parameterType;1230;$param:X|X|Y|Z|Z:1::1:0:0:1:0:0:X|(X&Y&Z)|Z:;;1025;0;<TESTURL>/testPHP82DNFParameterTypes.php;0;0;; top : testinterfase Not Searchable Keys: @@ -274,7 +274,7 @@ Not Searchable Keys: Document 10 Searchable Keys: - method : parametertype;parameterType;1100;$param::1::1:0:0:1:0:0:(X&Y)|(Y&Z&Test):;\self;1;0;<TESTURL>/testPHP82DNFParameterTypes.php;0;0;self; + method : parametertype;parameterType;1100;$param:X|Y|Y|Z|Test:1::1:0:0:1:0:0:(X&Y)|(Y&Z&Test):;\self;1;0;<TESTURL>/testPHP82DNFParameterTypes.php;0;0;self; top : testtrait trait : testtrait;TestTrait;1068;;;0;<TESTURL>/testPHP82DNFParameterTypes.php; diff --git a/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHP82CodeCompletionTest.java b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHP82CodeCompletionTest.java index 40fd8def75..d8d0e09399 100644 --- a/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHP82CodeCompletionTest.java +++ b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHP82CodeCompletionTest.java @@ -505,4 +505,128 @@ public class PHP82CodeCompletionTest extends PHPCodeCompletionTestBase { checkCompletion("dnfTypes", "$vardoc6::^$publicStaticXField;"); } + public void testDNFTypes_ParameterType01() throws Exception { + checkCompletion("dnfTypes", "$publicPromotedFiled->^publicYMethod();"); + } + + public void testDNFTypes_ParameterType02() throws Exception { + checkCompletion("dnfTypes", "$publicPromotedFiled->publicYMethod()->^publicXMethod();"); + } + + public void testDNFTypes_ParameterType03() throws Exception { + checkCompletion("dnfTypes", "$publicPromotedFiled->publicYMethod()::^$publicStaticXField;"); + } + + public void testDNFTypes_ParameterType04() throws Exception { + checkCompletion("dnfTypes", "$publicPromotedFiled::^publicStaticYMethod();"); + } + + public void testDNFTypes_ParameterType05() throws Exception { + checkCompletion("dnfTypes", "$publicPromotedFiled::$publicStaticYField->^publicYField;"); + } + + public void testDNFTypes_ParameterType06() throws Exception { + checkCompletion("dnfTypes", "$publicPromotedFiled::$publicStaticYField::^PUBLIC_Z_CONSTANT;"); + } + + public void testDNFTypes_ParameterType07() throws Exception { + checkCompletion("dnfTypes", "$privatePromotedFiled->^publicXField;"); + } + + public void testDNFTypes_ParameterType08() throws Exception { + checkCompletion("dnfTypes", "$privatePromotedFiled->publicXField->^publicZMethod();"); + } + + public void testDNFTypes_ParameterType09() throws Exception { + checkCompletion("dnfTypes", "$protectedPromotedFiled->^publicXMethod();"); + } + + public void testDNFTypes_ParameterType10() throws Exception { + checkCompletion("dnfTypes", "$protectedPromotedFiled::^$publicStaticZField()"); + } + + public void testDNFTypes_ParameterType11() throws Exception { + checkCompletion("dnfTypes", "$param1->^publicXMethod();"); + } + + public void testDNFTypes_ParameterType12() throws Exception { + checkCompletion("dnfTypes", "$param1->publicYMethod()->^publicZMethod();"); + } + + public void testDNFTypes_ParameterType13() throws Exception { + checkCompletion("dnfTypes", "$param1->publicXMethod()::^PUBLIC_Y_CONSTANT;"); + } + + public void testDNFTypes_ParameterType14() throws Exception { + checkCompletion("dnfTypes", "$param1::^publicStaticYMethod();"); + } + + public void testDNFTypes_ParameterType15() throws Exception { + checkCompletion("dnfTypes", "$param1::publicStaticYMethod()::^$publicStaticYField;"); + } + + public void testDNFTypes_ParameterType16() throws Exception { + checkCompletion("dnfTypes", "$param2->^publicYField;"); + } + + public void testDNFTypes_ParameterType17() throws Exception { + checkCompletion("dnfTypes", "$param2::^IMPLICIT_Y_CONSTANT;"); + } + + public void testDNFTypes_ParameterType18() throws Exception { + checkCompletion("dnfTypes", "$param3?->^publicZField;"); + } + + public void testDNFTypes_ParameterType19() throws Exception { + checkCompletion("dnfTypes", "$param3::^$publicStaticZField;"); + } + + public void testDNFTypes_ParameterType20() throws Exception { + checkCompletion("dnfTypes", "$phpdoc1->^publicXMethod();"); + } + + public void testDNFTypes_ParameterType21() throws Exception { + checkCompletion("dnfTypes", "$phpdoc1::^publicStaticZMethod();"); + } + + public void testDNFTypes_ParameterType22() throws Exception { + checkCompletion("dnfTypes", "$phpdoc2->^publicYField;"); + } + + public void testDNFTypes_ParameterType23a() throws Exception { + checkCompletion("dnfTypes", "$phpdoc2::^PUBLIC_Y_CONSTANT;"); + } + + public void testDNFTypes_ParameterType23b() throws Exception { + checkCompletion("dnfTypes", "$phpdoc2::PUBLIC_Y_^CONSTANT;"); + } + + public void testDNFTypes_ParameterType24() throws Exception { + checkCompletion("dnfTypes", "$closure1->^publicXField;"); + } + + public void testDNFTypes_ParameterType25() throws Exception { + checkCompletion("dnfTypes", "$closure1::^PUBLIC_Y_CONSTANT;"); + } + + public void testDNFTypes_ParameterType26() throws Exception { + checkCompletion("dnfTypes", "$closure2->publicYMethod()->^publicXField;"); + } + + public void testDNFTypes_ParameterType27() throws Exception { + checkCompletion("dnfTypes", "$closure2::$publicStaticYField->^publicZField;"); + } + + public void testDNFTypes_ParameterType28() throws Exception { + checkCompletion("dnfTypes", "$arrow1 = fn((ClassX&ClassY)|ClassX $test) => $test->^publicXField;"); + } + + public void testDNFTypes_ParameterType29() throws Exception { + checkCompletion("dnfTypes", "$arrow2 = fn((ClassX&ClassY)|ClassX $test) => $test::publicStaticXMethod()->^publicZField;"); + } + + public void testDNFTypes_ParameterTypeInCCList01() throws Exception { + checkCompletion("dnfTypes", "$this->param^(null);"); + } + } diff --git a/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/model/impl/TypeTest.java b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/model/impl/TypeTest.java index ae2c69d344..d56127cb80 100644 --- a/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/model/impl/TypeTest.java +++ b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/model/impl/TypeTest.java @@ -143,4 +143,104 @@ public class TypeTest extends ModelTestBase { String declaredTypes = " (\\NS3\\Test3&Test1)|(\\NS1\\Test1&\\NS2\\Test2) "; assertArrayEquals(new String[]{"\\NS3\\Test3", "Test1", "\\NS1\\Test1", "\\NS2\\Test2"}, Type.splitTypes(declaredTypes)); } + + public void testToTypeTemplate_01() throws Exception { + String declaredTypes = "Foo"; + assertEquals("%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplate_02() throws Exception { + String declaredTypes = "\\Foo"; + assertEquals("%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplate_03() throws Exception { + String declaredTypes = " \\Foo\\Bar "; + assertEquals("%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateNullableType_01() throws Exception { + String declaredTypes = "?Foo"; + assertEquals("?%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateNullableType_02() throws Exception { + String declaredTypes = "?\\Foo\\Bar"; + assertEquals("?%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateUnionType_01() throws Exception { + String declaredTypes = "string|int|null"; + assertEquals("%s|%s|%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateUnionType_02() throws Exception { + String declaredTypes = "\\Foo\\Bar|\\Baz|null"; + assertEquals("%s|%s|%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateUnionType_03() throws Exception { + String declaredTypes = "\\Foo\\Bar | \\Baz | null"; + assertEquals("%s|%s|%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateIntersectionType_01() throws Exception { + String declaredTypes = "string&int&null"; + assertEquals("%s&%s&%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateIntersectionType_02() throws Exception { + String declaredTypes = "\\Foo\\Bar&\\Baz&null"; + assertEquals("%s&%s&%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateIntersectionType_03() throws Exception { + String declaredTypes = "\\Foo\\Bar & \\Baz & null"; + assertEquals("%s&%s&%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateDNFType_01() throws Exception { + String declaredTypes = "(X&Y)|Z"; + assertEquals("(%s&%s)|%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateDNFType_02() throws Exception { + String declaredTypes = "X|(Y&Z)"; + assertEquals("%s|(%s&%s)", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateDNFType_03() throws Exception { + String declaredTypes = "(X&Y)|(Y&Z)"; + assertEquals("(%s&%s)|(%s&%s)", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateDNFType_04() throws Exception { + String declaredTypes = "X|(Y&Z)|Z"; + assertEquals("%s|(%s&%s)|%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateDNFType_05() throws Exception { + String declaredTypes = "(\\NS1\\Test1&\\NS2\\Test2)|\\Test3"; + assertEquals("(%s&%s)|%s", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateDNFType_06() throws Exception { + String declaredTypes = "\\NS3\\Test3 | (\\NS1\\Test1&\\NS2\\Test2)"; + assertEquals("%s|(%s&%s)", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateDNFType_07() throws Exception { + String declaredTypes = "(\\NS3\\Test3&Test1) | (\\NS1\\Test1&\\NS2\\Test2)"; + assertEquals("(%s&%s)|(%s&%s)", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateDNFType_08() throws Exception { + String declaredTypes = "(\\NS3\\Test3&Test1)|(\\NS1\\Test1&\\NS2\\Test2)"; + assertEquals("(%s&%s)|(%s&%s)", Type.toTypeTemplate(declaredTypes)); + } + + public void testToTypeTemplateDNFType_09() throws Exception { + String declaredTypes = " (\\NS3\\Test3&Test1)|(\\NS1\\Test1&\\NS2\\Test2) "; + assertEquals("(%s&%s)|(%s&%s)", Type.toTypeTemplate(declaredTypes)); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists