apache / apache/netbeans

[PHP] Accessing instance and static property on enum directly must produce error

Open
#5,080 0 comments 0 reactions 0 assignees View on GitHub
kind:feature PHP
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

Since Enum must not has any property, instance and and static property call must produce error message. As a note, Netbeans already capable displaying error on enum property definition.

### How to reproduce

```php
propInt ."\n";
echo $card->propFloat ."\n";
$card->propInt = 10;
$card->propFloat = 20.34;
```

related issue: [Accessing undeclared static property must produce error](https://github.com/apache/netbeans/issues/6019)

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

Open the contributing guide

Research direction

Start by reproducing the issue with the PHP enum snippet in the report and inspect the NetBeans PHP diagnostics for direct static and instance property access. Done means those accesses produce errors consistently, alongside the already reported errors for property declarations.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.