From 130c55d9f1c3b350c2767f7656366e08a63cf1ad Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 15 Jun 2020 23:58:11 +0100 Subject: [PATCH] EntityLink: remove rogue default ctor parameters --- .../network/mcpe/NetworkBinaryStream.php | 14 ++++++-------- .../network/mcpe/protocol/types/EntityLink.php | 2 +- tests/phpstan/configs/l8-baseline.neon | 15 --------------- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/pocketmine/network/mcpe/NetworkBinaryStream.php b/src/pocketmine/network/mcpe/NetworkBinaryStream.php index ccee8fe54..0586f0e17 100644 --- a/src/pocketmine/network/mcpe/NetworkBinaryStream.php +++ b/src/pocketmine/network/mcpe/NetworkBinaryStream.php @@ -647,14 +647,12 @@ class NetworkBinaryStream extends BinaryStream{ } protected function getEntityLink() : EntityLink{ - $link = new EntityLink(); - - $link->fromEntityUniqueId = $this->getEntityUniqueId(); - $link->toEntityUniqueId = $this->getEntityUniqueId(); - $link->type = $this->getByte(); - $link->immediate = $this->getBool(); - - return $link; + return new EntityLink( + $fromEntityUniqueId = $this->getEntityUniqueId(), + $toEntityUniqueId = $this->getEntityUniqueId(), + $type = $this->getByte(), + $immediate = $this->getBool() + ); } protected function putEntityLink(EntityLink $link) : void{ diff --git a/src/pocketmine/network/mcpe/protocol/types/EntityLink.php b/src/pocketmine/network/mcpe/protocol/types/EntityLink.php index 9a220fab1..97bd8c50f 100644 --- a/src/pocketmine/network/mcpe/protocol/types/EntityLink.php +++ b/src/pocketmine/network/mcpe/protocol/types/EntityLink.php @@ -38,7 +38,7 @@ class EntityLink{ /** @var bool */ public $immediate; //for dismounting on mount death - public function __construct(int $fromEntityUniqueId = null, int $toEntityUniqueId = null, int $type = null, bool $immediate = false){ + public function __construct(int $fromEntityUniqueId, int $toEntityUniqueId, int $type, bool $immediate){ $this->fromEntityUniqueId = $fromEntityUniqueId; $this->toEntityUniqueId = $toEntityUniqueId; $this->type = $type; diff --git a/tests/phpstan/configs/l8-baseline.neon b/tests/phpstan/configs/l8-baseline.neon index f0457ff76..241359db4 100644 --- a/tests/phpstan/configs/l8-baseline.neon +++ b/tests/phpstan/configs/l8-baseline.neon @@ -1545,21 +1545,6 @@ parameters: count: 1 path: ../../../src/pocketmine/network/mcpe/protocol/SetScoreboardIdentityPacket.php - - - message: "#^Property pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\EntityLink\\:\\:\\$fromEntityUniqueId \\(int\\) does not accept int\\|null\\.$#" - count: 1 - path: ../../../src/pocketmine/network/mcpe/protocol/types/EntityLink.php - - - - message: "#^Property pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\EntityLink\\:\\:\\$toEntityUniqueId \\(int\\) does not accept int\\|null\\.$#" - count: 1 - path: ../../../src/pocketmine/network/mcpe/protocol/types/EntityLink.php - - - - message: "#^Property pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\EntityLink\\:\\:\\$type \\(int\\) does not accept int\\|null\\.$#" - count: 1 - path: ../../../src/pocketmine/network/mcpe/protocol/types/EntityLink.php - - message: "#^Argument of an invalid type array\\\\|null supplied for foreach, only iterables are supported\\.$#" count: 1