This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 258636 - "Wrong order of arguments" is sometimes wrong
Summary: "Wrong order of arguments" is sometimes wrong
Status: NEW
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: Ondrej Brejla
Depends on:
Reported: 2016-04-03 15:30 UTC by Csardelacal
Modified: 2016-04-03 15:31 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Csardelacal 2016-04-03 15:30:49 UTC
Dear Netbeans team,

First of all, big thank you for the awesome job you guys do and I would love to help contributing a little bug report / enhancement.

In Netbeans for PHP I sometimes come across the "Wrong order of parameters" warning when doing code like this:

> public function myFunc($a = 1, $b, $c);

In which case the software is correct. But there is a caveat when working with Type hints here, take for example this function:

> public function myFunc(Test$a, $b, $c)

Will trigger a warning if $a is anything but an instance of the class Test. And here is where my bug comes into play.

If I wish to allow $a to be any instance of Test or null, I need to allow it by writing the code example like this:

> public function myFunc(Test$a = null, $b, $c)

Causing Netbeans to issue a warning on the line because it says that $a is optional, while I only want PHP to accept null values for $a.

Thanks for your attention and thanks for the amazing job you guys do!