This is more abstract question then specific problem.
Why auto-generated factories in magento do not implements any common interface?
And what bothers me maybe more. Why auto-generated factories doesn't extend each other, so they could be properly passed as arguments.
For example. I have class MagicClass
.
Then I make a class class MoreMagicClass extends MagicClass
.
By my opinion auto-generated MoreMagicClassFactory
should extend MagicClassFactory
.
So when i have another class with constructor that looks like this __construct(MagicClassFactory $magicClassFactory)
, I could pass the childs factory as well.
I would like to make that as a feature request, but I suspects, there is a good reason, why the auto-generated factories does not behave the way i would like to.
So, is there a reason?
EDIT:
I made feature request on Magento official forum.