apache / apache/netbeans

[PHP] Netbeans may also check inside used traits to determine if a property is used

Open
#5,329 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

private promoted property marked as unused

### How to reproduce

```php
Service->execute();
}

}

```
In this case, `$Service` is marked as unused inside `myClass` class

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

ubuntu 22.04

### JDK

OpenJDK Runtime Environment (build 17.0.5+8-Ubuntu-2ubuntu122.04) OpenJDK 64-Bit Server VM (build 17.0.5+8-Ubuntu-2ubuntu122.04, mixed mode, sharing)

### 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 with the PHP inspection responsible for marking promoted properties unused and reproduce the report with the myClass/myTrait examples in the issue. Trace how trait members are considered, then verify that $Service is recognized as used through the trait and that the false warning no longer appears.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.