apache / apache/netbeans

[PHP] Statement after never function call might be display warning message

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

```never``` type was introduced in php 8.1 ([never](https://wiki.php.net/rfc/noreturn_type)).
Some statement after never function call might be not executed, and should display warning message just to inform user.

### How to reproduce

```php
fetchDb() ?? $gateway->thrower();
echo "after"; // this statement might be executed and SHOULD NOT display warning message.
```

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

No source file or test is identified in the report; start by reproducing both PHP examples in NetBeans 16 with PHP 8.1 and locate the existing unreachable-code warning path for never-returning calls. Done means a warning appears for the statement after redirect(), while the null-coalescing example does not produce that warning, with regression coverage for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
devtools
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.