From 2d461251edde9a4c6dbcce0802e56494128d9731 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 7 Feb 2020 22:14:51 +0000 Subject: [PATCH] phpstan: ignore more errors reported by strict-rules --- tests/phpstan/configs/phpstan-bugs.neon | 17 +++++++++++++++ .../phpstan/configs/runtime-type-checks.neon | 21 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/tests/phpstan/configs/phpstan-bugs.neon b/tests/phpstan/configs/phpstan-bugs.neon index bb8131bf3..3b3f2db62 100644 --- a/tests/phpstan/configs/phpstan-bugs.neon +++ b/tests/phpstan/configs/phpstan-bugs.neon @@ -21,6 +21,12 @@ parameters: count: 1 path: ../../../src/Server.php + - + #dynamic instanceof + message: "#^Instanceof between pocketmine\\\\block\\\\tile\\\\Tile and class\\-string\\ will always evaluate to true\\.$#" + count: 1 + path: ../../../src/block/Block.php + - message: "#^Comparison operation \"\\>\\=\" between 0 and 2 is always false\\.$#" count: 1 @@ -60,11 +66,22 @@ parameters: count: 1 path: ../../../src/network/mcpe/protocol/DataPacket.php + - + #object to array cast analysis bug + message: "#^Casting to string something that's already string\\.$#" + count: 1 + path: ../../../src/network/mcpe/protocol/DataPacket.php + - message: "#^If condition is always false\\.$#" count: 1 path: ../../../src/network/mcpe/protocol/types/entity/EntityMetadataCollection.php + - + message: "#^Instanceof between pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\entity\\\\MetadataProperty and pocketmine\\\\network\\\\mcpe\\\\protocol\\\\types\\\\entity\\\\MetadataProperty will always evaluate to true\\.$#" + count: 1 + path: ../../../src/network/mcpe/protocol/types/entity/EntityMetadataCollection.php + - #phpstan doesn't understand that SplFixedArray may contain null message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotNull\\(\\) with int and string will always evaluate to true\\.$#" diff --git a/tests/phpstan/configs/runtime-type-checks.neon b/tests/phpstan/configs/runtime-type-checks.neon index 12ecd489c..2dd8e5cd7 100644 --- a/tests/phpstan/configs/runtime-type-checks.neon +++ b/tests/phpstan/configs/runtime-type-checks.neon @@ -1,5 +1,20 @@ parameters: ignoreErrors: + - + message: "#^Instanceof between pocketmine\\\\block\\\\utils\\\\BannerPattern and pocketmine\\\\block\\\\utils\\\\BannerPattern will always evaluate to true\\.$#" + count: 1 + path: ../../../src/block/Banner.php + + - + message: "#^Call to function assert\\(\\) with bool will always evaluate to true\\.$#" + count: 2 + path: ../../../src/block/tile/TileFactory.php + + - + message: "#^Call to function assert\\(\\) with bool will always evaluate to true\\.$#" + count: 2 + path: ../../../src/entity/EntityFactory.php + - message: "#^Instanceof between pocketmine\\\\event\\\\RegisteredListener and pocketmine\\\\event\\\\RegisteredListener will always evaluate to true\\.$#" count: 1 @@ -11,6 +26,12 @@ parameters: count: 3 path: ../../../src/item/Item.php + - + #setLore() + message: "#^Call to function is_string\\(\\) with string will always evaluate to true\\.$#" + count: 1 + path: ../../../src/item/Item.php + - #commands plugin.yml not currently validated, can't be sure message: "#^Call to function is_array\\(\\) with array\\ will always evaluate to true\\.$#"