Magento 2 best practices say that dependency injection should be preferred to the object manager when instantiating objects.
How are we supposed to manage objects in a class that doesn't have a constructor?
Should all classes absolutely have a constructor? If no, what the best practice when there is no constructor?
Thanks a lot for your answers.
seriously, it's hard to believe there won't be any answer to this question.
I am maintaining a M2 extension I didn't create. In that extension, I have a static class with static functions called statically all over the extension.
I need to call objects in the static class in order to perform some actions.
I read everywhere that the object manager shouldn't be used to instantiate objects.
Is it fine to use the object manager in this case, or maybe a way to use dependency injection, or is there another best practice?