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 2021/01/12 23:24:56 UTC

[GitHub] [netbeans] junichi11 opened a new pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

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


   https://issues.apache.org/jira/browse/NETBEANS-4443
   
   - https://wiki.php.net/rfc/constructor_promotion
   
   #### Part 1
   
   - Fix the parser
   - Fix the `PHP80UnhandledError`
   - Add unit tests for the parser
   
   ##### PHP 8.0
   
   ![nb-php80-constructor-property-promotion](https://user-images.githubusercontent.com/738383/104383194-cbdfb300-5572-11eb-8803-64d7c9f2e7cc.png)
   
   ##### PHP 7.4
   
   ![nb-php80-constructor-property-promotion-php74](https://user-images.githubusercontent.com/738383/104383198-cedaa380-5572-11eb-9a7b-404b6f77b2e9.png)
   
   #### Part 2
   
   - Fix the model to index promoted constructor parameters as fields
   - Add the `getModifier` method to the `ParameterElement`
   - Add unit tests for the Model, the Index, and the Navigator
   
   #### Part 3
   
   - Fix hints and SemanticAnalysis
       * InitializeFieldSuggestion (Just ignore)
       * UnusedVariableHint (Just ignore)
       * WrongOrderOfArgsHint  
       ![nb-php80-constructor-property-promotion-wrong-order-of-args-hint](https://user-images.githubusercontent.com/738383/104384977-be77f800-5575-11eb-99d8-c502cd9f805d.gif)
       * FieldRedeclarationHint  
       ![nb-php80-constructor-property-promotion-field-redeclaration1](https://user-images.githubusercontent.com/738383/104384398-bcfa0000-5574-11eb-89e6-fbc74c5e6800.png)  
       ![nb-php80-constructor-property-promotion-field-redeclaration2](https://user-images.githubusercontent.com/738383/104384497-e74bbd80-5574-11eb-9e01-5a940c431074.png)
       * SemanticAnalysis  
       ![nb-php80-constructor-property-promotion-semantic-analysis](https://user-images.githubusercontent.com/738383/104383780-b7e88100-5573-11eb-98a8-d69582e4e534.png)
   
   
   #### Part 4
   
   - Fix the code generator feature
   ![nb-php80-constructor-property-promotion-code-generator](https://user-images.githubusercontent.com/738383/104385692-0c413000-5577-11eb-89ce-7fec3947be17.gif)
   
   
   #### Part 5
   - Add unit tests for the formatting feature
   - Change the indent behavior in the following case
   ```php
   // there is no parameter
   class Test {
       public function __contruct(^){}
   }
   
   // before: don't add the new line
   class Test {
       public function __contruct(
               ^){}
   }
   
   // after: add the new line
   class Test {
       public function __contruct(
               ^
       ){}
   }
   ```
   
   ```php
   // this behavior is the same as before
   // there is a parameter
   class Test {
       public function __contruct(private int $field,^){}
   }
   
   // don't add the new line
   class Test {
       public function __contruct(private int $field,
               ^){}
   }
   
   ```
   
   #### Part 6
   
   - Fix the MarkOccurences and the GotoDeclaration features
   
   #### Part 7
   
   - Fix the Code Completion feature
   - Fix a bug of the following case for the formatter
   ````php
   // example code
   // if there is an incomplete parameter
   class Example {
       public function __construct(
               private
       ) {}
   }
   
   // result: before
   class Example {
       public function __construct(
       private
       ) {}
   }
   
   // result: after
   class Example {
       public function __construct(
               private
       ) {}
   }
   
   ```


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

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] KacerCZ commented on pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
KacerCZ commented on pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#issuecomment-759749778


   @junichi11 Wonderful work, thank you.


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

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 #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

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


   Thank you for your reviews.


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

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 change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r556167592



##########
File path: php/php.editor/src/org/netbeans/modules/php/editor/verification/WrongOrderOfArgsHint.java
##########
@@ -150,12 +150,18 @@ public String getDescription() {
         @Override
         public void implement() throws Exception {
             EditList edits = new EditList(doc);
-            OffsetRange offsetRange = getOffsetRange();
-            StringBuilder sb = new StringBuilder();
-            for (ParameterElement param : functionDeclarationInfo.getParameters()) {
-                sb.append(param.asString(OutputType.COMPLETE_DECLARATION)).append(", "); //NOI18N
+            List<FormalParameter> originalParameters = node.getFormalParameters();
+            List<ParameterElement> parameters = functionDeclarationInfo.getParameters();
+            assert originalParameters.size() == parameters.size();
+            // maybe, in the case of constructor property promotion
+            // parameters can be declared with multiple lines
+            // so, replace the rearranged parameters with positions of original parameters
+            // instead of replacing whole parameters as one line
+            for (int i = 0; i < originalParameters.size(); i++) {
+                FormalParameter originalParameter = originalParameters.get(i);
+                OffsetRange originalRange = new OffsetRange(originalParameter.getStartOffset(), originalParameter.getEndOffset());
+                edits.replace(originalRange.getStart(), originalRange.getLength(), parameters.get(i).asString(OutputType.COMPLETE_DECLARATION), false, 0);

Review comment:
       for the following case:
   ```php
   class Example {
       public function __construct(
           private string $x = "default",
           $y,
       ) {}
   }
   
   ```
   In this case, I don't think that users prefer to be recreated the parameters as one line. So, I've changed the behavior.




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

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] KacerCZ commented on pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
KacerCZ commented on pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#issuecomment-762466496


   @junichi11 Thank you for this huge change and implementing suggestions.


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

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 change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r557796860



##########
File path: php/php.editor/src/org/netbeans/modules/php/editor/verification/IncorrectConstructorPropertyPromotionHintError.java
##########
@@ -0,0 +1,210 @@
+/*
+ * 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.verification;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.netbeans.modules.csl.api.Hint;
+import org.netbeans.modules.csl.api.HintFix;
+import org.netbeans.modules.csl.api.OffsetRange;
+import org.netbeans.modules.csl.spi.support.CancelSupport;
+import org.netbeans.modules.php.editor.CodeUtils;
+import org.netbeans.modules.php.editor.model.FileScope;
+import org.netbeans.modules.php.editor.parser.PHPParseResult;
+import org.netbeans.modules.php.editor.parser.astnodes.ASTNode;
+import org.netbeans.modules.php.editor.parser.astnodes.ArrowFunctionDeclaration;
+import org.netbeans.modules.php.editor.parser.astnodes.Block;
+import org.netbeans.modules.php.editor.parser.astnodes.BodyDeclaration;
+import org.netbeans.modules.php.editor.parser.astnodes.FormalParameter;
+import org.netbeans.modules.php.editor.parser.astnodes.FunctionDeclaration;
+import org.netbeans.modules.php.editor.parser.astnodes.LambdaFunctionDeclaration;
+import org.netbeans.modules.php.editor.parser.astnodes.MethodDeclaration;
+import org.netbeans.modules.php.editor.parser.astnodes.visitors.DefaultVisitor;
+import org.openide.filesystems.FileObject;
+import org.openide.util.NbBundle;
+
+/**
+ * Handle incorrect declaration of Constructor Property Promotion.
+ */
+public class IncorrectConstructorPropertyPromotionHintError extends HintErrorRule {
+
+    private FileObject fileObject;
+
+    @Override
+    @NbBundle.Messages("IncorrectConstructorPropertyPromotionHintError.displayName=Incorrect Declaration of Constructor Property Promotion")
+    public String getDisplayName() {
+        return Bundle.IncorrectConstructorPropertyPromotionHintError_displayName();
+    }
+
+    @Override
+    @NbBundle.Messages({
+        "IncorrectConstructorPropertyPromotionHintError.abstract.desc=Can't declare a promoted property in an abstract constructor.",
+        "IncorrectConstructorPropertyPromotionHintError.non.constructor.desc=Can't declare a promoted property in other than a constructor.",

Review comment:
       Will fix it to "can't declare a promoted property in a function/method other than a constructor".

##########
File path: php/php.editor/test/unit/src/org/netbeans/modules/php/editor/verification/IncorrectConstructorPropertyPromotionHintErrorTest.java
##########
@@ -0,0 +1,48 @@
+/*
+ * 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.verification;
+
+
+public class IncorrectConstructorPropertyPromotionHintErrorTest extends PHPHintsTestBase {
+
+    public IncorrectConstructorPropertyPromotionHintErrorTest(String testName) {
+        super(testName);
+    }
+
+    @Override
+    protected String getTestDirectory() {
+        return TEST_DIRECTORY + "IncorrectConstructorPropertyPromotionHintError/";
+    }
+
+    public void testCorrectDeclarations() throws Exception {
+        checkHints(new IncorrectConstructorPropertyPromotionHintError(), "testCorrectDeclarations.php");
+    }
+
+    public void testAbstractConstructor() throws Exception {
+        checkHints(new IncorrectConstructorPropertyPromotionHintError(), "testAbstructConstructor.php");

Review comment:
       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.

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 change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r559208210



##########
File path: php/php.editor/test/unit/data/testfiles/completion/lib/tests225089/tests225089.php.testUseCase2.completion
##########
@@ -18,5 +18,8 @@ KEYWORD    mixed                                      null
 KEYWORD    null                                       null
 KEYWORD    object                                     null
 KEYWORD    parent                                     null
+KEYWORD    private                                    null
+KEYWORD    protected                                  null
+KEYWORD    public                                     null

Review comment:
       Yes, it is. The caret(`^`) position is in `__construct()` and there is no parameters.
   ```php
   
   namespace Froo {
       class Bar {}
   }
   
   namespace Trest {
       class TestClass {
           public function __construct(
   
           /* comment */
   ^
           ){}
   
           public function testMethod(
   
           // 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.

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] KacerCZ commented on a change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
KacerCZ commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r556822690



##########
File path: php/php.editor/src/org/netbeans/modules/php/editor/typinghooks/PhpTypedBreakInterceptor.java
##########
@@ -159,9 +159,14 @@ public void insert(MutableContext context) throws BadLocationException {
                         PHPTokenId.PHP_LINE_COMMENT));
                 if (helpToken.id() == PHPTokenId.PHP_TOKEN
                         && (helpToken.text().charAt(0) == ',' || helpToken.text().charAt(0) == '(' || helpToken.text().charAt(0) == '[') && ts.movePrevious()) {
-                    // only in array declaration we will add new line
+                    // e.g.
+                    // $array = [^];
+                    // $array = array(^);
+                    // function something(^){};
                     if (helpToken.text().charAt(0) == '[') {
                         sb.append("\n"); // NOI18N
+                    } else if (helpToken.text().charAt(0) == '(') {
+                        sb.append("\n"); // NOI18N

Review comment:
       This is handy, because commonly used formatting of multiline arguments is 
   
   ```php
   function (
       $param1,
       $param2,
   ): void {
       // function body
   }
   ```




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

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] KacerCZ commented on pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
KacerCZ commented on pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#issuecomment-761589622


   While I was playing with this feature I noticed, that modifiers are displayed in parameter tooltip (press Ctrl+P in parentheses) and in code completion.
   
   It does not break anything. I just think it does not need to be displayed - for object creation it is irrelevant if constructor parameter is normal parameter or promoted property.
   
   ![promoted_property_modifier](https://user-images.githubusercontent.com/4249184/104816738-4df30480-581d-11eb-99d6-95fa59283172.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.

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 change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r556165037



##########
File path: php/php.editor/tools/ASTPHP5Parser.cup
##########
@@ -2328,56 +2329,73 @@ attributes:attributes parameter:param
 :}
 ;
 
-parameter ::=
-optional_class_type_without_static:classType is_variadic:isVariadic T_VARIABLE:var
-{:
-    int start = classType == null ? (isVariadic ? isVariadicleft : varleft) : classTypeleft;
-    Variable v = new Variable(varleft, varright, var);
-        Expression argument = v;
-        if (isVariadic) {
-            argument = new Variadic(isVariadicleft, varright, v);
-        }
-    FormalParameter parameter = new FormalParameter(start, varright, classType, argument);
-    RESULT = parameter;
-:}
-
-| optional_class_type_without_static:classType T_REFERENCE:ref T_VARIABLE:var
+optional_visibility_modifier ::=
+constant_modifiers:modifier
 {:
-    int start = classType == null ? refleft : classTypeleft;
-    Variable v = new Variable(varleft, varright, var);
-    Reference ref_var = new Reference (refleft, varright, v);
-    FormalParameter parameter = new FormalParameter(start, varright, classType, ref_var);
-    RESULT = parameter;
-:}
-
-| optional_class_type_without_static:classType T_REFERENCE:ref T_ELLIPSIS:ell T_VARIABLE:var
-{:
-    int start = classType == null ? refleft : classTypeleft;
-    Variable v = new Variable(varleft, varright, var);
-    Variadic variadic = new Variadic(ellleft, varright, v);
-    Reference ref_var = new Reference (refleft, varright, variadic);
-    FormalParameter parameter = new FormalParameter(start, varright, classType, ref_var);
-    RESULT = parameter;
+    RESULT = modifier;
 :}
+;
 
-| optional_class_type_without_static:classType is_variadic:isVariadic T_VARIABLE:var T_EQUAL static_scalar:scalar
+parameter ::=
+optional_visibility_modifier:modifier optional_class_type_without_static:classType is_reference:isReference is_variadic:isVariadic T_VARIABLE:var

Review comment:
       Combined a few cases into one.




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

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] KacerCZ commented on pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
KacerCZ commented on pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#issuecomment-759772580


   I tested your changes as described in first post and it works without any problems.
   
   I also went through RFC and tried unsupported usages.
   * Usage of `var` modifier is not allowed - syntax error is shown - OK.
   
   Following usages were not recognized as errors. None of them is deal-breaker.
   * None if wrong modifier usage is not recognized as error. Sample code from RFC:
   ```php
   // Error: Not a constructor.
   function test(private $x) {}
    
   abstract class Test {
       // Error: Abstract constructor.
       abstract public function __construct(private $x);
   }
    
   interface Test {
       // Error: Abstract constructor.
       public function __construct(private $x);
   }
   ```
   
   * Promoted property can not have type `callable` - no error is shown and code completion offers `callable` after visibility.
   ```php
   class Test {
       public function __construct(public callable $callback) {}
   }
   ```
   
   Promoted property can't be variadric - no error is shown.
   ``` php
   class Test {
       public function __construct(public string ...$strings) {}
   }
   ```


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

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 #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

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


   > It does not break anything. I just think it does not need to be displayed - for object creation it is irrelevant if constructor parameter is normal parameter or promoted property.
   
   Will improve it. We should consider showing visibility modifiers only when we declare the promoted parameters. 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.

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 #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

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


   Will add this 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.

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 merged pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
junichi11 merged pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674


   


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

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 change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
tmysik commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r559092168



##########
File path: php/php.editor/test/unit/data/testfiles/completion/lib/tests225089/tests225089.php.testUseCase2.completion
##########
@@ -18,5 +18,8 @@ KEYWORD    mixed                                      null
 KEYWORD    null                                       null
 KEYWORD    object                                     null
 KEYWORD    parent                                     null
+KEYWORD    private                                    null
+KEYWORD    protected                                  null
+KEYWORD    public                                     null

Review comment:
       Is this expected? Perhaps this is what @KacerCZ mentioned, right?
   




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

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 #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

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


   @KacerCZ Yes. I know them. I'm going to improve them later.


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

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] KacerCZ commented on a change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
KacerCZ commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r556818570



##########
File path: php/php.editor/src/org/netbeans/modules/php/editor/verification/WrongOrderOfArgsHint.java
##########
@@ -150,12 +150,18 @@ public String getDescription() {
         @Override
         public void implement() throws Exception {
             EditList edits = new EditList(doc);
-            OffsetRange offsetRange = getOffsetRange();
-            StringBuilder sb = new StringBuilder();
-            for (ParameterElement param : functionDeclarationInfo.getParameters()) {
-                sb.append(param.asString(OutputType.COMPLETE_DECLARATION)).append(", "); //NOI18N
+            List<FormalParameter> originalParameters = node.getFormalParameters();
+            List<ParameterElement> parameters = functionDeclarationInfo.getParameters();
+            assert originalParameters.size() == parameters.size();
+            // maybe, in the case of constructor property promotion
+            // parameters can be declared with multiple lines
+            // so, replace the rearranged parameters with positions of original parameters
+            // instead of replacing whole parameters as one line
+            for (int i = 0; i < originalParameters.size(); i++) {
+                FormalParameter originalParameter = originalParameters.get(i);
+                OffsetRange originalRange = new OffsetRange(originalParameter.getStartOffset(), originalParameter.getEndOffset());
+                edits.replace(originalRange.getStart(), originalRange.getLength(), parameters.get(i).asString(OutputType.COMPLETE_DECLARATION), false, 0);

Review comment:
       Yes, this is more user friendly.
   If user spends time splitting parameters on separate line then it is better to keep the formatting after reordering parameters.
   




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

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 edited a comment on pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
junichi11 edited a comment on pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#issuecomment-759915102


   Will add it to this 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.

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 #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

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


   @junichi11 Great job done!


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

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 change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r559207001



##########
File path: php/php.editor/src/org/netbeans/modules/php/editor/verification/WrongOrderOfArgsHint.java
##########
@@ -150,12 +150,18 @@ public String getDescription() {
         @Override
         public void implement() throws Exception {
             EditList edits = new EditList(doc);
-            OffsetRange offsetRange = getOffsetRange();
-            StringBuilder sb = new StringBuilder();
-            for (ParameterElement param : functionDeclarationInfo.getParameters()) {
-                sb.append(param.asString(OutputType.COMPLETE_DECLARATION)).append(", "); //NOI18N
+            List<FormalParameter> originalParameters = node.getFormalParameters();
+            List<ParameterElement> parameters = functionDeclarationInfo.getParameters();
+            assert originalParameters.size() == parameters.size();

Review comment:
       Will fix it. Thank you!




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

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 #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

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


   Merging.


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

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 change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r556220361



##########
File path: php/php.editor/src/org/netbeans/modules/php/editor/typinghooks/PhpTypedBreakInterceptor.java
##########
@@ -159,9 +159,14 @@ public void insert(MutableContext context) throws BadLocationException {
                         PHPTokenId.PHP_LINE_COMMENT));
                 if (helpToken.id() == PHPTokenId.PHP_TOKEN
                         && (helpToken.text().charAt(0) == ',' || helpToken.text().charAt(0) == '(' || helpToken.text().charAt(0) == '[') && ts.movePrevious()) {
-                    // only in array declaration we will add new line
+                    // e.g.
+                    // $array = [^];
+                    // $array = array(^);
+                    // function something(^){};
                     if (helpToken.text().charAt(0) == '[') {
                         sb.append("\n"); // NOI18N
+                    } else if (helpToken.text().charAt(0) == '(') {
+                        sb.append("\n"); // NOI18N

Review comment:
       I think the users prefer to add a new line if there is no parameter. So, I've changed the behavior.
   ```php
   // there is no parameter
   // ^: caret position
   class Example {
       public function __contruct(^){}
   }
   
   // before: don't add the new line
   class Example {
       public function __contruct(
               ^){}
   }
   
   // after: add the new line
   class Example {
       public function __contruct(
               ^
       ){}
   }
   ```




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

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 change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r556217131



##########
File path: php/php.editor/src/org/netbeans/modules/php/editor/parser/astnodes/FieldsDeclaration.java
##########
@@ -78,6 +78,54 @@ public static FieldsDeclaration create(FieldsDeclaration declaration, List<Attri
         );
     }
 
+    /**
+     * Convert from FormalParameter to FieldsDeclaration.
+     *
+     * @param parameter
+     * @return the FieldsDeclaration, can be {@code null} if the parameter
+     * doesn't have a visibility modifier.
+     */
+    @CheckForNull
+    public static FieldsDeclaration create(FormalParameter parameter) {

Review comment:
       Convert from FormalParameter to FiledsDeclaration if needed.
   e.g. Scan a converted one in a visitor.




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

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 #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

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


   @tmysik I'm sorry for the huge change...


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

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] KacerCZ commented on a change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
KacerCZ commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r557761740



##########
File path: php/php.editor/src/org/netbeans/modules/php/editor/verification/IncorrectConstructorPropertyPromotionHintError.java
##########
@@ -0,0 +1,210 @@
+/*
+ * 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.verification;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.netbeans.modules.csl.api.Hint;
+import org.netbeans.modules.csl.api.HintFix;
+import org.netbeans.modules.csl.api.OffsetRange;
+import org.netbeans.modules.csl.spi.support.CancelSupport;
+import org.netbeans.modules.php.editor.CodeUtils;
+import org.netbeans.modules.php.editor.model.FileScope;
+import org.netbeans.modules.php.editor.parser.PHPParseResult;
+import org.netbeans.modules.php.editor.parser.astnodes.ASTNode;
+import org.netbeans.modules.php.editor.parser.astnodes.ArrowFunctionDeclaration;
+import org.netbeans.modules.php.editor.parser.astnodes.Block;
+import org.netbeans.modules.php.editor.parser.astnodes.BodyDeclaration;
+import org.netbeans.modules.php.editor.parser.astnodes.FormalParameter;
+import org.netbeans.modules.php.editor.parser.astnodes.FunctionDeclaration;
+import org.netbeans.modules.php.editor.parser.astnodes.LambdaFunctionDeclaration;
+import org.netbeans.modules.php.editor.parser.astnodes.MethodDeclaration;
+import org.netbeans.modules.php.editor.parser.astnodes.visitors.DefaultVisitor;
+import org.openide.filesystems.FileObject;
+import org.openide.util.NbBundle;
+
+/**
+ * Handle incorrect declaration of Constructor Property Promotion.
+ */
+public class IncorrectConstructorPropertyPromotionHintError extends HintErrorRule {
+
+    private FileObject fileObject;
+
+    @Override
+    @NbBundle.Messages("IncorrectConstructorPropertyPromotionHintError.displayName=Incorrect Declaration of Constructor Property Promotion")
+    public String getDisplayName() {
+        return Bundle.IncorrectConstructorPropertyPromotionHintError_displayName();
+    }
+
+    @Override
+    @NbBundle.Messages({
+        "IncorrectConstructorPropertyPromotionHintError.abstract.desc=Can't declare a promoted property in an abstract constructor.",
+        "IncorrectConstructorPropertyPromotionHintError.non.constructor.desc=Can't declare a promoted property in other than a constructor.",

Review comment:
       @junichi11 It seems that word "function" is missing in this sentence.
   "Can't declare a promoted property in other function than a constructor."




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

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 change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
junichi11 commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r556167592



##########
File path: php/php.editor/src/org/netbeans/modules/php/editor/verification/WrongOrderOfArgsHint.java
##########
@@ -150,12 +150,18 @@ public String getDescription() {
         @Override
         public void implement() throws Exception {
             EditList edits = new EditList(doc);
-            OffsetRange offsetRange = getOffsetRange();
-            StringBuilder sb = new StringBuilder();
-            for (ParameterElement param : functionDeclarationInfo.getParameters()) {
-                sb.append(param.asString(OutputType.COMPLETE_DECLARATION)).append(", "); //NOI18N
+            List<FormalParameter> originalParameters = node.getFormalParameters();
+            List<ParameterElement> parameters = functionDeclarationInfo.getParameters();
+            assert originalParameters.size() == parameters.size();
+            // maybe, in the case of constructor property promotion
+            // parameters can be declared with multiple lines
+            // so, replace the rearranged parameters with positions of original parameters
+            // instead of replacing whole parameters as one line
+            for (int i = 0; i < originalParameters.size(); i++) {
+                FormalParameter originalParameter = originalParameters.get(i);
+                OffsetRange originalRange = new OffsetRange(originalParameter.getStartOffset(), originalParameter.getEndOffset());
+                edits.replace(originalRange.getStart(), originalRange.getLength(), parameters.get(i).asString(OutputType.COMPLETE_DECLARATION), false, 0);

Review comment:
       for the following case:
   ```php
   class Example {
       public function __construct(
           private string $x = "default",
           $y,
       ) {}
   }
   
   ```
   In this case, I think that users don't prefer to be recreated the parameters as one line. So, I've changed the behavior.




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

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 #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

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


   @junichi11 
   
   Thanks a LOT for your GREAT work! This is so big change that we really need to rely mainly  on our tests - this is not bad, actually, it great that we have them.
   
   Note: personally, I would be against this change in PHP, definitely.
   


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

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 change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
tmysik commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r559091798



##########
File path: php/php.editor/src/org/netbeans/modules/php/editor/verification/WrongOrderOfArgsHint.java
##########
@@ -150,12 +150,18 @@ public String getDescription() {
         @Override
         public void implement() throws Exception {
             EditList edits = new EditList(doc);
-            OffsetRange offsetRange = getOffsetRange();
-            StringBuilder sb = new StringBuilder();
-            for (ParameterElement param : functionDeclarationInfo.getParameters()) {
-                sb.append(param.asString(OutputType.COMPLETE_DECLARATION)).append(", "); //NOI18N
+            List<FormalParameter> originalParameters = node.getFormalParameters();
+            List<ParameterElement> parameters = functionDeclarationInfo.getParameters();
+            assert originalParameters.size() == parameters.size();

Review comment:
       Nitpick: maybe better as:
   
   ```
   assert originalParameters.size() == parameters.size() : originalParameters.size() + " != " + parameters.size();
   ```
   
   Or similarly, of course.
   




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

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] KacerCZ commented on a change in pull request #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

Posted by GitBox <gi...@apache.org>.
KacerCZ commented on a change in pull request #2674:
URL: https://github.com/apache/netbeans/pull/2674#discussion_r557762609



##########
File path: php/php.editor/test/unit/src/org/netbeans/modules/php/editor/verification/IncorrectConstructorPropertyPromotionHintErrorTest.java
##########
@@ -0,0 +1,48 @@
+/*
+ * 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.verification;
+
+
+public class IncorrectConstructorPropertyPromotionHintErrorTest extends PHPHintsTestBase {
+
+    public IncorrectConstructorPropertyPromotionHintErrorTest(String testName) {
+        super(testName);
+    }
+
+    @Override
+    protected String getTestDirectory() {
+        return TEST_DIRECTORY + "IncorrectConstructorPropertyPromotionHintError/";
+    }
+
+    public void testCorrectDeclarations() throws Exception {
+        checkHints(new IncorrectConstructorPropertyPromotionHintError(), "testCorrectDeclarations.php");
+    }
+
+    public void testAbstractConstructor() throws Exception {
+        checkHints(new IncorrectConstructorPropertyPromotionHintError(), "testAbstructConstructor.php");

Review comment:
       Typo in "testAbstructConstructor.php" -> "testAbstractConstructor.php"




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

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 #2674: [NETBEANS-4443] PHP 8.0 Support: Constructor Property Promotion

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


   @junichi11 @KacerCZ 
   
   Let's resolve the comments here and merge it. Thank you, guys!
   


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

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