From dbcd2b1e65c3dc46b7231521773d7aeef7c3dd1c Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 5 Apr 2023 21:04:00 +0100 Subject: [PATCH] ItemTypeIds::toBlockTypeId() now returns null for non-blockitem IDs closes #5648 --- src/item/ItemTypeIds.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/item/ItemTypeIds.php b/src/item/ItemTypeIds.php index 180842555..ddde0d1cb 100644 --- a/src/item/ItemTypeIds.php +++ b/src/item/ItemTypeIds.php @@ -320,9 +320,9 @@ final class ItemTypeIds{ return -$blockTypeId; } - public static function toBlockTypeId(int $itemTypeId) : int{ - if($itemTypeId > 0){ - throw new \InvalidArgumentException("Item type ID $itemTypeId does not represent a block"); + public static function toBlockTypeId(int $itemTypeId) : ?int{ + if($itemTypeId > 0){ //not a blockitem + return null; } return -$itemTypeId; }