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/11/10 01:29:56 UTC

[GitHub] [netbeans] junichi11 opened a new pull request, #4955: PHP 8.2 Support: Readonly classes

junichi11 opened a new pull request, #4955:
URL: https://github.com/apache/netbeans/pull/4955

   #4725
   - https://wiki.php.net/rfc/readonly_classes
   
   #### Part 1
   
   - Fix the grammar file
   - Add `PHP82UnhandledError`
   - Add/Fix unit tests for the parser, the lexter, and the index
   
   #### Part 2
   
   - Fix hints for readonly classes
   - Add the code template for a readonly class
   - Add unit tests for hints, formatter, and CC
   
   ![nb-php82-readonly-classes-syntax-and-hints](https://user-images.githubusercontent.com/738383/200976862-63686a1a-6050-4172-8644-f05b506a175f.png)
   
   ![nb-php82-readonly-classes-syntax-and-hints2](https://user-images.githubusercontent.com/738383/200976889-50aac94a-6d8f-4c63-83fe-8429c4ab996d.png)
   
   


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


[GitHub] [netbeans] junichi11 commented on pull request #4955: PHP 8.2 Support: Readonly classes

Posted by GitBox <gi...@apache.org>.
junichi11 commented on PR #4955:
URL: https://github.com/apache/netbeans/pull/4955#issuecomment-1310286246

   @tmysik Will increment the spec version.


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


[GitHub] [netbeans] junichi11 commented on pull request #4955: PHP 8.2 Support: Readonly classes

Posted by GitBox <gi...@apache.org>.
junichi11 commented on PR #4955:
URL: https://github.com/apache/netbeans/pull/4955#issuecomment-1311033401

   @tmysik Thank you for your review! I'll fix it with the next PR.


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


[GitHub] [netbeans] tmysik merged pull request #4955: PHP 8.2 Support: Readonly classes

Posted by GitBox <gi...@apache.org>.
tmysik merged PR #4955:
URL: https://github.com/apache/netbeans/pull/4955


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


[GitHub] [netbeans] tmysik commented on a diff in pull request #4955: PHP 8.2 Support: Readonly classes

Posted by GitBox <gi...@apache.org>.
tmysik commented on code in PR #4955:
URL: https://github.com/apache/netbeans/pull/4955#discussion_r1020158499


##########
php/php.editor/src/org/netbeans/modules/php/editor/model/nodes/ClassDeclarationInfo.java:
##########
@@ -93,14 +94,24 @@ public Set<QualifiedName> getInterfaceNames() {
     }
 
     public PhpModifiers getAccessModifiers() {
-        Modifier modifier = getOriginalNode().getModifier();
-
-        if (modifier.equals(Modifier.ABSTRACT)) {
-            return PhpModifiers.fromBitMask(PhpModifiers.PUBLIC, PhpModifiers.ABSTRACT);
-        } else if (modifier.equals(Modifier.FINAL)) {
-            return PhpModifiers.fromBitMask(PhpModifiers.PUBLIC, PhpModifiers.FINAL);
+        List<Integer> phpModifiers = new ArrayList<>(getOriginalNode().getModifiers().keySet().size());
+        phpModifiers.add(PhpModifiers.PUBLIC);
+        for (Modifier modifier : getOriginalNode().getModifiers().keySet()) {
+            switch (modifier) {
+                case ABSTRACT:
+                    phpModifiers.add(PhpModifiers.ABSTRACT);
+                    break;
+                case FINAL:
+                    phpModifiers.add(PhpModifiers.FINAL);
+                    break;
+                case READONLY:
+                    phpModifiers.add(PhpModifiers.READONLY);
+                    break;
+                default:
+                    break;

Review Comment:
   👍



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


[GitHub] [netbeans] tmysik commented on a diff in pull request #4955: PHP 8.2 Support: Readonly classes

Posted by GitBox <gi...@apache.org>.
tmysik commented on code in PR #4955:
URL: https://github.com/apache/netbeans/pull/4955#discussion_r1019340822


##########
php/php.editor/src/org/netbeans/modules/php/editor/model/nodes/ClassDeclarationInfo.java:
##########
@@ -93,14 +94,24 @@ public Set<QualifiedName> getInterfaceNames() {
     }
 
     public PhpModifiers getAccessModifiers() {
-        Modifier modifier = getOriginalNode().getModifier();
-
-        if (modifier.equals(Modifier.ABSTRACT)) {
-            return PhpModifiers.fromBitMask(PhpModifiers.PUBLIC, PhpModifiers.ABSTRACT);
-        } else if (modifier.equals(Modifier.FINAL)) {
-            return PhpModifiers.fromBitMask(PhpModifiers.PUBLIC, PhpModifiers.FINAL);
+        List<Integer> phpModifiers = new ArrayList<>(getOriginalNode().getModifiers().keySet().size());
+        phpModifiers.add(PhpModifiers.PUBLIC);
+        for (Modifier modifier : getOriginalNode().getModifiers().keySet()) {
+            switch (modifier) {
+                case ABSTRACT:
+                    phpModifiers.add(PhpModifiers.ABSTRACT);
+                    break;
+                case FINAL:
+                    phpModifiers.add(PhpModifiers.FINAL);
+                    break;
+                case READONLY:
+                    phpModifiers.add(PhpModifiers.READONLY);
+                    break;
+                default:
+                    break;

Review Comment:
   Don't we want to log/throw here?
   



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


[GitHub] [netbeans] junichi11 commented on pull request #4955: PHP 8.2 Support: Readonly classes

Posted by GitBox <gi...@apache.org>.
junichi11 commented on PR #4955:
URL: https://github.com/apache/netbeans/pull/4955#issuecomment-1310226266

   @tmysik Could you please have a look at this when you have time? If there is no problem, let's merge it :) Thanks!


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


[GitHub] [netbeans] tmysik commented on pull request #4955: PHP 8.2 Support: Readonly classes

Posted by GitBox <gi...@apache.org>.
tmysik commented on PR #4955:
URL: https://github.com/apache/netbeans/pull/4955#issuecomment-1311613713

   @junichi11 Nothing to thank for, really. Plenty of tests really help us here. Thanks for your great work!


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


[GitHub] [netbeans] junichi11 commented on a diff in pull request #4955: PHP 8.2 Support: Readonly classes

Posted by GitBox <gi...@apache.org>.
junichi11 commented on code in PR #4955:
URL: https://github.com/apache/netbeans/pull/4955#discussion_r1019696323


##########
php/php.editor/src/org/netbeans/modules/php/editor/model/nodes/ClassDeclarationInfo.java:
##########
@@ -93,14 +94,24 @@ public Set<QualifiedName> getInterfaceNames() {
     }
 
     public PhpModifiers getAccessModifiers() {
-        Modifier modifier = getOriginalNode().getModifier();
-
-        if (modifier.equals(Modifier.ABSTRACT)) {
-            return PhpModifiers.fromBitMask(PhpModifiers.PUBLIC, PhpModifiers.ABSTRACT);
-        } else if (modifier.equals(Modifier.FINAL)) {
-            return PhpModifiers.fromBitMask(PhpModifiers.PUBLIC, PhpModifiers.FINAL);
+        List<Integer> phpModifiers = new ArrayList<>(getOriginalNode().getModifiers().keySet().size());
+        phpModifiers.add(PhpModifiers.PUBLIC);
+        for (Modifier modifier : getOriginalNode().getModifiers().keySet()) {
+            switch (modifier) {
+                case ABSTRACT:
+                    phpModifiers.add(PhpModifiers.ABSTRACT);
+                    break;
+                case FINAL:
+                    phpModifiers.add(PhpModifiers.FINAL);
+                    break;
+                case READONLY:
+                    phpModifiers.add(PhpModifiers.READONLY);
+                    break;
+                default:
+                    break;

Review Comment:
   Will add the following. Thanks!
   ```java
                   case NONE:
                       // no-op
                       break;
                   default:
                       assert false : "Handle " + modifier + " modifier";
                       break;
   ```



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