Search code examples
phpphpstormphpdoc

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


Solution

  • 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; }
    }