l00k l00k - 2 months ago 13
PHP Question

PHPDoc / PhpStorm protected members in autocomplete list

Is it possible to display protected members in autocomplete list?
For example:

class Foo
{
protected $bar;
public function __get($name) { return $this->$name; }
}

$foo = new Foo();
$foo-> // display autocomplete list with bar


I use PhpStorm 10

Answer

Use @property in class-level PHPDoc comment.

https://github.com/phpDocumentor/fig-standards/blob/master/proposed/phpdoc.md#714-property

/**
 * @property ProperTypeHere $bar [Optional description]
 */
class Foo
{
    protected $bar;
    public function __get($name) { return $this->$name; }
}
Comments