fix phpstan warnings

This commit is contained in:
Dylan K. Taylor 2020-11-21 01:16:04 +00:00
parent 98cdc80d37
commit d19db5d2e4
2 changed files with 9 additions and 21 deletions

View File

@ -50,6 +50,7 @@ use pocketmine\network\mcpe\protocol\types\StructureEditorData;
use pocketmine\network\mcpe\protocol\types\StructureSettings;
use pocketmine\utils\BinaryStream;
use pocketmine\utils\UUID;
use function assert;
use function count;
use function strlen;
@ -765,7 +766,9 @@ class NetworkBinaryStream extends BinaryStream{
public function getNbtRoot() : NamedTag{
$offset = $this->getOffset();
try{
return (new NetworkLittleEndianNBTStream())->read($this->getBuffer(), false, $offset, 512);
$result = (new NetworkLittleEndianNBTStream())->read($this->getBuffer(), false, $offset, 512);
assert($result instanceof NamedTag, "doMultiple is false so we should definitely have a NamedTag here");
return $result;
}finally{
$this->setOffset($offset);
}

View File

@ -825,11 +825,6 @@ parameters:
count: 1
path: ../../../src/pocketmine/network/mcpe/VerifyLoginTask.php
-
message: "#^Parameter \\#1 \\$buffer of method pocketmine\\\\nbt\\\\NBTStream\\:\\:read\\(\\) expects string, string\\|false given\\.$#"
count: 1
path: ../../../src/pocketmine/network/mcpe/convert/RuntimeBlockMapping.php
-
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
count: 1
@ -865,6 +860,11 @@ parameters:
count: 1
path: ../../../src/pocketmine/network/mcpe/protocol/BiomeDefinitionListPacket.php
-
message: "#^Parameter \\#1 \\$str of method pocketmine\\\\utils\\\\BinaryStream\\:\\:put\\(\\) expects string, string\\|false given\\.$#"
count: 1
path: ../../../src/pocketmine/network/mcpe/protocol/ItemComponentPacket.php
-
message: "#^Property pocketmine\\\\network\\\\mcpe\\\\protocol\\\\LevelEventGenericPacket\\:\\:\\$eventData \\(string\\) does not accept string\\|false\\.$#"
count: 1
@ -875,26 +875,11 @@ parameters:
count: 1
path: ../../../src/pocketmine/network/mcpe/protocol/PositionTrackingDBServerBroadcastPacket.php
-
message: "#^Static property pocketmine\\\\network\\\\mcpe\\\\protocol\\\\StartGamePacket\\:\\:\\$blockTableCache \\(string\\|null\\) does not accept string\\|false\\.$#"
count: 1
path: ../../../src/pocketmine/network/mcpe/protocol/StartGamePacket.php
-
message: "#^Parameter \\#1 \\$str of method pocketmine\\\\utils\\\\BinaryStream\\:\\:put\\(\\) expects string, string\\|false given\\.$#"
count: 2
path: ../../../src/pocketmine/network/mcpe/protocol/StartGamePacket.php
-
message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#"
count: 1
path: ../../../src/pocketmine/network/mcpe/protocol/StartGamePacket.php
-
message: "#^Property pocketmine\\\\network\\\\mcpe\\\\protocol\\\\UpdateBlockPropertiesPacket\\:\\:\\$nbt \\(string\\) does not accept string\\|false\\.$#"
count: 1
path: ../../../src/pocketmine/network/mcpe/protocol/UpdateBlockPropertiesPacket.php
-
message: "#^Parameter \\#2 \\$resourcePatch of class pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\SkinData constructor expects string, string\\|false given\\.$#"
count: 1