diff --git a/src/item/Item.php b/src/item/Item.php index e3c73ef86..e61891f99 100644 --- a/src/item/Item.php +++ b/src/item/Item.php @@ -351,8 +351,8 @@ class Item implements \JsonSerializable{ $tag->removeTag(self::TAG_ENCH); } - $this->hasCustomBlockData() ? - $tag->setTag(self::TAG_BLOCK_ENTITY_TAG, clone $this->getCustomBlockData()) : + ($blockData = $this->getCustomBlockData()) !== null ? + $tag->setTag(self::TAG_BLOCK_ENTITY_TAG, clone $blockData) : $tag->removeTag(self::TAG_BLOCK_ENTITY_TAG); if(!$this->canPlaceOn->isEmpty()){ diff --git a/tests/phpstan/configs/l8-baseline.neon b/tests/phpstan/configs/l8-baseline.neon index 9d9e600da..e02e2fc7c 100644 --- a/tests/phpstan/configs/l8-baseline.neon +++ b/tests/phpstan/configs/l8-baseline.neon @@ -145,16 +145,6 @@ parameters: count: 1 path: ../../../src/inventory/transaction/CraftingTransaction.php - - - message: "#^Cannot clone pocketmine\\\\nbt\\\\tag\\\\CompoundTag\\|null\\.$#" - count: 1 - path: ../../../src/item/Item.php - - - - message: "#^Parameter \\#2 \\$tag of method pocketmine\\\\nbt\\\\tag\\\\CompoundTag\\:\\:setTag\\(\\) expects pocketmine\\\\nbt\\\\tag\\\\Tag, pocketmine\\\\nbt\\\\tag\\\\CompoundTag\\|null given\\.$#" - count: 1 - path: ../../../src/item/Item.php - - message: "#^Parameter \\#1 \\$object of function get_class expects object, pocketmine\\\\nbt\\\\tag\\\\Tag\\|null given\\.$#" count: 1