I have written this method in a parent class in order to be able to get instances of children too.
/** @return static */
public static function getInstance()
{
/** @var $instance static */
static $instance = false;
if (!$instance) {
$instance = new static();
}
return $instance;
}
When I get the instance, PhpStorm doesn't know about child class implementation (methods, constants, etc). How can I tell him about them?
In snippet I am suggesting @return and @var as methods that work in contexts that don't imply static refference.