Typehinting countables in PHP with /** @var Collection<int,bool> $collection */
Apache NetBeans version
Apache NetBeans 21
What happened
/** @var Collection<int,bool> $collection */
This form of typehint is new way for countables in PHP
I understand it may be too difficult to look inside of these "<"">" and analyze it,
but can you please make typehinting to ignore only the contents of it, instead of ignoring all the whole typehinting comment?
Language / Project Type / NetBeans Component
PHP project
How to reproduce
<?php
use ArrayAccess;
class Collection implements ArrayAccess
{}
/** @var Collection $a*/
/** @var Collection<int,int> $b*/
$b->
Use this code in a file and press <strl>+<space> after ->
you will see no suggestions related to Collection class, however, if you replace
$b-> with $a-> you get a few suggestions related to ArrayAccess interface.
I believe the same suggestions should be provided in both cases "$b->" and "$a->".
I mean you can ignore everything within <...> but still use the rest from /** @var ... $b*/
Did this work correctly in an earlier version?
No / Don't know
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
I appreciate your expert opinion, but I'm confused by you changing the "kind" of this ticket from "bug" to "feature".
If I were to request a feature I would prefer the typehints from < and > to be parsed, but I'm not asking for it. It would be too much to ask. I'm asking for a little change, just to ignore these (< and >) to keep the code compatible with phpstan and still useful at some point for Netbeans IDE.
I'm afraid it will never be done if mark this bug as a feature.
That pattern has not been implemented yet. So, it's not a bug. NB does not recognize it as a vardoc tag if a type has <> now. We have to fix the lexer.
I mean you can ignore everything within <...> but still use the rest from
@junichi11 hi, would it be very difficult to ignore them until there is support?
- Also: #3524
@parallels999 Currently, I'm working on another feature. My(Our) time is limited, so I can't promise anything, sorry...
Army of one, working thanklessly, is understandable, thanks for your work I would like to be able to help with that, but it is far beyond my knowledge.