Search code examples
phpeclipseautocompleteidephpdoc

phpdoc @var in php file


i have next php code

<?php
class A {
    public function foo() {

    }
}
/**
 * @var A $a
 */
$a->

I want to make my ide autocomplete $a-> correct, and show me that there is only one available method foo in $a. There is no any string like $a = new A(); $a instantiated in another place and handled by autoloader.


Solution

  • The following syntax works fine in eclipse

    /* @var $a A */
    $a->
    

    Note that I switched parameters order.