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

   - https://github.com/apache/netbeans/issues/6703
   - Show errors when `$this` is used in static context(static methods, static 
closures, static arrow functions)
   - Add unit tests
   
   Note:
   Check only `$this` in TypeDeclarations because Frameworks may use `$this` in 
the global scope. 
   e.g. CakePHP framework can use `$this`(e.g. `$this->Html->link()`) in the 
global scope of view files.
    (see: https://book.cakephp.org/5/en/views.html)
   
   Example:
   ```php
   class Example {
       private int $field = 1;
   
       public static function staticMethod(): void {
           $this->field; // error
       }
   
       public function method(): void {
           $staticClosure = static function() {
               var_dump($this); // error
           };
           $staticArrow = static fn() => $this; // error
           echo $this->field;
       }
   }
   ```


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

Reply via email to