apache / apache/netbeans

[PHP] Reserved words must not be used as class name

Open
#5,079 1 comment 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

```never```, ```mixed```, and may be other reserved words, still can be used as class name.

### How to reproduce

```php
// these statements MUST display error message.
class never {};
class mixed {};

// --- OR: ------------------------------
namespace {
class never {}
class mixed {}
}
```

### 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 PHP editor or parser behavior with the `never` and `mixed` class declarations shown in the issue. Trace the validation entry point for class names and add coverage for both declarations; done means each is reported as an error, including inside the shown namespace form.

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.