mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-04 22:17:25 +02:00
Builder :: added missing return types
This commit is contained in:
@@ -8,13 +8,13 @@ use DesignPatterns\Creational\Builder\Parts\Vehicle;
|
||||
|
||||
interface Builder
|
||||
{
|
||||
public function createVehicle();
|
||||
public function createVehicle(): void;
|
||||
|
||||
public function addWheel();
|
||||
public function addWheel(): void;
|
||||
|
||||
public function addEngine();
|
||||
public function addEngine(): void;
|
||||
|
||||
public function addDoors();
|
||||
public function addDoors(): void;
|
||||
|
||||
public function getVehicle(): Vehicle;
|
||||
}
|
||||
|
@@ -14,19 +14,19 @@ class CarBuilder implements Builder
|
||||
{
|
||||
private Car $car;
|
||||
|
||||
public function addDoors()
|
||||
public function addDoors(): void
|
||||
{
|
||||
$this->car->setPart('rightDoor', new Door());
|
||||
$this->car->setPart('leftDoor', new Door());
|
||||
$this->car->setPart('trunkLid', new Door());
|
||||
}
|
||||
|
||||
public function addEngine()
|
||||
public function addEngine(): void
|
||||
{
|
||||
$this->car->setPart('engine', new Engine());
|
||||
}
|
||||
|
||||
public function addWheel()
|
||||
public function addWheel(): void
|
||||
{
|
||||
$this->car->setPart('wheelLF', new Wheel());
|
||||
$this->car->setPart('wheelRF', new Wheel());
|
||||
@@ -34,7 +34,7 @@ class CarBuilder implements Builder
|
||||
$this->car->setPart('wheelRR', new Wheel());
|
||||
}
|
||||
|
||||
public function createVehicle()
|
||||
public function createVehicle(): void
|
||||
{
|
||||
$this->car = new Car();
|
||||
}
|
||||
|
@@ -14,18 +14,18 @@ class TruckBuilder implements Builder
|
||||
{
|
||||
private Truck $truck;
|
||||
|
||||
public function addDoors()
|
||||
public function addDoors(): void
|
||||
{
|
||||
$this->truck->setPart('rightDoor', new Door());
|
||||
$this->truck->setPart('leftDoor', new Door());
|
||||
}
|
||||
|
||||
public function addEngine()
|
||||
public function addEngine(): void
|
||||
{
|
||||
$this->truck->setPart('truckEngine', new Engine());
|
||||
}
|
||||
|
||||
public function addWheel()
|
||||
public function addWheel(): void
|
||||
{
|
||||
$this->truck->setPart('wheel1', new Wheel());
|
||||
$this->truck->setPart('wheel2', new Wheel());
|
||||
@@ -35,7 +35,7 @@ class TruckBuilder implements Builder
|
||||
$this->truck->setPart('wheel6', new Wheel());
|
||||
}
|
||||
|
||||
public function createVehicle()
|
||||
public function createVehicle(): void
|
||||
{
|
||||
$this->truck = new Truck();
|
||||
}
|
||||
|
Reference in New Issue
Block a user