[PhpStorm 2.0] Autocompletion and Doc Blocks issue
Hi,
I ask here before creating an issue in the tracker because maybe i'm the one who is doing something wrong :)
Use case :
http://pastie.org/1601564
Here PhpStorm don't know how to reach declarations and implementations of $this->getNewsRepository()->getListForArchive(...).
But in the getter i use correctly a @return tag so it should consider it and recognize the referenced interface.
Any idea ?
Thanks,
Benjamin.
Please sign in to leave a comment.
Hi Benjamin,
If I understand correctly you are having problems with getNewsRepository method. If so -- put your cursor over getNewsRepository (declaration or usage) and invoke View | Quick Documentation Lookup (Ctrl+Q). Now check which return type PhpStorm detects (alternatively you can use Structure panel for this purpose).
I may be wrong here, but I see \NewsModule\Controller\NewsRepositoryInterface instead of \NewsModule\Repository\NewsRepositoryInterface (class/interface was name resolved relative to current namespace).
If that is correct, then the change below should do the job:
Yeah, that works, but the behavior i'm talking about should be handled too.
With namespaces, my guess is that if you don't specify the "\" root it should consider first the used namespaces in the "use" statements. So @return NewsRepository should refer to the used namespace since i explicitly define the full use statement.
That makes even more sense because even with the full qualified namespace in the @return tag, PhpStorm can't reach the implementation of the interface, for IMO, exactly the same reason.
Here is a sample of the interface implementation :
The code is correct according to PHP5.3 namespaces recipes, but PhpStorm can't reach the implementation, only the declaration, that's really too bad, and over this, it is a lack :)
Benjamin.
I do not have much experience with namespaces therefore cannot really advice on what is correct and what is not (I gave my thoughts on the original issue but that is about it).
In my opinion you can safely submit new ticket on issue Tracker.