PhpStorm automatic understanding of magic methods
Hi, Community.
Our classes don't have explictic getPropertyName() and setPropertyName() methods. Instead we're using trait, which implements combination of magic __get(), __set() and __call() methods, so, we can have following as result:
class Device {
use ModelAttributes;
/**
* @var \string
*/
protected $title;
/**
* @var \string
*/
protected $subtitle;
}
$device = new Device();
$device->setTitle('PC');
$device->getTitle();
But the problem is, that now PhpStorm can't recognize and highlights these methods.
I know, that I can add @method string getTitle() into class phpDoc, but this will mean, that I need again to add all get-ers and set-ers, but in form of phpDoc commetns, and I want to avoid this manual work.
It would be really great, if I could do something like:
/**
* @var \string
* @get
* @set
*/
protected $title;
Does someone have experience with such situation? Maybe, it can be done by creating plugin or command line tool?
请先登录再写评论。
Ok, I found this issue in a bugtracker: http://youtrack.jetbrains.com/issue/WI-19869
http://youtrack.jetbrains.com/issue/WI-19869So you can vote, if you're looking for same solution, as me.