This is an automated email from the ASF dual-hosted git repository.

tmysik 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 fb4357f  [NETBEANS-1855] Autocomplete for property and method without 
$this->
     new 3e50d3f  Merge pull request #1605 from 
junichi11/netbeans-1855-cc-improvement
fb4357f is described below

commit fb4357f9b40c64aa4dfecd7e9aa8617503f9e5e0
Author: Junichi Yamamoto <junich...@apache.org>
AuthorDate: Mon Sep 16 09:44:09 2019 +0900

    [NETBEANS-1855] Autocomplete for property and method without $this->
---
 .../php/editor/completion/PHPCodeCompletion.java   |  70 +++++++++-
 .../php/editor/completion/PHPCompletionItem.java   |  67 +++++++++-
 .../modules/php/editor/model/ModelUtils.java       |  10 ++
 .../issue153707.php.testIssue153707_01.completion  |   4 +
 .../issue153707.php.testIssue153707_02.completion  |   1 +
 .../testfiles/completion/lib/nb1855/nb1855.php     | 145 +++++++++++++++++++++
 ...tCompleteAccessPrefixInClassConst_01.completion |  15 +++
 ...tCompleteAccessPrefixInClassConst_02.completion |   4 +
 ....testCompleteAccessPrefixInTrait_01.completion} |  23 +++-
 ....testCompleteAccessPrefixInTrait_02.completion} |  12 +-
 ...p.testCompleteAccessPrefixInTrait_03.completion |   9 ++
 ...855.php.testCompleteAccessPrefix_01.completion} |  49 ++++++-
 ...1855.php.testCompleteAccessPrefix_02.completion |  35 +++++
 ...1855.php.testCompleteAccessPrefix_03.completion |  15 +++
 ...ousClass03.php.testAnonymousClass03a.completion |   2 +
 ...Functions.php.testArrowFunctions_21b.completion |   3 +
 ...Functions.php.testArrowFunctions_24b.completion |   3 +
 ...d.php.testArrowFunctionsInMethod_01a.completion |   2 +
 ...tArrowFunctionsInMethodWithError_01a.completion |   2 +
 ...tArrowFunctionsInMethodWithError_02a.completion |   2 +
 ...hp.testSpreadOperatorInClassConst_00.completion |   6 +
 ...hp.testSpreadOperatorInClassConst_01.completion |   6 +
 ...hp.testSpreadOperatorInClassConst_04.completion |   6 +
 ...hp.testSpreadOperatorInClassConst_07.completion |   7 +
 ...hp.testSpreadOperatorInClassConst_11.completion |   4 +
 .../issue247082.php.testForKeywords.completion     |  22 ++++
 .../issue257088.php.testClassKeywords.completion   |   1 +
 .../completion/PHPCodeCompletionNb1855Test.java    |  78 +++++++++++
 .../editor/completion/PHPCodeCompletionTest.java   |   1 +
 29 files changed, 578 insertions(+), 26 deletions(-)

diff --git 
a/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion.java
 
