From bedc9cf518848fe46f1703b8321051992c5ff037 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 27 Jun 2022 14:30:12 +0100 Subject: [PATCH] Item::jsonDeserialize(): remove bogus phpdoc (we don't actually know if this is even valid) --- src/item/Item.php | 8 -------- tests/phpstan/configs/actual-problems.neon | 19 +++++++++++++++++-- .../phpstan/configs/runtime-type-checks.neon | 5 ----- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/item/Item.php b/src/item/Item.php index 52c525ecd..f618a687f 100644 --- a/src/item/Item.php +++ b/src/item/Item.php @@ -605,14 +605,6 @@ class Item implements \JsonSerializable{ /** * Returns an Item from properties created in an array by {@link Item#jsonSerialize} * @param mixed[] $data - * @phpstan-param array{ - * id: int, - * damage?: int, - * count?: int, - * nbt?: string, - * nbt_hex?: string, - * nbt_b64?: string - * } $data * * @throws NbtDataException * @throws \InvalidArgumentException diff --git a/tests/phpstan/configs/actual-problems.neon b/tests/phpstan/configs/actual-problems.neon index 77e40efb0..2ec7031d0 100644 --- a/tests/phpstan/configs/actual-problems.neon +++ b/tests/phpstan/configs/actual-problems.neon @@ -581,7 +581,7 @@ parameters: path: ../../../src/inventory/CreativeInventory.php - - message: "#^Parameter \\#1 \\$data of static method pocketmine\\\\item\\\\Item\\:\\:jsonDeserialize\\(\\) expects array\\{id\\: int, damage\\?\\: int, count\\?\\: int, nbt\\?\\: string, nbt_hex\\?\\: string, nbt_b64\\?\\: string\\}, mixed given\\.$#" + message: "#^Parameter \\#1 \\$data of static method pocketmine\\\\item\\\\Item\\:\\:jsonDeserialize\\(\\) expects array, mixed given\\.$#" count: 1 path: ../../../src/inventory/CreativeInventory.php @@ -601,7 +601,22 @@ parameters: path: ../../../src/inventory/transaction/CraftingTransaction.php - - message: "#^Parameter \\#1 \\$buffer of method pocketmine\\\\nbt\\\\BaseNbtSerializer\\:\\:read\\(\\) expects string, string\\|false given\\.$#" + message: "#^Cannot cast mixed to int\\.$#" + count: 3 + path: ../../../src/item/Item.php + + - + message: "#^Parameter \\#1 \\$buffer of method pocketmine\\\\nbt\\\\BaseNbtSerializer\\:\\:read\\(\\) expects string, mixed given\\.$#" + count: 1 + path: ../../../src/item/Item.php + + - + message: "#^Parameter \\#1 \\$string of function base64_decode expects string, mixed given\\.$#" + count: 1 + path: ../../../src/item/Item.php + + - + message: "#^Parameter \\#1 \\$string of function hex2bin expects string, mixed given\\.$#" count: 1 path: ../../../src/item/Item.php diff --git a/tests/phpstan/configs/runtime-type-checks.neon b/tests/phpstan/configs/runtime-type-checks.neon index fb1e456b7..04da39f64 100644 --- a/tests/phpstan/configs/runtime-type-checks.neon +++ b/tests/phpstan/configs/runtime-type-checks.neon @@ -1,10 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Casting to int something that's already int\\.$#" - count: 2 - path: ../../../src/item/Item.php - - message: "#^Instanceof between pocketmine\\\\nbt\\\\tag\\\\CompoundTag and pocketmine\\\\nbt\\\\tag\\\\CompoundTag will always evaluate to true\\.$#" count: 1