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/12/01 02:39:07 UTC

[GitHub] [netbeans] the-liquid-metal opened a new issue, #5037: [PHP] Cross highlighting between named arguments and constructor property promotion on call site

the-liquid-metal opened a new issue, #5037:
URL: https://github.com/apache/netbeans/issues/5037

   ### Description
   
   Named arguments and constructor property promotion are php 8.0 feature, and Netbeans 15 is able to recognize it. At the moment, Netbeans is able to highlight constructor property promotion correctly, but there is a bug within named argument as stated in #5035.
   
   Logically, if someone point the cursor to the class property, Netbeans will highlight that property both on call site and definition site (if available). The same should happen with named arguments.
   
   Recently i encountered a case where i have to manually evaluate property assignment (by constructor property promotion) in order to decide correctness of argument assignment (by named argument). This is a tricky task: use a find toolbar to find all exact string. This is less fancy than just looking up the only property or only argument occurrence.
   
   It would be invaluable if Netbeans could cross-highlight: if I point to any property in the calling site, it will highlight all properties and named argument in the constructor property promotion callsite, or vice versa.
   
   ### Use case/motivation
   
   ```php
   // definition site-----------------------------------------
   
   class ValidatorBridge {
       public function __construct(
           public Closure $intFn,
           public Closure $floatFn,
           public Closure $currencyFn,
       ) {
           // do deep validation for each property by its attributes
       }
   
       public function assignValidator(
           Closure $massValidator,
           Closure $packageValidator,
           Closure $costValidator,
       ) {}
   }
   
   // call site-----------------------------------------
   
   1234 | $vBridge = new ValidatorBridge(
   1235 |     intFn:      $x->validator(...),
   1236 |     floatFn:    $y->validator(...),
   1237 |     currencyFn: $z->validator(...),
   1238 | );
   
   // ... other codes here ...
   
   2345 | $vBridge->assignValidator(
   2346 |     massValidator:    $vBridge->floatFn,
   2347 |     packageValidator: $vBridge->intFn,
   2348 |     costValidator:    $vBridge->currencyFn,
   2349 | );
   2350 | 
   2351 | return $vBridge;
   ```
   
   I want to evaluate ```costValidator``` assignment at line 2348, so i point my cursor to ```currencyFn```,
   than Netbeans will highlight ```currencyFn``` at line 2348 and 1237.
   Finally i will judge whether ```$z->validator(...)``` is a proper validator or not.
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a pull request?
   
   No
   
   ### Code of Conduct
   
   Yes


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