This is an automated email from the ASF dual-hosted git repository.
junichi11 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new ac76fd10e1 Fixed issue #5375 for intersection type
new 3f2916e457 Merge pull request #5700 from
troizet/intersection_part_gh5375
ac76fd10e1 is described below
commit ac76fd10e1ab74d0bf885afe325755142c1ee739
Author: Alexey Borokhvostov <[email protected]>
AuthorDate: Wed Mar 22 23:02:09 2023 +0700
Fixed issue #5375 for intersection type
---
.../modules/php/editor/parser/api/Utils.java | 4 +-
.../documentation/issueGH5375Intersection.php | 44 ++++++++++++++++++++++
...eGH5375Intersection.php.testIssueGH5375_03.html | 11 ++++++
...eGH5375Intersection.php.testIssueGH5375_04.html | 10 +++++
.../editor/completion/PHPCCDocumentationTest.java | 8 ++++
5 files changed, 76 insertions(+), 1 deletion(-)
diff --git
a/php/php.editor/src/org/netbeans/modules/php/editor/parser/api/Utils.java
b/php/php.editor/src/org/netbeans/modules/php/editor/parser/api/Utils.java
index ee2e2e7c42..70a042f2f2 100644
--- a/php/php.editor/src/org/netbeans/modules/php/editor/parser/api/Utils.java
+++ b/php/php.editor/src/org/netbeans/modules/php/editor/parser/api/Utils.java
@@ -29,6 +29,7 @@ import
org.netbeans.modules.php.editor.parser.astnodes.ClassDeclaration;
import org.netbeans.modules.php.editor.parser.astnodes.Comment;
import org.netbeans.modules.php.editor.parser.astnodes.FunctionName;
import org.netbeans.modules.php.editor.parser.astnodes.Identifier;
+import org.netbeans.modules.php.editor.parser.astnodes.IntersectionType;
import org.netbeans.modules.php.editor.parser.astnodes.NamespaceName;
import org.netbeans.modules.php.editor.parser.astnodes.NullableType;
import org.netbeans.modules.php.editor.parser.astnodes.PHPDocBlock;
@@ -105,7 +106,8 @@ public final class Utils {
ASTNode next = nodes.iterator().next();
if (next instanceof NamespaceName
|| next instanceof NullableType
- || next instanceof UnionType) {
+ || next instanceof UnionType
+ || next instanceof IntersectionType) {
isFieldDeclaration = true;
}
}
diff --git
a/php/php.editor/test/unit/data/testfiles/completion/documentation/issueGH5375Intersection.php
b/php/php.editor/test/unit/data/testfiles/completion/documentation/issueGH5375Intersection.php
new file mode 100644
index 0000000000..83f087b4e5
--- /dev/null
+++
b/php/php.editor/test/unit/data/testfiles/completion/documentation/issueGH5375Intersection.php
@@ -0,0 +1,44 @@
+<?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.
+ */
+
+class ClassA {}
+class ClassB extends ClassA {}
+
+
+class ClassName {
+
+ /**
+ * This text should be displayed here.
+ */
+ public ClassA&ClassB $test_without_var_tag;
+
+ /**
+ * This text should be displayed here.
+ * @var ClassA&ClassB
+ */
+ public ClassA&ClassB $test_with_var_tag;
+
+ public function test() {
+ $this->test_without_var_tag;
+ $this->test_with_var_tag;
+ }
+
+}
+
diff --git
a/php/php.editor/test/unit/data/testfiles/completion/documentation/issueGH5375Intersection.php.testIssueGH5375_03.html
b/php/php.editor/test/unit/data/testfiles/completion/documentation/issueGH5375Intersection.php.testIssueGH5375_03.html
new file mode 100644
index 0000000000..9b46895426
--- /dev/null
+++
b/php/php.editor/test/unit/data/testfiles/completion/documentation/issueGH5375Intersection.php.testIssueGH5375_03.html
@@ -0,0 +1,11 @@
+<html><body>
+<pre>Code completion result for source line:
+$this->test_without_v|ar_tag;
+(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true)
+VARIABLE ClassA&ClassB test_without_var [PUBLIC] ClassName
+</pre><h2>Documentation:</h2><div align="right"><font
size=-1></font></div><b>$test_without_var_tag</b><br/><br/>
+This text should be displayed here.
+<br />
+<table>
+<tr><th align="left">Type:</th><td>ClassA & ClassB</td></tr></table>
+</body></html>
\ No newline at end of file
diff --git
a/php/php.editor/test/unit/data/testfiles/completion/documentation/issueGH5375Intersection.php.testIssueGH5375_04.html
b/php/php.editor/test/unit/data/testfiles/completion/documentation/issueGH5375Intersection.php.testIssueGH5375_04.html
new file mode 100644
index 0000000000..a8d985526a
--- /dev/null
+++
b/php/php.editor/test/unit/data/testfiles/completion/documentation/issueGH5375Intersection.php.testIssueGH5375_04.html
@@ -0,0 +1,10 @@
+<html><body>
+<pre>Code completion result for source line:
+$this->test_with_v|ar_tag;
+(QueryType=COMPLETION, prefixSearch=false, caseSensitive=true)
+VARIABLE ClassA&ClassB test_with_var_ta [PUBLIC] ClassName
+</pre><h2>Documentation:</h2><div align="right"><font
size=-1></font></div><b>$test_with_var_tag</b><br/><br/>
+This text should be displayed here.<br />
+<table>
+<tr><th align="left">Type:</th><td>ClassA & ClassB</td></tr></table>
+</body></html>
\ No newline at end of file
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 0bc08f6f6e..f299402202 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
@@ -283,6 +283,14 @@ public class PHPCCDocumentationTest extends
PHPCodeCompletionTestBase {
checkCompletionDocumentation("testfiles/completion/documentation/issueGH5375.php",
"$this->test_with_v^ar_tag", false, "");
}
+ public void testIssueGH5375_03() throws Exception {
+
checkCompletionDocumentation("testfiles/completion/documentation/issueGH5375Intersection.php",
"$this->test_without_v^ar_tag", false, "");
+ }
+
+ public void testIssueGH5375_04() throws Exception {
+
checkCompletionDocumentation("testfiles/completion/documentation/issueGH5375Intersection.php",
"$this->test_with_v^ar_tag", false, "");
+ }
+
public void testIssueGH5426_01() throws Exception {
checkCompletionDocumentation("testfiles/completion/documentation/issueGH5426.php",
" $this->testFi^eld;", false, "");
}
---------------------------------------------------------------------
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