Quantcast
Viewing all articles
Browse latest Browse all 5661

Autocomple for Objects from Factory

Hi,

 

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 Image may be NSFW.
Clik here to view.
) 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....

 

cu


Viewing all articles
Browse latest Browse all 5661

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>