apache / apache/netbeans

[PHP] Accessing undeclared/inaccessible class constant must produce error

Open
#6,036 0 comments 0 reactions 0 assignees View on GitHub
kind:feature needs:triage PHP
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 18

### What happened

Accessing undeclared/inaccessible class constant must produce error.

### How to reproduce

```php
fnInstance();
myFunc($ins1);

$ins2 = new MyClass2;
$ins2::fnStatic();
$ins2->fnInstance();
```

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

### Anything else

_No response_

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied PHP example in Apache NetBeans 18 and observe which class-constant accesses receive diagnostics. Trace the PHP editor's handling of declared, inaccessible, and undefined constants; done means invalid accesses are reported while the marked valid accesses are not.

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.