I think this should be a problem for many people (and so I hope, there is a solution.
We have a Factory in our Application. It is used like that:
$order_coo = MainFactory::create_object('Order');
So the $order_coo is an Instance of the Order-Class.
I know, that I can tell PHPStorm (or IntellJ :)) that with using PHPDoc like this:
/** @var Order $order */
$order = MainFactory::create_object('Order');
But is it possible to tell the Factory, that it will alway return an Object from the Class which is the parameter?
So I don't have to make every call from Manfactory wrap with that PHPDoc /** @var Order....