Location: make __construct() parameters mandatory

I did consider allowing yaw/pitch to remain optional, but considering the implicit immutability of Location, it really doesn't make any sense to create a Location with default yaw/pitch - just create a Position in that case instead.
This commit is contained in:
Dylan K. Taylor 2021-10-29 15:40:58 +01:00
parent 88b7389080
commit ee9f5e0044
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -34,7 +34,7 @@ class Location extends Position{
/** @var float */
public $pitch;
public function __construct(float $x, float $y, float $z, float $yaw = 0.0, float $pitch = 0.0, ?World $world = null){
public function __construct(float $x, float $y, float $z, float $yaw, float $pitch, ?World $world){
$this->yaw = $yaw;
$this->pitch = $pitch;
parent::__construct($x, $y, $z, $world);