开发者

Eclipse completions - @var (PHPDoc) question

I have strange problem.

When I use @return Model\Article in the model-loading method then I see the model's methods in autocomplete of Eclipse.

The model-loading method returns more objects so I want it to @return My\BaseModel and then put the /* @var $model Model\Article */ for开发者_开发技巧 each model specificaly (when I use it).

The problem is that the @return Model\Article works well (I see Model\Article + My\BaseModel methods) but the other way (@return My\BaseModel and inline /*...*/) doesn't - it say's 'No completions available'.

I tried to place the inline comment before and after the $model = ...;, but neither worked.

I'm sorry for my bad English - I hope you understand.

Thank you for any kind of help, best regards, Jakub Chábek.


Chronial: we did something wrong ...

All: here is bug report with same problem, but it is solved - I tried it and it works!

Here is working example:

namespace test {
    class AAA {

        /**
         * 
         * @return \test\AAA
         */
        static function getInstance() {
            return new static ();
        }
    }
}
namespace test2 {
    class BBB extends \test\AAA {
        /**
         * 
         * @return \test2\BBB
         */
        function showme() {
        }
    }
}

namespace test3 {
    $aaa = \test2\BBB::getInstance ();
    /* @var $aaa \test2\BBB */
    $aaa->
}

So there must be an misstake on my side ... but can't really find it :D


I've had problems with that before, too. Never found an easy and clean solution. When you are really desperate for code-completion, place an assignment at a position that will never be reached:

if (false) $myVar = new MyClass();

Eclipse will not realize that this code will never be executed and give you the appropriate code-completion.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