b/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion.java
index 82130b5..fa3fef8 100644
--- 
a/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion.java
+++ 
b/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion.java
@@ -385,6 +385,11 @@ public class PHPCodeCompletion implements 
CodeCompletionHandler2 {
                 autoCompleteTypeNames(completionResult, request, null, true);
                 autoCompleteConstants(completionResult, request);
                 autoCompleteKeywords(completionResult, request, 
PHP_CLASS_CONST_KEYWORDS);
+                // NETBEANS-1855
+                if (!request.prefix.contains("\\")) { // NOI18N
+                    // e.g. const CONSTANT = \^Foo\Bar::CONSTANT;
+                    autoCompleteClassConstants(completionResult, request);
+                }
                 break;
             case HTML:
             case OPEN_TAG:
@@ -1155,6 +1160,14 @@ public class PHPCodeCompletion implements 
CodeCompletionHandler2 {
             final PHPCompletionResult completionResult,
             PHPCompletionItem.CompletionRequest request,
             boolean staticContext) {
+        autoCompleteClassMembers(completionResult, request, staticContext, 
false);
+    }
+
+    private void autoCompleteClassMembers(
+            final PHPCompletionResult completionResult,
+            PHPCompletionItem.CompletionRequest request,
+            boolean staticContext,
+            boolean completeAccessPrefix) {
         if (CancelSupport.getDefault().isCancelled()) {
             return;
         }
@@ -1209,13 +1222,23 @@ public class PHPCodeCompletion implements 
CodeCompletionHandler2 {
             Collection<? extends TypeScope> types = 
ModelUtils.resolveTypeAfterReferenceToken(model, tokenSequence, request.anchor, 
specialVariable);
             if (types != null) {
                 TypeElement enclosingType = getEnclosingType(request, types);
+                if (completeAccessPrefix) {
+                    // NETBEANS-1855
+                    types = ModelUtils.resolveType(model, request.anchor);
+                }
                 Set<PhpElement> duplicateElementCheck = new HashSet<>();
                 for (TypeScope typeScope : types) {
                     if (CancelSupport.getDefault().isCancelled()) {
                         return;
                     }
-                    final StaticOrInstanceMembersFilter staticFlagFilter =
-                            new StaticOrInstanceMembersFilter(staticContext, 
instanceContext, selfContext, staticLateBindingContext);
+                    final ElementFilter staticFlagFilter = 
!completeAccessPrefix
+                            ? new StaticOrInstanceMembersFilter(staticContext, 
instanceContext, selfContext, staticLateBindingContext)
+                            : new ElementFilter() { // NETBEANS-1855
+                        @Override
+                        public boolean isAccepted(PhpElement element) {
+                            return true;
+                        }
+                    };
 
                     final ElementFilter methodsFilter = ElementFilter.allOf(
                             ElementFilter.forKind(PhpElementKind.METHOD),
@@ -1249,7 +1272,7 @@ public class PHPCodeCompletion implements 
CodeCompletionHandler2 {
                         if (duplicateElementCheck.add(phpElement)) {
                             if (methodsFilter.isAccepted(phpElement)) {
                                 MethodElement method = (MethodElement) 
phpElement;
-                                List<MethodElementItem> items = 
PHPCompletionItem.MethodElementItem.getItems(method, request);
+                                List<MethodElementItem> items = 
PHPCompletionItem.MethodElementItem.getItems(method, request, 
completeAccessPrefix);
                                 for (MethodElementItem methodItem : items) {
                                     if 
(CancelSupport.getDefault().isCancelled()) {
                                         return;
@@ -1258,11 +1281,11 @@ public class PHPCodeCompletion implements 
CodeCompletionHandler2 {
                                 }
                             } else if (fieldsFilter.isAccepted(phpElement)) {
                                 FieldElement field = (FieldElement) phpElement;
-                                FieldItem fieldItem = 
PHPCompletionItem.FieldItem.getItem(field, request);
+                                FieldItem fieldItem = 
PHPCompletionItem.FieldItem.getItem(field, request, false, 
completeAccessPrefix);
                                 completionResult.add(fieldItem);
-                            } else if (staticContext && 
constantsFilter.isAccepted(phpElement)) {
+                            } else if ((staticContext || completeAccessPrefix) 
&& constantsFilter.isAccepted(phpElement)) {
                                 TypeConstantElement constant = 
(TypeConstantElement) phpElement;
-                                TypeConstantItem constantItem = 
PHPCompletionItem.TypeConstantItem.getItem(constant, request);
+                                TypeConstantItem constantItem = 
PHPCompletionItem.TypeConstantItem.getItem(constant, request, 
completeAccessPrefix);
                                 completionResult.add(constantItem);
                             }
                         }
@@ -1299,6 +1322,38 @@ public class PHPCodeCompletion implements 
CodeCompletionHandler2 {
         return false;
     }
 
+    private void autoCompleteClassConstants(final PHPCompletionResult 
completionResult, final PHPCompletionItem.CompletionRequest request) {
+        // NETBANS-1855
+        // complete access prefix i.e. add "self::" to the top of constant 
names
+        if (CancelSupport.getDefault().isCancelled()) {
+            return;
+        }
+        final ElementFilter constantsFilter = ElementFilter.allOf(
+                ElementFilter.forKind(PhpElementKind.TYPE_CONSTANT),
+                
ElementFilter.forName(NameKind.caseInsensitivePrefix(request.prefix)),
+                ElementFilter.forInstanceOf(TypeConstantElement.class)
+        );
+        Model model = request.result.getModel();
+        Collection<? extends TypeScope> types = ModelUtils.resolveType(model, 
request.anchor);
+        TypeElement enclosingType = getEnclosingType(request, types);
+        for (TypeScope typeScope : types) {
+            if (CancelSupport.getDefault().isCancelled()) {
+                return;
+            }
+            for (final PhpElement phpElement : 
request.index.getAccessibleTypeMembers(typeScope, enclosingType)) {
+                if (CancelSupport.getDefault().isCancelled()) {
+                    return;
+                }
+                if (constantsFilter.isAccepted(phpElement)) {
+                    TypeConstantElement constant = (TypeConstantElement) 
phpElement;
+                    TypeConstantItem constantItem = 
PHPCompletionItem.TypeConstantItem.getItem(constant, request, true);
+                    completionResult.add(constantItem);
+                }
+            }
+        }
+
+    }
+
     private void autoCompleteClassFields(final PHPCompletionResult 
completionResult, final PHPCompletionItem.CompletionRequest request) {
         if (CancelSupport.getDefault().isCancelled()) {
             return;
@@ -1331,6 +1386,7 @@ public class PHPCodeCompletion implements 
CodeCompletionHandler2 {
         }
     }
 
+    @CheckForNull
     private TypeElement getEnclosingType(CompletionRequest request, 
Collection<? extends TypeScope> types) {
         final EnclosingType enclosingType = findEnclosingType(request.info, 
lexerToASTOffset(request.result, request.anchor));
         final String enclosingTypeName = enclosingType != null ? 
enclosingType.extractTypeName() : null;
@@ -1493,6 +1549,8 @@ public class PHPCodeCompletion implements 
CodeCompletionHandler2 {
                         completionResult.add(new 
PHPCompletionItem.ClassScopeKeywordItem(typeName, keyword, request));
                     }
                 }
+                // NETBEANS-1855
+                autoCompleteClassMembers(completionResult, request, false, 
true);
             }
         }
     }
diff --git 
a/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCompletionItem.java
 
b/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCompletionItem.java
index f7a7387..5e17054 100644
--- 
a/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCompletionItem.java
+++ 
b/php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCompletionItem.java
@@ -42,6 +42,7 @@ import javax.swing.ImageIcon;
 import javax.swing.text.BadLocationException;
 import javax.swing.text.Document;
 import org.netbeans.api.annotations.common.NullAllowed;
+import org.netbeans.api.annotations.common.StaticResource;
 import org.netbeans.api.editor.EditorRegistry;
 import org.netbeans.api.editor.completion.Completion;
 import org.netbeans.api.lexer.Token;
@@ -122,6 +123,7 @@ import org.openide.util.WeakListeners;
  */
 public abstract class PHPCompletionItem implements CompletionProposal {
 
+    @StaticResource
     private static final String PHP_KEYWORD_ICON = 
"org/netbeans/modules/php/editor/resources/php16Key.png"; //NOI18N
     protected static final ImageIcon KEYWORD_ICON = new 
ImageIcon(ImageUtilities.loadImage(PHP_KEYWORD_ICON));
     final CompletionRequest request;
@@ -487,20 +489,44 @@ public abstract class PHPCompletionItem implements 
CompletionProposal {
 
     public static class MethodElementItem extends FunctionElementItem {
 
+        private final boolean completeAccessPrefix;
+
         /**
          * @return more than one instance in case if optional parameters exists
          */
         static List<MethodElementItem> getItems(final MethodElement 
methodElement, CompletionRequest request) {
+            return getItems(methodElement, request, false);
+        }
+
+        /**
+         * @return more than one instance in case if optional parameters exists
+         */
+        static List<MethodElementItem> getItems(final MethodElement 
methodElement, CompletionRequest request, boolean completeAccessPrefix) {
             final List<MethodElementItem> retval = new ArrayList<>();
             List<FunctionElementItem> items = 
FunctionElementItem.getItems(methodElement, request);
             for (FunctionElementItem functionElementItem : items) {
-                retval.add(new MethodElementItem(functionElementItem));
+                retval.add(new MethodElementItem(functionElementItem, 
completeAccessPrefix));
             }
             return retval;
         }
 
         MethodElementItem(FunctionElementItem function) {
+            this(function, false);
+        }
+
+        MethodElementItem(FunctionElementItem function, boolean 
completeAccessPrefix) {
             super(function.getBaseFunctionElement(), function.request, 
function.parameters);
+            this.completeAccessPrefix = completeAccessPrefix;
+        }
+
+        @Override
+        public String getCustomInsertTemplate() {
+            String prefix = ""; // NOI18N
+            if (completeAccessPrefix) {
+                Set<Modifier> modifiers = getModifiers();
+                prefix = modifiers.contains(Modifier.STATIC) ? "self::" : 
"$this->"; // NOI18N
+            }
+            return prefix + super.getCustomInsertTemplate();
         }
     }
 
@@ -822,18 +848,24 @@ public abstract class PHPCompletionItem implements 
CompletionProposal {
 
     static class FieldItem extends BasicFieldItem {
         private final boolean forceDollared;
+        private final boolean completeAccessPrefix;
 
         public static FieldItem getItem(FieldElement field, CompletionRequest 
request) {
             return getItem(field, request, false);
         }
 
         public static FieldItem getItem(FieldElement field, CompletionRequest 
request, boolean forceDollared) {
-            return new FieldItem(field, request, forceDollared);
+            return new FieldItem(field, request, forceDollared, false);
+        }
+
+        public static FieldItem getItem(FieldElement field, CompletionRequest 
request, boolean forceDollared, boolean completeAccessPrefix) {
+            return new FieldItem(field, request, forceDollared, 
completeAccessPrefix);
         }
 
-        private FieldItem(FieldElement field, CompletionRequest request, 
boolean forceDollared) {
+        private FieldItem(FieldElement field, CompletionRequest request, 
boolean forceDollared, boolean completeAccessPrefix) {
             super(field, null, request);
             this.forceDollared = forceDollared;
+            this.completeAccessPrefix = completeAccessPrefix;
         }
 
         FieldElement getField() {
@@ -861,16 +893,33 @@ public abstract class PHPCompletionItem implements 
CompletionProposal {
             }
             return typeName;
         }
+
+        @Override
+        public String getCustomInsertTemplate() {
+            if (completeAccessPrefix) {
+                Set<Modifier> modifiers = getModifiers();
+                String prefix = modifiers.contains(Modifier.STATIC) ? "self::" 
: "$this->"; // NOI18N
+                return prefix + getName();
+            }
+            return super.getCustomInsertTemplate();
+        }
     }
 
     static class TypeConstantItem extends PHPCompletionItem {
 
+        private final boolean completeAccessPrefix;
+
         public static TypeConstantItem getItem(TypeConstantElement constant, 
CompletionRequest request) {
-            return new TypeConstantItem(constant, request);
+            return getItem(constant, request, false);
         }
 
-        private TypeConstantItem(TypeConstantElement constant, 
CompletionRequest request) {
+        public static TypeConstantItem getItem(TypeConstantElement constant, 
CompletionRequest request, boolean completeAccessPrefix) {
+            return new TypeConstantItem(constant, request, 
completeAccessPrefix);
+        }
+
+        private TypeConstantItem(TypeConstantElement constant, 
CompletionRequest request, boolean completeAccessPrefix) {
             super(constant, request);
+            this.completeAccessPrefix = completeAccessPrefix;
         }
 
         TypeConstantElement getConstant() {
@@ -922,6 +971,14 @@ public abstract class PHPCompletionItem implements 
CompletionProposal {
             }
             return super.getRhsHtml(formatter);
         }
+
+        @Override
+        public String getCustomInsertTemplate() {
+            if (completeAccessPrefix) {
+                return "self::" + getName(); // NOI18N
+            }
+            return super.getCustomInsertTemplate();
+        }
     }
 
     public static class MethodDeclarationItem extends MethodElementItem {
diff --git 
a/php/php.editor/src/org/netbeans/modules/php/editor/model/ModelUtils.java 
b/php/php.editor/src/org/netbeans/modules/php/editor/model/ModelUtils.java
index d79558f..ba45cf3 100644
--- a/php/php.editor/src/org/netbeans/modules/php/editor/model/ModelUtils.java
+++ b/php/php.editor/src/org/netbeans/modules/php/editor/model/ModelUtils.java
@@ -237,6 +237,16 @@ public final class ModelUtils {
     }
 
     @NonNull
+    public static Collection<? extends TypeScope> resolveType(Model model, int 
offset) {
+        VariableScope variableScope = model.getVariableScope(offset);
+        TypeScope typeScope = getTypeScope(variableScope);
+        if (typeScope != null) {
+            return Collections.singletonList(typeScope);
+        }
+        return Collections.emptyList();
+    }
+
+    @NonNull
     public static Collection<? extends TypeScope> 
resolveTypeAfterReferenceToken(Model model, TokenSequence<PHPTokenId> 
tokenSequence,
             int offset, boolean specialVariable) {
         tokenSequence.move(offset);
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/_base/issue153707.php.testIssue153707_01.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/_base/issue153707.php.testIssue153707_01.completion
index faa22bc..42fd822 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/_base/issue153707.php.testIssue153707_01.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/_base/issue153707.php.testIssue153707_01.completion
@@ -4,7 +4,11 @@ echo "class property: |$this->name\n";
 PACKAGE    ANS                             [PUBLIC]   null
 PACKAGE    CNS                             [PUBLIC]   null
 CLASS      Book                            [PUBLIC]   issue153707.php
+METHOD     getName()                       [PUBLIC]   Book
+METHOD     setName($name)                  [PUBLIC]   Book
 VARIABLE   ? $name                         [PUBLIC]   issue153707.php
+VARIABLE   ? name                          [PUBLIC]   Book
+CONSTANT   TEST 'Simon'                    [PUBLIC]   Book
 KEYWORD    Book $this->                               null
 KEYWORD    parent::                                   null
 KEYWORD    self::                                     null
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/_base/issue153707.php.testIssue153707_02.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/_base/issue153707.php.testIssue153707_02.completion
index 3e4804a..1bbab62 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/_base/issue153707.php.testIssue153707_02.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/_base/issue153707.php.testIssue153707_02.completion
@@ -2,6 +2,7 @@ Code completion result for source line:
 echo "class property: $|this->name\n";
 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
 VARIABLE   ? $name                         [PUBLIC]   issue153707.php
+VARIABLE   ? name                          [PUBLIC]   Book
 KEYWORD    Book $this->                               null
 ------------------------------------
 VARIABLE   $GLOBALS                                   PHP Platform
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php
new file mode 100644
index 0000000..09a9a22
--- /dev/null
+++ b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php
@@ -0,0 +1,145 @@
+<?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 ParentClass {
+
+    public const PUBLIC_PARENT_CONSTANT = "pubic constant";
+    protected const PROTECTED_PARENT_CONSTANT = "protected constatnt";
+    private const PRIVATE_PARENT_CONSTANT = "private constant";
+
+    public $publicParentProperty;
+    protected $protectedParentProperty;
+    private $privateParentProperty;
+    public static $publicStaticParentProperty;
+    protected static $protectedParentStaticProperty;
+    private static $privateParentStaticProperty;
+
+    public function publicParentMethod($param) {
+        
+    }
+
+    protected function protectedParentMethod($param) {
+        
+    }
+
+    private function privateParentMethod($param) {
+        
+    }
+
+    public static function publicParentStaticMethod($param, $param2) {
+        
+    }
+
+    protected static function protectedParentStaticMethod($param, $param2) {
+        
+    }
+
+    private static function privateParentStaticMethod($param, $param2) {
+        
+    }
+
+}
+
+trait Trait1855 {
+
+    public $publicTraitProperty;
+    protected $protectedTraitProperty;
+    private $privateTraitProperty;
+    public static $publicStaticTraitProperty;
+    protected static $protectedTraitStaticProperty;
+    private static $privateTraitStaticProperty;
+
+    public function publicTraitMethod($param) {
+          // trait 1
+        $p; // trait 2
+        protectedTraitMethod($param); // trait 3
+    }
+
+    protected function protectedTraitMethod($param) {
+        
+    }
+
+    private function privateTraitMethod($param) {
+        
+    }
+
+    public static function publicTraitStaticMethod($param, $param2) {
+        
+    }
+
+    protected static function protectedTraitStaticMethod($param, $param2) {
+        
+    }
+
+    private static function privateTraitStaticMethod($param, $param2) {
+        
+    }
+
+}
+
+class Class1855 extends ParentClass {
+
+    public const PUBLIC_CONSTANT = "pubic constant";
+    protected const PROTECTED_CONSTANT = "protected constatnt";
+    private const PRIVATE_CONSTANT = "private constant";
+    public const TEST1 = ;
+    public const TEST2 = pri;
+
+    public $publicProperty;
+    protected $protectedProperty;
+    private $privateProperty;
+    public static $publicStaticProperty;
+    protected static $protectedStaticProperty;
+    private static $privateStaticProperty;
+
+    use Trait1855;
+
+    public function test() {
+          // test1
+        $ // test2
+        pri // test3
+    }
+
+    public function publicMethod($param) {
+        
+    }
+
+    protected function protectedMethod($param) {
+        
+    }
+
+    private function privateMethod($param) {
+        
+    }
+
+    public static function publicStaticMethod($param, $param2) {
+        
+    }
+
+    protected static function protectedStaticMethod($param, $param2) {
+        
+    }
+
+    private static function privateStaticMethod($param, $param2) {
+        
+    }
+
+}
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInClassConst_01.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInClassConst_01.completion
new file mode 100644
index 0000000..c2dd3cc
--- /dev/null
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInClassConst_01.completion
@@ -0,0 +1,15 @@
+Code completion result for source line:
+public const TEST1 = |;
+(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
+CLASS      Class1855                       [PUBLIC]   nb1855.php
+CLASS      ParentClass                     [PUBLIC]   nb1855.php
+CONSTANT   PRIVATE_CONSTANT "private cons  [PRIVATE]  Class1855
+CONSTANT   PROTECTED_CONSTANT "protected   [PROTECTE  Class1855
+CONSTANT   PROTECTED_PARENT_CONSTANT "pro  [PROTECTE  ParentClass
+CONSTANT   PUBLIC_CONSTANT "pubic constan  [PUBLIC]   Class1855
+CONSTANT   PUBLIC_PARENT_CONSTANT "pubic   [PUBLIC]   ParentClass
+CONSTANT   TEST2 ?                         [PUBLIC]   Class1855
+KEYWORD    parent::                                   null
+KEYWORD    self::                                     null
+------------------------------------
+KEYWORD    array                                      null
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInClassConst_02.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInClassConst_02.completion
new file mode 100644
index 0000000..3a68d2b
--- /dev/null
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInClassConst_02.completion
@@ -0,0 +1,4 @@
+Code completion result for source line:
+public const TEST2 = pri|;
+(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
+CONSTANT   PRIVATE_CONSTANT "private cons  [PRIVATE]  Class1855
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_21b.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInTrait_01.completion
similarity index 83%
copy from 
php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_21b.completion
copy to 
php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInTrait_01.completion
index ddf5f2c..6e30927 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_21b.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInTrait_01.completion
@@ -1,11 +1,22 @@
 Code completion result for source line:
-$af = fn(): ?ArrowFunctions => |$this;
+| // trait 1
 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
-CLASS      ArrowFunctions                  [PUBLIC]   arrowFunctions.php
-VARIABLE   ? $af                           [PUBLIC]   arrowFunctions.php
-VARIABLE   int $test                       [PUBLIC]   arrowFunctions.php
-CONSTANT   CONSTANT_INT 1000               [PUBLIC]   arrowFunctions.php
-KEYWORD    ArrowFunctions $this->                     null
+CLASS      Class1855                       [PUBLIC]   nb1855.php
+CLASS      ParentClass                     [PUBLIC]   nb1855.php
+METHOD     privateTraitMethod($param)      [PRIVATE]  Trait1855
+METHOD     privateTraitStaticMethod($para  [PRIVATE,  Trait1855
+METHOD     protectedTraitMethod($param)    [PROTECTE  Trait1855
+METHOD     protectedTraitStaticMethod($pa  [PROTECTE  Trait1855
+METHOD     publicTraitMethod($param)       [PUBLIC]   Trait1855
+METHOD     publicTraitStaticMethod($param  [STATIC]   Trait1855
+VARIABLE   ? $param                        [PUBLIC]   nb1855.php
+VARIABLE   ? $privateTraitStaticProperty   [PRIVATE,  Trait1855
+VARIABLE   ? $protectedTraitStaticPropert  [PROTECTE  Trait1855
+VARIABLE   ? $publicStaticTraitProperty    [STATIC]   Trait1855
+VARIABLE   ? privateTraitProperty          [PRIVATE]  Trait1855
+VARIABLE   ? protectedTraitProperty        [PROTECTE  Trait1855
+VARIABLE   ? publicTraitProperty           [PUBLIC]   Trait1855
+KEYWORD    Trait1855 $this->                          null
 KEYWORD    parent::                                   null
 KEYWORD    self::                                     null
 KEYWORD    static::                                   null
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/_base/issue153707.php.testIssue153707_02.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInTrait_02.completion
similarity index 67%
copy from 
php/php.editor/test/unit/data/testfiles/completion/lib/_base/issue153707.php.testIssue153707_02.completion
copy to 
php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInTrait_02.completion
index 3e4804a..5e35c3f 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/_base/issue153707.php.testIssue153707_02.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInTrait_02.completion
@@ -1,8 +1,14 @@
 Code completion result for source line:
-echo "class property: $|this->name\n";
+$|p; // trait 2
 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
-VARIABLE   ? $name                         [PUBLIC]   issue153707.php
-KEYWORD    Book $this->                               null
+VARIABLE   ? $param                        [PUBLIC]   nb1855.php
+VARIABLE   ? $privateTraitStaticProperty   [PRIVATE,  Trait1855
+VARIABLE   ? $protectedTraitStaticPropert  [PROTECTE  Trait1855
+VARIABLE   ? $publicStaticTraitProperty    [STATIC]   Trait1855
+VARIABLE   ? privateTraitProperty          [PRIVATE]  Trait1855
+VARIABLE   ? protectedTraitProperty        [PROTECTE  Trait1855
+VARIABLE   ? publicTraitProperty           [PUBLIC]   Trait1855
+KEYWORD    Trait1855 $this->                          null
 ------------------------------------
 VARIABLE   $GLOBALS                                   PHP Platform
 VARIABLE   $HTTP_RAW_POST_DATA                        PHP Platform
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInTrait_03.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInTrait_03.completion
new file mode 100644
index 0000000..6c4b62b
--- /dev/null
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefixInTrait_03.completion
@@ -0,0 +1,9 @@
+Code completion result for source line:
+protected|TraitMethod($param); // trait 3
+(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
+METHOD     protectedTraitMethod($param)    [PROTECTE  Trait1855
+METHOD     protectedTraitStaticMethod($pa  [PROTECTE  Trait1855
+VARIABLE   ? $protectedTraitStaticPropert  [PROTECTE  Trait1855
+VARIABLE   ? protectedTraitProperty        [PROTECTE  Trait1855
+------------------------------------
+KEYWORD    protected                                  null
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_21b.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefix_01.completion
similarity index 66%
copy from 
php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_21b.completion
copy to 
php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefix_01.completion
index ddf5f2c..5dae1bd 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_21b.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefix_01.completion
@@ -1,11 +1,48 @@
 Code completion result for source line:
-$af = fn(): ?ArrowFunctions => |$this;
+| // test1
 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
-CLASS      ArrowFunctions                  [PUBLIC]   arrowFunctions.php
-VARIABLE   ? $af                           [PUBLIC]   arrowFunctions.php
-VARIABLE   int $test                       [PUBLIC]   arrowFunctions.php
-CONSTANT   CONSTANT_INT 1000               [PUBLIC]   arrowFunctions.php
-KEYWORD    ArrowFunctions $this->                     null
+CLASS      Class1855                       [PUBLIC]   nb1855.php
+CLASS      ParentClass                     [PUBLIC]   nb1855.php
+METHOD     privateMethod($param)           [PRIVATE]  Class1855
+METHOD     privateStaticMethod($param, $p  [PRIVATE,  Class1855
+METHOD     privateTraitMethod($param)      [PRIVATE]  Trait1855
+METHOD     privateTraitStaticMethod($para  [PRIVATE,  Trait1855
+METHOD     protectedMethod($param)         [PROTECTE  Class1855
+METHOD     protectedParentMethod($param)   [PROTECTE  ParentClass
+METHOD     protectedParentStaticMethod($p  [PROTECTE  ParentClass
+METHOD     protectedStaticMethod($param,   [PROTECTE  Class1855
+METHOD     protectedTraitMethod($param)    [PROTECTE  Trait1855
+METHOD     protectedTraitStaticMethod($pa  [PROTECTE  Trait1855
+METHOD     publicMethod($param)            [PUBLIC]   Class1855
+METHOD     publicParentMethod($param)      [PUBLIC]   ParentClass
+METHOD     publicParentStaticMethod($para  [STATIC]   ParentClass
+METHOD     publicStaticMethod($param, $pa  [STATIC]   Class1855
+METHOD     publicTraitMethod($param)       [PUBLIC]   Trait1855
+METHOD     publicTraitStaticMethod($param  [STATIC]   Trait1855
+METHOD     test()                          [PUBLIC]   Class1855
+VARIABLE   ? $privateStaticProperty        [PRIVATE,  Class1855
+VARIABLE   ? $privateTraitStaticProperty   [PRIVATE,  Trait1855
+VARIABLE   ? $protectedParentStaticProper  [PROTECTE  ParentClass
+VARIABLE   ? $protectedStaticProperty      [PROTECTE  Class1855
+VARIABLE   ? $protectedTraitStaticPropert  [PROTECTE  Trait1855
+VARIABLE   ? $publicStaticParentProperty   [STATIC]   ParentClass
+VARIABLE   ? $publicStaticProperty         [STATIC]   Class1855
+VARIABLE   ? $publicStaticTraitProperty    [STATIC]   Trait1855
+VARIABLE   ? privateProperty               [PRIVATE]  Class1855
+VARIABLE   ? privateTraitProperty          [PRIVATE]  Trait1855
+VARIABLE   ? protectedParentProperty       [PROTECTE  ParentClass
+VARIABLE   ? protectedProperty             [PROTECTE  Class1855
+VARIABLE   ? protectedTraitProperty        [PROTECTE  Trait1855
+VARIABLE   ? publicParentProperty          [PUBLIC]   ParentClass
+VARIABLE   ? publicProperty                [PUBLIC]   Class1855
+VARIABLE   ? publicTraitProperty           [PUBLIC]   Trait1855
+CONSTANT   PRIVATE_CONSTANT "private cons  [PRIVATE]  Class1855
+CONSTANT   PROTECTED_CONSTANT "protected   [PROTECTE  Class1855
+CONSTANT   PROTECTED_PARENT_CONSTANT "pro  [PROTECTE  ParentClass
+CONSTANT   PUBLIC_CONSTANT "pubic constan  [PUBLIC]   Class1855
+CONSTANT   PUBLIC_PARENT_CONSTANT "pubic   [PUBLIC]   ParentClass
+CONSTANT   TEST2 ?                         [PUBLIC]   Class1855
+KEYWORD    Class1855 $this->                          null
 KEYWORD    parent::                                   null
 KEYWORD    self::                                     null
 KEYWORD    static::                                   null
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefix_02.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefix_02.completion
new file mode 100644
index 0000000..4560503
--- /dev/null
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefix_02.completion
@@ -0,0 +1,35 @@
+Code completion result for source line:
+$| // test2
+(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
+VARIABLE   ? $privateStaticProperty        [PRIVATE,  Class1855
+VARIABLE   ? $privateTraitStaticProperty   [PRIVATE,  Trait1855
+VARIABLE   ? $protectedParentStaticProper  [PROTECTE  ParentClass
+VARIABLE   ? $protectedStaticProperty      [PROTECTE  Class1855
+VARIABLE   ? $protectedTraitStaticPropert  [PROTECTE  Trait1855
+VARIABLE   ? $publicStaticParentProperty   [STATIC]   ParentClass
+VARIABLE   ? $publicStaticProperty         [STATIC]   Class1855
+VARIABLE   ? $publicStaticTraitProperty    [STATIC]   Trait1855
+VARIABLE   ? privateProperty               [PRIVATE]  Class1855
+VARIABLE   ? privateTraitProperty          [PRIVATE]  Trait1855
+VARIABLE   ? protectedParentProperty       [PROTECTE  ParentClass
+VARIABLE   ? protectedProperty             [PROTECTE  Class1855
+VARIABLE   ? protectedTraitProperty        [PROTECTE  Trait1855
+VARIABLE   ? publicParentProperty          [PUBLIC]   ParentClass
+VARIABLE   ? publicProperty                [PUBLIC]   Class1855
+VARIABLE   ? publicTraitProperty           [PUBLIC]   Trait1855
+KEYWORD    Class1855 $this->                          null
+------------------------------------
+VARIABLE   $GLOBALS                                   PHP Platform
+VARIABLE   $HTTP_RAW_POST_DATA                        PHP Platform
+VARIABLE   $_COOKIE                                   PHP Platform
+VARIABLE   $_ENV                                      PHP Platform
+VARIABLE   $_FILES                                    PHP Platform
+VARIABLE   $_GET                                      PHP Platform
+VARIABLE   $_POST                                     PHP Platform
+VARIABLE   $_REQUEST                                  PHP Platform
+VARIABLE   $_SERVER                                   PHP Platform
+VARIABLE   $_SESSION                                  PHP Platform
+VARIABLE   $argc                                      PHP Platform
+VARIABLE   $argv                                      PHP Platform
+VARIABLE   $http_response_header                      PHP Platform
+VARIABLE   $php_errormsg                              PHP Platform
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefix_03.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefix_03.completion
new file mode 100644
index 0000000..55b15a3
--- /dev/null
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/nb1855/nb1855.php.testCompleteAccessPrefix_03.completion
@@ -0,0 +1,15 @@
+Code completion result for source line:
+pri| // test3
+(QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
+METHOD     privateMethod($param)           [PRIVATE]  Class1855
+METHOD     privateStaticMethod($param, $p  [PRIVATE,  Class1855
+METHOD     privateTraitMethod($param)      [PRIVATE]  Trait1855
+METHOD     privateTraitStaticMethod($para  [PRIVATE,  Trait1855
+VARIABLE   ? $privateStaticProperty        [PRIVATE,  Class1855
+VARIABLE   ? $privateTraitStaticProperty   [PRIVATE,  Trait1855
+VARIABLE   ? privateProperty               [PRIVATE]  Class1855
+VARIABLE   ? privateTraitProperty          [PRIVATE]  Trait1855
+CONSTANT   PRIVATE_CONSTANT "private cons  [PRIVATE]  Class1855
+------------------------------------
+KEYWORD    print '';                                  Language Construct
+KEYWORD    private                                    null
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php70/base/anonymousClass03.php.testAnonymousClass03a.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php70/base/anonymousClass03.php.testAnonymousClass03a.completion
index 29fb907..57e6242 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php70/base/anonymousClass03.php.testAnonymousClass03a.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php70/base/anonymousClass03.php.testAnonymousClass03a.completion
@@ -1,6 +1,8 @@
 Code completion result for source line:
 return new class($|this->prop) extends Outer {
 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
+VARIABLE   ? prop                          [PRIVATE]  \My\Outer
+VARIABLE   ? prop2                         [PROTECTE  \My\Outer
 KEYWORD    Outer $this->                              null
 ------------------------------------
 VARIABLE   $GLOBALS                                   PHP Platform
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_21b.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_21b.completion
index ddf5f2c..a31f027 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_21b.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_21b.completion
@@ -2,6 +2,9 @@ Code completion result for source line:
 $af = fn(): ?ArrowFunctions => |$this;
 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
 CLASS      ArrowFunctions                  [PUBLIC]   arrowFunctions.php
+METHOD     getNumber()                     [PUBLIC]   ArrowFunctions
+METHOD     new()                           [STATIC]   ArrowFunctions
+METHOD     test()                          [PUBLIC]   ArrowFunctions
 VARIABLE   ? $af                           [PUBLIC]   arrowFunctions.php
 VARIABLE   int $test                       [PUBLIC]   arrowFunctions.php
 CONSTANT   CONSTANT_INT 1000               [PUBLIC]   arrowFunctions.php
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_24b.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_24b.completion
index cc801e8..576e0e9 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_24b.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctions/arrowFunctions.php.testArrowFunctions_24b.completion
@@ -2,6 +2,9 @@ Code completion result for source line:
 $af = static fn() => |isset($this); // static
 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
 CLASS      ArrowFunctions                  [PUBLIC]   arrowFunctions.php
+METHOD     getNumber()                     [PUBLIC]   ArrowFunctions
+METHOD     new()                           [STATIC]   ArrowFunctions
+METHOD     test()                          [PUBLIC]   ArrowFunctions
 VARIABLE   ? $af                           [PUBLIC]   arrowFunctions.php
 VARIABLE   int $test                       [PUBLIC]   arrowFunctions.php
 CONSTANT   CONSTANT_INT 1000               [PUBLIC]   arrowFunctions.php
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctionsInMethod/arrowFunctionsInMethod.php.testArrowFunctionsInMethod_01a.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctionsInMethod/arrowFunctionsInMethod.php.testArrowFunctionsInMethod_01a.completion
index 9eac005..7e479e9 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctionsInMethod/arrowFunctionsInMethod.php.testArrowFunctionsInMethod_01a.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctionsInMethod/arrowFunctionsInMethod.php.testArrowFunctionsInMethod_01a.completion
@@ -2,6 +2,8 @@ Code completion result for source line:
 $fn = fn() => |$af->getNumber() + $number + $this->getNumber();
 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
 CLASS      ArrowFunctions                  [PUBLIC]   
arrowFunctionsInMethod.php
+METHOD     getNumber()                     [PUBLIC]   ArrowFunctions
+METHOD     test(ArrowFunctions $af, int $  [PUBLIC]   ArrowFunctions
 VARIABLE   ? $fn                           [PUBLIC]   
arrowFunctionsInMethod.php
 VARIABLE   ArrowFunctions $af              [PUBLIC]   
arrowFunctionsInMethod.php
 VARIABLE   int $number                     [PUBLIC]   
arrowFunctionsInMethod.php
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctionsInMethodWithError/arrowFunctionsInMethodWithError.php.testArrowFunctionsInMethodWithError_01a.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctionsInMethodWithError/arrowFunctionsInMethodWithError.php.testArrowFunctionsInMethodWithError_01a.completion
index 9328ba8..d7d1d03 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctionsInMethodWithError/arrowFunctionsInMethodWithError.php.testArrowFunctionsInMethodWithError_01a.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctionsInMethodWithError/arrowFunctionsInMethodWithError.php.testArrowFunctionsInMethodWithError_01a.completion
@@ -2,6 +2,8 @@ Code completion result for source line:
 $fn = fn(int $test) => $af->getNumber() + | + $this->getNumber();
 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
 CLASS      ArrowFunctions                  [PUBLIC]   
arrowFunctionsInMethodWithError.php
+METHOD     getNumber()                     [PUBLIC]   ArrowFunctions
+METHOD     test(ArrowFunctions $af, int $  [PUBLIC]   ArrowFunctions
 VARIABLE   ? $fn                           [PUBLIC]   
arrowFunctionsInMethodWithError.php
 VARIABLE   ArrowFunctions $af              [PUBLIC]   
arrowFunctionsInMethodWithError.php
 VARIABLE   int $number                     [PUBLIC]   
arrowFunctionsInMethodWithError.php
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctionsInMethodWithError/arrowFunctionsInMethodWithError.php.testArrowFunctionsInMethodWithError_02a.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctionsInMethodWithError/arrowFunctionsInMethodWithError.php.testArrowFunctionsInMethodWithError_02a.completion
index d14f7cd..6606708 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctionsInMethodWithError/arrowFunctionsInMethodWithError.php.testArrowFunctionsInMethodWithError_02a.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testArrowFunctionsInMethodWithError/arrowFunctionsInMethodWithError.php.testArrowFunctionsInMethodWithError_02a.completion
@@ -2,6 +2,8 @@ Code completion result for source line:
 $fn = fn(ArrowFunctions $object) => $af->getNumber() + |;
 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
 CLASS      ArrowFunctions                  [PUBLIC]   
arrowFunctionsInMethodWithError.php
+METHOD     getNumber()                     [PUBLIC]   ArrowFunctions
+METHOD     test(ArrowFunctions $af, int $  [PUBLIC]   ArrowFunctions
 VARIABLE   ? $fn                           [PUBLIC]   
arrowFunctionsInMethodWithError.php
 VARIABLE   ArrowFunctions $af              [PUBLIC]   
arrowFunctionsInMethodWithError.php
 VARIABLE   ArrowFunctions $object          [PUBLIC]   
arrowFunctionsInMethodWithError.php
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_00.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_00.completion
index 32a74fc..53d7777 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_00.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_00.completion
@@ -6,6 +6,12 @@ PACKAGE    Foo                             [PUBLIC]   null
 CLASS      BarUnpackClass                  [PUBLIC]   Bar
 CLASS      UnpackChildClass                [PUBLIC]   Foo
 CLASS      UnpackClass                     [PUBLIC]   Foo
+CONSTANT   CONSTANT ?                      [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT1 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT2 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT3 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT4 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT5 ?                     [PUBLIC]   \Foo\UnpackClass
 CONSTANT   F_CONST "test"                  [PUBLIC]   Foo
 KEYWORD    parent::                                   null
 KEYWORD    self::                                     null
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_01.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_01.completion
index ae2626d..feae9c8 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_01.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_01.completion
@@ -6,6 +6,12 @@ PACKAGE    Foo                             [PUBLIC]   null
 CLASS      BarUnpackClass                  [PUBLIC]   Bar
 CLASS      UnpackChildClass                [PUBLIC]   Foo
 CLASS      UnpackClass                     [PUBLIC]   Foo
+CONSTANT   CONSTANT ?                      [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT1 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT2 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT3 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT4 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT5 ?                     [PUBLIC]   \Foo\UnpackClass
 CONSTANT   F_CONST "test"                  [PUBLIC]   Foo
 KEYWORD    parent::                                   null
 KEYWORD    self::                                     null
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_04.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_04.completion
index 7c6f414..d452e36 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_04.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_04.completion
@@ -6,6 +6,12 @@ PACKAGE    Foo                             [PUBLIC]   null
 CLASS      BarUnpackClass                  [PUBLIC]   Bar
 CLASS      UnpackChildClass                [PUBLIC]   Foo
 CLASS      UnpackClass                     [PUBLIC]   Foo
+CONSTANT   CONSTANT ?                      [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT1 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT2 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT3 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT4 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT5 ?                     [PUBLIC]   \Foo\UnpackClass
 CONSTANT   F_CONST "test"                  [PUBLIC]   Foo
 KEYWORD    parent::                                   null
 KEYWORD    self::                                     null
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_07.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_07.completion
index 0c04303..cb5ea8c 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_07.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_07.completion
@@ -6,6 +6,13 @@ PACKAGE    Foo                             [PUBLIC]   null
 CLASS      BarUnpackClass                  [PUBLIC]   Bar
 CLASS      UnpackChildClass                [PUBLIC]   Foo
 CLASS      UnpackClass                     [PUBLIC]   Foo
+CONSTANT   CHILD_CONSTANT ?                [PUBLIC]   \Foo\UnpackChildClass
+CONSTANT   CONSTANT ?                      [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT1 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT2 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT3 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT4 ?                     [PUBLIC]   \Foo\UnpackClass
+CONSTANT   CONSTANT5 ?                     [PUBLIC]   \Foo\UnpackClass
 CONSTANT   F_CONST "test"                  [PUBLIC]   Foo
 KEYWORD    parent::                                   null
 KEYWORD    self::                                     null
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_11.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_11.completion
index 4358ac5..a8f2e9c 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_11.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/php74/testSpreadOperatorInClassConst/spreadOperatorInClassConst.php.testSpreadOperatorInClassConst_11.completion
@@ -6,6 +6,10 @@ PACKAGE    Foo                             [PUBLIC]   null
 CLASS      BarUnpackClass                  [PUBLIC]   Bar
 CLASS      UnpackChildClass                [PUBLIC]   Foo
 CLASS      UnpackClass                     [PUBLIC]   Foo
+CONSTANT   CONST1 ?                        [PRIVATE]  \Bar\BarUnpackClass
+CONSTANT   CONST2 ?                        [PRIVATE]  \Bar\BarUnpackClass
+CONSTANT   CONST3 ?                        [PRIVATE]  \Bar\BarUnpackClass
+CONSTANT   CONST4 ?                        [PRIVATE]  \Bar\BarUnpackClass
 CONSTANT   F_CONST "test"                  [PUBLIC]   Foo
 KEYWORD    parent::                                   null
 KEYWORD    self::                                     null
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/tests247082/issue247082.php.testForKeywords.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/tests247082/issue247082.php.testForKeywords.completion
index 408116d..fbcd3bb 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/tests247082/issue247082.php.testForKeywords.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/tests247082/issue247082.php.testForKeywords.completion
@@ -3,7 +3,29 @@ echo |self::MY_CONST . PHP_EOL;
 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
 CLASS      A                               [PUBLIC]   issue247082.php
 CLASS      ParentA                         [PUBLIC]   issue247082.php
+METHOD     filter(array $values)           [PUBLIC]   A
+METHOD     myPrivateTestInstance()         [PRIVATE]  A
+METHOD     myPrivateTestStatic()           [PRIVATE,  A
+METHOD     myProtectedTestInstance()       [PROTECTE  A
+METHOD     myProtectedTestStatic()         [PROTECTE  A
+METHOD     myTestInstance()                [PUBLIC]   A
+METHOD     myTestStatic()                  [STATIC]   A
+METHOD     parentProtectedTestInstance()   [PROTECTE  ParentA
+METHOD     parentProtectedTestStatic()     [PROTECTE  ParentA
+METHOD     parentTestInstance()            [PUBLIC]   ParentA
+METHOD     parentTestStatic()              [STATIC]   ParentA
+METHOD     test()                          [PUBLIC]   A
+VARIABLE   ? $myFieldStatic                [STATIC]   A
+VARIABLE   ? $myPrivateFieldStatic         [PRIVATE,  A
+VARIABLE   ? $myProtectedFieldStatic       [PROTECTE  A
+VARIABLE   ? $parentFieldStatic            [STATIC]   ParentA
+VARIABLE   ? $parentProtectedFieldStatic   [PROTECTE  ParentA
 VARIABLE   ? $val                          [PUBLIC]   issue247082.php
+VARIABLE   ? myFieldInstance               [PUBLIC]   A
+VARIABLE   ? myPrivateFieldInstance        [PRIVATE]  A
+VARIABLE   ? myProtectedFieldInstance      [PROTECTE  A
+CONSTANT   MY_CONST 'MY_CONST'             [PUBLIC]   A
+CONSTANT   PARENT_CONST 'PARENT_CONST'     [PUBLIC]   ParentA
 KEYWORD    A $this->                                  null
 KEYWORD    parent::                                   null
 KEYWORD    self::                                     null
diff --git 
a/php/php.editor/test/unit/data/testfiles/completion/lib/tests257088/issue257088.php.testClassKeywords.completion
 
b/php/php.editor/test/unit/data/testfiles/completion/lib/tests257088/issue257088.php.testClassKeywords.completion
index 879f30f..de02e4d 100644
--- 
a/php/php.editor/test/unit/data/testfiles/completion/lib/tests257088/issue257088.php.testClassKeywords.completion
+++ 
b/php/php.editor/test/unit/data/testfiles/completion/lib/tests257088/issue257088.php.testClassKeywords.completion
@@ -1,6 +1,7 @@
 Code completion result for source line:
 |;// HERE
 (QueryType=COMPLETION, prefixSearch=true, caseSensitive=true)
+METHOD     publicMethod()                  [PUBLIC]   MyTrait
 KEYWORD    MyTrait $this->                            null
 KEYWORD    parent::                                   null
 KEYWORD    self::                                     null
diff --git 
a/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletionNb1855Test.java
 
b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletionNb1855Test.java
new file mode 100644
index 0000000..2e9b540
--- /dev/null
+++ 
b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletionNb1855Test.java
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ */
+package org.netbeans.modules.php.editor.completion;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.Map;
+import org.netbeans.api.java.classpath.ClassPath;
+import org.netbeans.modules.php.project.api.PhpSourcePath;
+import org.netbeans.spi.java.classpath.support.ClassPathSupport;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+
+
+public class PHPCodeCompletionNb1855Test extends PHPCodeCompletionTestBase {
+
+    public PHPCodeCompletionNb1855Test(String testName) {
+        super(testName);
+    }
+
+    public void testCompleteAccessPrefix_01() throws Exception {
+        checkCompletion("testfiles/completion/lib/nb1855/nb1855.php", "        
 ^ // test1", false);
+    }
+
+    public void testCompleteAccessPrefix_02() throws Exception {
+        checkCompletion("testfiles/completion/lib/nb1855/nb1855.php", "        
$^ // test2", false);
+    }
+
+    public void testCompleteAccessPrefix_03() throws Exception {
+        checkCompletion("testfiles/completion/lib/nb1855/nb1855.php", "        
pri^ // test3", false);
+    }
+
+    public void testCompleteAccessPrefixInClassConst_01() throws Exception {
+        checkCompletion("testfiles/completion/lib/nb1855/nb1855.php", "    
public const TEST1 = ^;", false);
+    }
+
+    public void testCompleteAccessPrefixInClassConst_02() throws Exception {
+        checkCompletion("testfiles/completion/lib/nb1855/nb1855.php", "    
public const TEST2 = pri^;", false);
+    }
+
+    public void testCompleteAccessPrefixInTrait_01() throws Exception {
+        checkCompletion("testfiles/completion/lib/nb1855/nb1855.php", "        
 ^ // trait 1", false);
+    }
+
+    public void testCompleteAccessPrefixInTrait_02() throws Exception {
+        checkCompletion("testfiles/completion/lib/nb1855/nb1855.php", "        
$^p; // trait 2", false);
+    }
+
+    public void testCompleteAccessPrefixInTrait_03() throws Exception {
+        checkCompletion("testfiles/completion/lib/nb1855/nb1855.php", "        
protected^TraitMethod($param); // trait 3", false);
+    }
+
+    @Override
+    protected Map<String, ClassPath> createClassPathsForTest() {
+        return Collections.singletonMap(
+            PhpSourcePath.SOURCE_CP,
+            ClassPathSupport.createClassPath(new FileObject[] {
+                FileUtil.toFileObject(new File(getDataDir(), 
"/testfiles/completion/lib/nb1855"))
+            })
+        );
+    }
+}
diff --git 
a/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletionTest.java
 
b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletionTest.java
index 53e16ea..e89e068 100644
--- 
a/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletionTest.java
+++ 
b/php/php.editor/test/unit/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletionTest.java
@@ -781,6 +781,7 @@ public class PHPCodeCompletionTest extends 
PHPCodeCompletionTestBase {
     }
 
     public void testIssue153707_01() throws Exception {
+        // FIXME: maybe, should add only variables and $this->
         checkCompletion("testfiles/completion/lib/_base/issue153707.php", 
"class property: ^", false);
     }
 


---------------------------------------------------------------------
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

Reply via email to