Tile: use phpstan-friendly way to pass block NBT

fixes 1 level 8 error
This commit is contained in:
Dylan K. Taylor 2020-06-27 01:03:20 +01:00
parent 9484220bd5
commit 7e391a8123
2 changed files with 2 additions and 7 deletions

View File

@ -89,8 +89,8 @@ abstract class Tile{
* @throws \RuntimeException
*/
public function copyDataFromItem(Item $item) : void{
if($item->hasCustomBlockData()){ //TODO: check item root tag (MCPE doesn't use BlockEntityTag)
$this->readSaveData($item->getCustomBlockData());
if(($blockNbt = $item->getCustomBlockData()) !== null){ //TODO: check item root tag (MCPE doesn't use BlockEntityTag)
$this->readSaveData($blockNbt);
}
}

View File

@ -45,11 +45,6 @@ parameters:
count: 1
path: ../../../src/block/tile/Chest.php
-
message: "#^Parameter \\#1 \\$nbt of method pocketmine\\\\block\\\\tile\\\\Tile\\:\\:readSaveData\\(\\) expects pocketmine\\\\nbt\\\\tag\\\\CompoundTag, pocketmine\\\\nbt\\\\tag\\\\CompoundTag\\|null given\\.$#"
count: 1
path: ../../../src/block/tile/Tile.php
-
message: "#^Parameter \\#2 \\$replace of function str_replace expects array\\|string, string\\|null given\\.$#"
count: 1