[PHP] Enum assigned as a reference must produce error
- 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
Enum values can't be changed, therefore assigning enum as a reference must produce error.
### How to reproduce
```php
enum Suit: string {
case Hearts = 'H';
case Diamonds = 'D';
case Clubs = 'C';
case Spades = 'S';
}
$card = Suit::Clubs;
$ref = &$card->value; // this statement must display error
$val = $card->value; // OK (not referencing)
```
### 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 reproducing the PHP enum example in Apache NetBeans 16, focusing on the reference assignment to the enum value. Done means the reference assignment displays an error while direct, non-reference access to the value remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100