Lets say I have this code:
abstract class AbstractCar {
private $car;
public function __construct(CarInterface $car)
{
$this->car = $car;
}
}
class LamboCar extends AbstractCar {
public function __construct(LamboCarInterface $car)
{
parent::__construct($car);
}
}
Question is: is overriding construct method only to change $car type from CarInterface to LamboCarInterface (LamboCarInterface extends CarInterface) bad practice? Let's say AbstractCar do call some methods from CarInterface, and LamboCar call some methods from LamboCarInterface
Aucun commentaire:
Enregistrer un commentaire