junichi11 commented on code in PR #6951:
URL: https://github.com/apache/netbeans/pull/6951#discussion_r1451488616
##########
php/php.editor/src/org/netbeans/modules/php/editor/PredefinedSymbols.java:
##########
@@ -107,13 +107,57 @@ public final class PredefinedSymbols {
"__unserialize", // NOI18N PHP 7.4
})));
+ public static final Set<String> ATTRIBUTE_NAMES =
Collections.unmodifiableSet(Attributes.ATTRIBUTE_NAMES);
+ public static final Set<String> ATTRIBUTE_FQ_NAMES =
Collections.unmodifiableSet(Attributes.ATTRIBUTE_FQ_NAMES);
+
public static enum VariableKind {
STANDARD,
THIS,
SELF,
PARENT
};
+ // https://www.php.net/manual/en/reserved.attributes.php
+ public static enum Attributes {
+ ATTRIBUTE("Attribute"), // NOI18N
+ ALLOW_DYNAMIC_PROPERTIES("AllowDynamicProperties"), // NOI18N
+ OVERRIDE("Override"), // NOI18N
+ RETURN_TYPE_WILL_CHANGE("ReturnTypeWillChange"), // NOI18N
+ SENSITIVE_PARAMETER("SensitiveParameter"), // NOI18N
+ ;
+
+ private final String name;
+ private final String fqName;
+ private final String asAttributeExpression;
+ private static final Set<String> ATTRIBUTE_NAMES = new HashSet<>();
+ private static final Set<String> ATTRIBUTE_FQ_NAMES = new HashSet<>();
+
+ static {
+ for (Attributes attribute : Attributes.values()) {
+ ATTRIBUTE_NAMES.add(attribute.getName());
+ ATTRIBUTE_FQ_NAMES.add(attribute.getFqName());
Review Comment:
Is this OK?(Instead, add attribute names via static methods)
```diff
---
a/php/php.editor/src/org/netbeans/modules/php/editor/PredefinedSymbols.java
+++
b/php/php.editor/src/org/netbeans/modules/php/editor/PredefinedSymbols.java
@@ -107,8 +107,8 @@
"__unserialize", // NOI18N PHP 7.4
})));
- public static final Set<String> ATTRIBUTE_NAMES =
Collections.unmodifiableSet(Attributes.ATTRIBUTE_NAMES);
- public static final Set<String> ATTRIBUTE_FQ_NAMES =
Collections.unmodifiableSet(Attributes.ATTRIBUTE_FQ_NAMES);
+ public static final Set<String> ATTRIBUTE_NAMES =
Collections.unmodifiableSet(Attributes.getAttributeNames());
+ public static final Set<String> ATTRIBUTE_FQ_NAMES =
Collections.unmodifiableSet(Attributes.getAttributeFQNames());
public static enum VariableKind {
STANDARD,
@@ -129,16 +129,7 @@
private final String name;
private final String fqName;
private final String asAttributeExpression;
- private static final Set<String> ATTRIBUTE_NAMES = new HashSet<>();
- private static final Set<String> ATTRIBUTE_FQ_NAMES = new
HashSet<>();
- static {
- for (Attributes attribute : Attributes.values()) {
- ATTRIBUTE_NAMES.add(attribute.getName());
- ATTRIBUTE_FQ_NAMES.add(attribute.getFqName());
- }
- }
-
private Attributes(String name) {
this.name = name;
this.fqName = "\\" + name; // NOI18N
@@ -156,8 +147,24 @@
public String asAttributeExpression() {
return asAttributeExpression;
}
+
+ private static Set<String> getAttributeNames() {
+ Set<String> names = new HashSet<>();
+ for (Attributes attribute : Attributes.values()) {
+ names.add(attribute.getName());
}
+ return names;
+ }
+ private static Set<String> getAttributeFQNames() {
+ Set<String> names = new HashSet<>();
+ for (Attributes attribute : Attributes.values()) {
+ names.add(attribute.getFqName());
+ }
+ return names;
+ }
+ }
+
private static String docURLBase;
private PredefinedSymbols() {
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
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