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

   ### Apache NetBeans version
   
   Apache NetBeans 18
   
   ### What happened
   
   Accessing property with array syntax other than class which implements 
ArrayAccess must produce error.
   
   ### How to reproduce
   
   ```php
   <?php
   declare(strict_types=1);
   
   class MyArrayAccess implements ArrayAccess {
       private $container = [];
   
       public function offsetExists(mixed $offset): bool {
           return isset($this->container[$offset]);
       }
   
       public function offsetGet(mixed $offset): mixed {
           return $this->container[$offset] ?? null;
       }
   
       public function offsetSet(mixed $offset, mixed $value): void {
           if (is_null($offset)) {
               $this->container[] = $value;
           } else {
               $this->container[$offset] = $value;
           }
       }
   
       public function offsetUnset(mixed $offset): void {
           unset($this->container[$offset]);
       }
   }
   
   $a = MyArrayAccess;
   $a[] = "foo";       // OK
   $a["bar"] = "baz";  // OK
   echo $a["bar"];     // OK
   
   $b = new stdClass;
   $b[] = "foo";       // this statement must display error
   $b["bar"] = "baz";  // this statement must display error
   echo $b["bar"];     // this statement must display error
   
   // 
----------------------------------------------------------------------------
   
   function test(ArrayAccess $argArrayAccess, object $argObject) {
       $argArrayAccess[] = "foo";       // OK
       $argArrayAccess["bar"] = "baz";  // OK
       echo $argArrayAccess["bar"];     // OK
   
       $argObject[] = "foo";       // this statement must display error
       $argObject["bar"] = "baz";  // this statement must display error
       echo $argObject["bar"];     // this statement must display error
   }
   ```
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   Windows 10
   
   ### JDK
   
   Java: 14.0.1; Java HotSpot(TM) 64-Bit Server VM 14.0.1+7 Runtime: Java(TM) 
SE Runtime Environment 14.0.1+7
   
   ### Apache NetBeans packaging
   
   Apache NetBeans binary zip
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request?
   
   No


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