Search code examples
phpeclipsevariablesphpdocphpeclipse

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.


Solution

  • 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