php type hint with specific phpDoc keyword

We're develop some tool for auto inject some dependency in php by using phpdoc annotation "@autowire @var".
ofcourse phpstorm type hint didn't work.
- Is it possible to config to able to have type hint without plugin
- If not I'm willing to create plugin, so can you guide me how to do it.
now I'm have plugin dev environment already and diging in PhpTypeProvider2, but still kind of loss.
Ex.
not work
     /** @autowire @var \Models\LstFacility */
     protected $lstFacilityModel;




work
     /**
      * @autowire
      * @var \Models\LstFacility
      */
     protected $lstFacilityModel;




Thanks,
5 comments
Comment actions Permalink

Hi there,

What exactly does not work?

PHPDoc requires to have @tag to be first in the line .. so everything after that is treated as part of that tag and not separately. Therefore this one liner will not work:

/**
* @autowire @var \Models\LstFacility
*/


But this one seems to be OK

/**
* @autowire
* @var \Models\LstFacility
*/

screen01.png

0
Comment actions Permalink

Thanks for the reply

sorry for not clearly mention

true, it about that special one liner that didn't work
so I should create some plugin for that one right?


PS. about one liner I just don't want to refactor the phpdoc everywhere because it's one of our own standard somehow.

0
Comment actions Permalink

so I should create some plugin for that one right?

I personally do not know, unfortunately.

But ... Symfony2 plugin can parse custom @tags (e.g @Route etc) .. so I would imagine that you can parse @autowire one and if something else is located on the same line (like @var) maybe you will be able to pass it for further parsing by actual PhpStorm (i.e. hide @autowire presence like it is not there at all).

I would suggest to either contact author of that plugin for some ideas (he may know more about it), or look into the plugin's code (it's open source on github) .. or wait and hope that PhpStorm dev will notice this thread and will be able to suggest anything here.

P.S.
You can always start another thread here asking that particular question (better chances for dev to spot it).

0
Comment actions Permalink

Won't fix.
@tags are NOT inline tags and should not be concatenated.
{@tags} are inline tags and can be included within other content.
https://github.com/phpDocumentor/fig-standards/blob/master/proposed/phpdoc.md#5-the-phpdoc-format
Note that Doctrine uses NESTED tags with very dereministic syntax, not multiple tags on one line.

0
Comment actions Permalink

is it still possible with create own plugin to solve this broken phpDoc annotation somehow? I hope so...

0

Please sign in to leave a comment.