You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/06/06 14:44:19 UTC
[GitHub] [netbeans] tmysik commented on a diff in pull request #4169: PHP 8.1: Support for the special property(value) of BackedEnum #4066
tmysik commented on code in PR #4169:
URL: https://github.com/apache/netbeans/pull/4169#discussion_r890226580
##########
php/php.editor/src/org/netbeans/modules/php/editor/completion/PHPCodeCompletion.java:
##########
@@ -1482,6 +1482,20 @@ public boolean isAccepted(PhpElement element) {
// XXX currently, only when mixins are used directly in the class. should support all cases?
accessibleTypeMembers.addAll(request.index.getAccessibleMixinTypeMembers(typeScope, enclosingType));
}
+ } else if (typeScope instanceof EnumElement) {
+ // add methods of BackedEnum/UnitEnum interface
+ EnumElement enumElement = (EnumElement) typeScope;
+ String enumInterfaceName = enumElement.getBackingType() != null ? "\\BackedEnum" : "\\UnitEnum"; // NOI18N
+ final NameKind nameQuery = NameKind.exact(QualifiedName.create(enumInterfaceName));
+ Set<InterfaceElement> enums = request.index.getInterfaces(nameQuery);
+ for (InterfaceElement backedEnum : enums) {
+ accessibleTypeMembers.addAll(request.index.getAccessibleTypeMembers(backedEnum, backedEnum));
+ }
+ if (enumElement.getBackingType() != null
+ && !enumElement.getBackingType().toString().isEmpty()
Review Comment:
Calling `toString()` can be sometime expensive; could we store it in a variable, please?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists