Is there a way to have an annotation for a class member that isn't declared explicitly? Like
class Foo
{
/** @var string $bar */
// public $bar; // <--- without this line
...other stuff...
}
Background: I use __get
to provide virtual properties for my class and want these properties to appear in the phpstorm/idea autocomplete box.
Use the @property
* annotation on the class.
/**
* @property string $bar
*/
class Foo {}
*or @property-read
or @property-write
as appropriate.