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

   - https://github.com/apache/netbeans/issues/8035
   - https://wiki.php.net/rfc#php_84
   - https://wiki.php.net/rfc/property-hooks
   
   ### PHP 8.4 Support: Property hooks (Part 1) 
   
   - Fix the lexer and parser(grammar)
   - Add `PropertyHookDeclaration` as an `ASTNode`
   - Fix `PHP5ErrorHandlerImpl` (handle missing tokens)
   - Fix/Add unit tests for the lexer and parser
   - Remove `ArrayDimensionSyntaxSuggestionHint` because this no longer works.
   
   Example:
   ```php
   class PropertyHooksClass {
       public int $backed = 100 {
           get {
               return $this->backed;
           }
           set {
               $this->backed = $value;
           }
       }
       public $doubleArrow { // virtual
           get => $this->test();
           set => $this->test() . $value;
       }
       public $attributes {
           #[Attr1] get {}
           #[Attr2] set ($value) {
               $this->attributes = $value;
           }
       }
       public $reference {
           &get => $this->reference;
       }
       public $final {
           final get => $this->final;
       }
   
       // constructor property promotion
       public function __construct(
           public $prop {
               get {
                   return $this->prop;
               }
               set {
                   $this->prop = $value;
               }
           }
       ) {}
   }
   
   class Child extends PropertyHooksClass {
       public $prop {
           get => parent::$prop::get();
           set {
               parent::$prop::set($value);
           }
       }
   }
   
   interface PropertyHooksInterface {
       public string $prop1 {
           get;
       }
       public int $prop2 {
           set;
       }
       public $prop3 {
           get;
           set;
       }
       public $ref { &get; }
   }
   ```
   
   Note: Curly braces array access (`{}` e.g. `$array{1}`, `$array{'key'}`) can 
use no longer.
   Because a conflict occurs in the following case:
   
   ```php
   "string"{1};
   public string $prop = "string" {
       get => $this->prop;
       set {}
   }
   ```
   PHP 8.4
   
   
![nb-php84-property-hooks-syntax-1](https://github.com/user-attachments/assets/19f742fe-c7ed-4107-91ca-15113e6b40c0)
   
![nb-php84-property-hooks-syntax-2](https://github.com/user-attachments/assets/8dccb099-e3ee-4563-8381-de5d8d98ebb2)
   
   PHP 8.3
   
   
![nb-php84-property-hooks-syntax-php83-1](https://github.com/user-attachments/assets/c08da804-9f98-469b-a03e-005ad3a36276)
   
![nb-php84-property-hooks-syntax-php83-2](https://github.com/user-attachments/assets/fc566c13-1990-414b-8368-4f43a730bf29)
   
   
   ### PHP 8.4 Support: Property hooks (Part 2) 
   
   - Fix the indexer and the model
   - Use JSON format as a signature for property hooks
   - Current format is semicolon separated but it's hard to add hooks to a 
field signature without JSON format
   ```json
   [
       {
           "name":"set",
           "start":3651,
           "end":3690,
           "mod":1,
           "isRef":false,
           "isAttr":false,
           "hasBody":true,
           "paramSig":"$value::0::1:1:0:0:0:0::"
       }
   ]
   ```
   
   - Add interface methods
     - `FieldElemnt.isHooked()`
     - `FieldElement.HookedFieldElemnt.isHooked()`
     - `FieldElement.HookedFieldElemnt.getPropertyHooks()`
     - `IndexScope.PHP84IndexScope.findFields()`
     - `TypeScope.FieldDeclarable.getDeclaredFields()`
     - `TypeScope.FieldDeclarable.getInheritedFields()`
     - `PropertyHookScope.isReference()`
     - `PropertyHookScope.hasBody()`
     - `PropertyHookScope.isAttributed()`
     - `PropertyHookScope.getParameterNames()`
     - `PropertyHookScope.getParameters()`
     - `PropertyHookScope.getOffsetRange()`
     - `PropertyHookElement.isReference()`
     - `PropertyHookElement.hasBody()`
     - `PropertyHookElement.isAttributed()`
     - `PropertyHookElement.getParameters()`
     - `PropertyHookElement.getOffsetRange()`
   
   - Add/Fix unit tests for the index and the model
   
   
   ### PHP 8.4 Support: Property hooks (Part 3) 
   
   - Fix the navigator
   - Fix/Add unit tests
   - Add SVG icons for a property hook, a trait, and an enum case
   
   
![nb-php84-property-hooks-navigator](https://github.com/user-attachments/assets/6e15a849-e852-4115-b51a-d262634ab2a5)
   
   
![nb-php84-property-hooks-navi-icons](https://github.com/user-attachments/assets/ebf434a4-4f2c-4074-a722-75ee2d143c4b)
   
![nb-php84-property-hooks-navi-icons-dark](https://github.com/user-attachments/assets/14a8dbe1-0ff9-45ab-812f-c1d517f4cf94)
   


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