[PHP] Converting Enum or Enum case 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
Converting Enum or Enum case to string must produce error
### How to reproduce
```php
value . "\n"; // OK (not a conversion)
$card1 = Suit1::Diamonds;
echo $card1 . "\n"; // this statement must display error
echo $card1->value . "\n"; // OK (not a conversion)
// -----------------------------------------------
enum Suit2: int {
case Hearts = 10;
case Diamonds = 20;
case Clubs = 20;
case Spades = 40;
}
echo (Suit::Hearts + Suit::Diamonds) . "\n"; // this statement must display error
echo (Suit::Hearts->value + Suit::Diamonds->value) . "\n"; // OK (not a conversion)
$card2a = Suit::Hearts;
$card2b = Suit::Diamonds;
echo ($card2a + $card2a) . "\n"; // this statement must display error
echo ($card2a->value + $card2b->value) . "\n"; // 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 provided installer
### Anything else
_No response_
### Are you willing to submit a pull request?
No
### Code of Conduct
Yes
Contributor guide
Research direction
The report names no source file, test, or entry point. Start by running the PHP examples in the issue and tracing how NetBeans' PHP support handles enum conversions and arithmetic. Done means invalid enum conversions and operations are reported as errors while explicit ->value access remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100