apache / apache/netbeans

[PHP] invalid additional arguments, and argument name is not highlighted nor clickable on named argument call site.

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

### What happened

Named arguments is php 8.0 feature, and Netbeans 15 is able to recognize it. At the moment, Netbeans is able to determine arguments whether it is positional or named argument, so Netbeans will display error mark. Unfortunately we can still inject invalid additional argument on call site. Furthermore, Netbeans does not highlight the name, nor make it clickable in order to go to the definition, nor shown the popup info.

### How to reproduce

```php
/**
* Blah ...
*/
class MyClass
{
/**
* foo bar baz
* @param int $par1 Description1
* @param string $par2 Description2
* @param bool $par3 Description3
*/
public function func1(int $par1, string $par2, bool $par3)
{
echo $par1 .", ". $par2 .", ". $par3, "\n";
}
}

$mc = new MyClass();
$mc->func1(par1: 20, par2: "hai", par3: true, parx: 30); // parx is invalid argument

// working highlight, clickable, and popup:
// try to point the cursor, or [CTRL]+click, or [CTRL]+hover on: "new MyClass()", "$mc->" or "->func1".

// highlight, clickable, and popup bugs:
// try to point the cursor, or [CTRL]+click, or [CTRL]+hover on: "par1:", "par2:", "par3:", "parx:".
```

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

### Code of Conduct

Yes

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the PHP 8 named-argument example from the issue in NetBeans 15, focusing on the PHP editor's handling of argument names at call sites. Verify the invalid additional argument is rejected and that valid and invalid names support highlighting, navigation, and popup information.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.