I know you should now init object using new keyword as it surpasses the DI
But in few cases in core code is have observed the use of new keyword like in class module-catalog/Helper/Product
Do any one know what is difference b/w when you do
if (is_array($buyRequest)) {
$buyRequest = new \Magento\Framework\DataObject($buyRequest);
}
VS
when you create its object using constructor and use setData()
Looking difference in case of use why and When you should NEW and when should you call Via DI .