Open adam-openplay opened 2 weeks ago
No, it should not. Readthedocs?
Yes, it should.
No, it should not. Readthedocs?
Which docs? There's nothing I can see in either the intelephense docs or the PHPDoc docs to suggest that this shouldn't be possible.
Also, PHPStorm supports it. And yes, I know this isn't PHPStorm, but that is a very popular IDE which means a lot of my colleagues use it so there are instances of this @var
usage in our codebase that I can't take advantage of.
Maybe this should be filed under feature requests rather than bugs, but I don't think it's an unreasonable request 😄
On a second thought, it's a tricky case. @var
annotates assignment, but in essence, the syntax you use IS THE assignment.
Will look at implementing this. There's a bit of effort involved though as the parser only provides syntax nodes for statement level phpdoc. For now the workaround, as noted, is to use @param
on the ctor doc block.
Describe the bug
The
@var
PHPDoc tag doesn't work (i.e. it doesn't appear to be parsed/understood by intelephense) on promoted properties.To Reproduce
This doesn't work:
This does, but isn't as clear when the constructor has a bunch of arguments:
This also works, but then you lose out on the succinctness of promoted properties:
Expected behavior
The
@var
tag on the promoted property in the first snippet above should work in the same way as the other two, telling intelephense the type of items in the array and opening up code completion and all that jazz.Platform and version
Ubuntu 22.04.4 LTS Intelephense 1.10.4