Proper use of a constructor?

In the properties record new objects, and use them heirs. Does it violate the principles of OOP?
public function __construct()
{
 $this->layout = new View('/layouts/single');
 $this->model = new Models\Catalog;
 $this->widgets = new Widgets;
 }
July 9th 19 at 12:50
1 answer
July 9th 19 at 12:52
Solution
That's fine until you start to test, then you will hit a SOLID.
public function __construct(ViewInterface $View, CatalogInterface $Catalog,WidgetsInterface $Widgets)
{
 $this->layout = $View;
 $this->model = $Catalog;
 $this->widgets = $Widgets;
 }

1. This code better to test
2. You depend on abstractions, not concrete objects

Find more questions by tags OOPPHP