Skip to content

Commit c02b30e

Browse files
committed
Excluded non-public consts from !php/const autocompletion
1 parent 47ec30d commit c02b30e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/fr/adrienbrault/idea/symfony2plugin/util/completion/PhpConstGotoCompletionProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void getLookupElements(@NotNull GotoCompletionProviderLookupArguments arg
5555
if (phpClass != null) {
5656
// reset the prefix matcher, starting after ::
5757
resultSet = resultSet.withPrefixMatcher(prefix.substring(prefix.indexOf(SCOPE_OPERATOR) + 2));
58-
resultSet.addAllElements(PhpVariantsUtil.getLookupItems(phpClass.getFields().stream().filter(Field::isConstant).collect(Collectors.toList()), false, null));
58+
resultSet.addAllElements(PhpVariantsUtil.getLookupItems(phpClass.getFields().stream().filter(f -> f.isConstant() && f.getModifier().isPublic()).collect(Collectors.toList()), false, null));
5959
}
6060
return;
6161
}
@@ -102,7 +102,7 @@ private void addAllClasses(Collection<LookupElement> elements, Collection<PhpCla
102102
private void addAllClassConstants(Collection<LookupElement> elements, Collection<PhpClass> classes) {
103103
for (PhpClass phpClass : classes) {
104104
// All class constants
105-
List<Field> fields = Arrays.stream(phpClass.getOwnFields()).filter(Field::isConstant).collect(Collectors.toList());
105+
List<Field> fields = Arrays.stream(phpClass.getOwnFields()).filter(f -> f.isConstant() && f.getModifier().isPublic()).collect(Collectors.toList());
106106
for (PhpNamedElement field : fields) {
107107
// Foo::BAR
108108
String lookupString = phpClass.getName() + SCOPE_OPERATOR + field.getName();

0 commit comments

Comments
 (0)