apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.64k stars 846 forks source link

in PHP "?" being auto removed from typehinting #7123

Closed Eugene-Melbourne closed 4 months ago

Eugene-Melbourne commented 7 months ago

Apache NetBeans version

Apache NetBeans 21

What happened

when pressing <ctrl> + <shift> + i the "?" being removed from the type-hint

Language / Project Type / NetBeans Component

PHP

How to reproduce

create a file in your PHP project

call it "Foo.php"

content of the file

<?php
/**
 * @property ?Foo     $foo_1
 * @property Foo|null $foo_2
 */
class Foo{}

pressing <ctrl> + <shift> + i (to fix, include or clean-out files from the use section)

and you will notice that the only "?" on this file is removed, but "|null" is not removed.

I believe that "?" should not be removed on <ctrl> + <shift> + i

Did this work correctly in an earlier version?

I know that this problem existed in version 20. I suspect that it was fine in 18 or 19, but I'm not sure about it.

Operating System

Windows 10 version 10.0 running on amd64; UTF-8; en_AU (nb)

JDK

19.0.2; Java HotSpot(TM) 64-Bit Server VM 19.0.2+7-44

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

junichi11 commented 7 months ago

Not Ctrl + i but Ctrl + Shift + i Reproducible. Thanks.

Eugene-Melbourne commented 6 months ago

Thank you for the correction, I fixed the original text to reflect your note. Thank you

Eugene-Melbourne commented 6 months ago

I just noticed that "?" being auto removed not only in class declaration but also in var

<?php
class Foo{
/** @var ?Foo $foo */
}