From 61dc9d7f6bea46e36b73d3d2396a2ccf6d1a8877 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 25 Apr 2020 11:26:54 +0100 Subject: [PATCH] phpstan: split up phpstan-bugs and phpstan-bugs-generated configs --- phpstan.neon.dist | 1 + .../configs/phpstan-bugs-generated.neon | 50 ++++++++++++++++++ tests/phpstan/configs/phpstan-bugs.neon | 51 +------------------ 3 files changed, 52 insertions(+), 50 deletions(-) create mode 100644 tests/phpstan/configs/phpstan-bugs-generated.neon diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 8f9715913..99ac05762 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -4,6 +4,7 @@ includes: - tests/phpstan/configs/gc-hacks.neon - tests/phpstan/configs/php-bugs.neon - tests/phpstan/configs/phpstan-bugs.neon + - tests/phpstan/configs/phpstan-bugs-generated.neon - tests/phpstan/configs/phpunit-wiring-tests.neon - tests/phpstan/configs/pthreads-bugs.neon - tests/phpstan/configs/runtime-type-checks.neon diff --git a/tests/phpstan/configs/phpstan-bugs-generated.neon b/tests/phpstan/configs/phpstan-bugs-generated.neon new file mode 100644 index 000000000..2b71a636c --- /dev/null +++ b/tests/phpstan/configs/phpstan-bugs-generated.neon @@ -0,0 +1,50 @@ +parameters: + ignoreErrors: + - + message: "#^Offset string does not exist on array\\(\\)\\.$#" + count: 3 + path: ../../../src/pocketmine/MemoryManager.php + + - + message: "#^Offset \\(int\\|string\\) does not exist on array\\(\\)\\.$#" + count: 1 + path: ../../../src/pocketmine/MemoryManager.php + + - + message: "#^Comparison operation \"\\>\\=\" between 0 and 2 is always false\\.$#" + count: 1 + path: ../../../src/pocketmine/block/Liquid.php + + - + #adjacentSources comparison FP + message: "#^If condition is always false\\.$#" + count: 1 + path: ../../../src/pocketmine/block/Liquid.php + + - + #readline() may return false + message: "#^Strict comparison using \\!\\=\\= between string and false will always evaluate to true\\.$#" + count: 1 + path: ../../../src/pocketmine/command/CommandReader.php + + - + #generics corruption, this might show up in other forms too + message: "#^Parameter \\#1 \\$offset \\(int\\) of method pocketmine\\\\entity\\\\AttributeMap\\:\\:offsetGet\\(\\) should be contravariant with parameter \\$offset \\(mixed\\) of method ArrayAccess\\\\:\\:offsetGet\\(\\)$#" + count: 1 + path: ../../../src/pocketmine/entity/AttributeMap.php + + - + message: "#^Call to function assert\\(\\) with false and 'unknown hit type' will always evaluate to false\\.$#" + count: 1 + path: ../../../src/pocketmine/entity/projectile/Projectile.php + + - + message: "#^Call to function method_exists\\(\\) with pocketmine\\\\network\\\\mcpe\\\\CachedEncapsulatedPacket and '__toString' will always evaluate to true\\.$#" + count: 1 + path: ../../../src/pocketmine/network/mcpe/protocol/DataPacket.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\\.$#" + count: 1 + path: ../../../tests/phpunit/block/BlockTest.php diff --git a/tests/phpstan/configs/phpstan-bugs.neon b/tests/phpstan/configs/phpstan-bugs.neon index 998fde5ad..e2d94addd 100644 --- a/tests/phpstan/configs/phpstan-bugs.neon +++ b/tests/phpstan/configs/phpstan-bugs.neon @@ -3,53 +3,4 @@ parameters: - "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#" - message: "#^Default value of the parameter \\#\\d+ \\$[A-Za-z\\d_]+ \\(\\-?\\d+\\) of method .+\\(\\) is incompatible with type float\\.$#" - path: ../../../src - - - - message: "#^Offset string does not exist on array\\(\\)\\.$#" - count: 3 - path: ../../../src/pocketmine/MemoryManager.php - - - - message: "#^Offset \\(int\\|string\\) does not exist on array\\(\\)\\.$#" - count: 1 - path: ../../../src/pocketmine/MemoryManager.php - - - - message: "#^Comparison operation \"\\>\\=\" between 0 and 2 is always false\\.$#" - count: 1 - path: ../../../src/pocketmine/block/Liquid.php - - - - #adjacentSources comparison FP - message: "#^If condition is always false\\.$#" - count: 1 - path: ../../../src/pocketmine/block/Liquid.php - - - - #readline() may return false - message: "#^Strict comparison using \\!\\=\\= between string and false will always evaluate to true\\.$#" - count: 1 - path: ../../../src/pocketmine/command/CommandReader.php - - - - #generics corruption, this might show up in other forms too - message: "#^Parameter \\#1 \\$offset \\(int\\) of method pocketmine\\\\entity\\\\AttributeMap\\:\\:offsetGet\\(\\) should be contravariant with parameter \\$offset \\(mixed\\) of method ArrayAccess\\\\:\\:offsetGet\\(\\)$#" - count: 1 - path: ../../../src/pocketmine/entity/AttributeMap.php - - - - message: "#^Call to function assert\\(\\) with false and 'unknown hit type' will always evaluate to false\\.$#" - count: 1 - path: ../../../src/pocketmine/entity/projectile/Projectile.php - - - - message: "#^Call to function method_exists\\(\\) with pocketmine\\\\network\\\\mcpe\\\\CachedEncapsulatedPacket and '__toString' will always evaluate to true\\.$#" - count: 1 - path: ../../../src/pocketmine/network/mcpe/protocol/DataPacket.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\\.$#" - count: 1 - path: ../../../tests/phpunit/block/BlockTest.php + path: ../../../src \ No newline at end of file