[PHP] Enum must not be used as array key
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 935
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 17
Description
### Apache NetBeans version
Apache NetBeans 16
### What happened
As of PHP 8.2, object must not be used as array key. Consequently enum must not be used as array key.
### How to reproduce
```php
10, // this statement must display error
Suit::Spades => 20, // this statement must display error
$cardA => 30, // this statement must display error
$cardB => 40, // this statement must display error
$cardA->value => 50, // OK
$cardB->value => 60, // OK
];
```
### 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 provided installer
### Anything else
_No response_
### Are you willing to submit a pull request?
No
### Code of Conduct
Yes
Contributor guide
Research direction
Start by running the supplied enum array-key example in Apache NetBeans 16's PHP editor and compare the editor's diagnostics with PHP 8.2 behavior. Locate the PHP code-analysis path that handles array keys; done means all four enum-as-key cases are reported as errors while the value-based keys remain accepted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100