From 85678aa3562921599358789767bb76a6daf4b657 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 2 Sep 2022 18:28:33 +0100 Subject: [PATCH] phpstan 1.8.3 --- composer.json | 2 +- composer.lock | 36 +++++++-------- src/block/Lever.php | 1 - tests/phpstan/configs/actual-problems.neon | 45 ------------------- .../phpstan/configs/impossible-generics.neon | 5 --- tests/phpstan/configs/php-bugs.neon | 3 +- tests/phpstan/configs/phpstan-bugs.neon | 10 +++++ 7 files changed, 30 insertions(+), 72 deletions(-) diff --git a/composer.json b/composer.json index ef3fdd5c7..220366824 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ "webmozart/path-util": "^2.3" }, "require-dev": { - "phpstan/phpstan": "1.8.2", + "phpstan/phpstan": "1.8.3", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index b517c33db..cf747f322 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "72bfad1350c97a3df225577163d702ea", + "content-hash": "5d4f1fe16d8b5bd9f420e30877aa734b", "packages": [ { "name": "adhocore/json-comment", @@ -1505,16 +1505,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.2", + "version": "1.8.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c" + "reference": "5583623b61caafebd62bc78a99533aa9d769d097" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c53312ecc575caf07b0e90dee43883fdf90ca67c", - "reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/5583623b61caafebd62bc78a99533aa9d769d097", + "reference": "5583623b61caafebd62bc78a99533aa9d769d097", "shasum": "" }, "require": { @@ -1538,9 +1538,13 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.2" + "source": "https://github.com/phpstan/phpstan/tree/1.8.3" }, "funding": [ { @@ -1551,16 +1555,12 @@ "url": "https://github.com/phpstan", "type": "github" }, - { - "url": "https://www.patreon.com/phpstan", - "type": "patreon" - }, { "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", "type": "tidelift" } ], - "time": "2022-07-20T09:57:31+00:00" + "time": "2022-09-01T15:27:34+00:00" }, { "name": "phpstan/phpstan-phpunit", @@ -1616,21 +1616,21 @@ }, { "name": "phpstan/phpstan-strict-rules", - "version": "1.4.2", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "4e57160a710dea304fbd1a177ce38edd9b3848db" + "reference": "431b3d6e8040075de196680cd5bc95735987b4ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/4e57160a710dea304fbd1a177ce38edd9b3848db", - "reference": "4e57160a710dea304fbd1a177ce38edd9b3848db", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/431b3d6e8040075de196680cd5bc95735987b4ae", + "reference": "431b3d6e8040075de196680cd5bc95735987b4ae", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.7.15" + "phpstan/phpstan": "^1.8.3" }, "require-dev": { "nikic/php-parser": "^4.13.0", @@ -1658,9 +1658,9 @@ "description": "Extra strict and opinionated rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", - "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.4.2" + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.4.3" }, - "time": "2022-08-25T15:04:21+00:00" + "time": "2022-08-26T15:05:46+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/src/block/Lever.php b/src/block/Lever.php index c9dfe76bb..e45a95345 100644 --- a/src/block/Lever.php +++ b/src/block/Lever.php @@ -69,7 +69,6 @@ class Lever extends Flowable{ 5 => LeverFacing::UP_AXIS_Z(), 6 => LeverFacing::UP_AXIS_X(), 7 => LeverFacing::DOWN_AXIS_Z(), - default => throw new AssumptionFailedError("0x07 mask should make this impossible"), //phpstan doesn't understand :( }; $this->activated = ($stateMeta & BlockLegacyMetadata::LEVER_FLAG_POWERED) !== 0; diff --git a/tests/phpstan/configs/actual-problems.neon b/tests/phpstan/configs/actual-problems.neon index 746c9a792..85b261dca 100644 --- a/tests/phpstan/configs/actual-problems.neon +++ b/tests/phpstan/configs/actual-problems.neon @@ -775,18 +775,8 @@ parameters: count: 1 path: ../../../src/plugin/PluginBase.php - - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" - count: 1 - path: ../../../src/plugin/PluginDescription.php - - message: "#^Cannot cast mixed to string\\.$#" - count: 5 - path: ../../../src/plugin/PluginDescription.php - - - - message: "#^Parameter \\#1 \\$data of static method pocketmine\\\\permission\\\\PermissionParser\\:\\:loadPermissions\\(\\) expects array\\\\>, mixed given\\.$#" count: 1 path: ../../../src/plugin/PluginDescription.php @@ -795,11 +785,6 @@ parameters: count: 1 path: ../../../src/plugin/PluginDescription.php - - - message: "#^Parameter \\#1 \\$name of static method pocketmine\\\\plugin\\\\PluginEnableOrder\\:\\:fromString\\(\\) expects string, mixed given\\.$#" - count: 1 - path: ../../../src/plugin/PluginDescription.php - - message: "#^Parameter \\#2 \\$subject of function preg_match expects string, mixed given\\.$#" count: 1 @@ -810,26 +795,6 @@ parameters: count: 1 path: ../../../src/plugin/PluginDescription.php - - - message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$authors \\(array\\\\) does not accept array\\.$#" - count: 1 - path: ../../../src/plugin/PluginDescription.php - - - - message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$authors \\(array\\\\) does not accept array\\\\.$#" - count: 1 - path: ../../../src/plugin/PluginDescription.php - - - - message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$depend \\(array\\\\) does not accept array\\.$#" - count: 1 - path: ../../../src/plugin/PluginDescription.php - - - - message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$loadBefore \\(array\\\\) does not accept array\\.$#" - count: 1 - path: ../../../src/plugin/PluginDescription.php - - message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$main \\(string\\) does not accept mixed\\.$#" count: 1 @@ -840,16 +805,6 @@ parameters: count: 1 path: ../../../src/plugin/PluginDescription.php - - - message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$softDepend \\(array\\\\) does not accept array\\.$#" - count: 1 - path: ../../../src/plugin/PluginDescription.php - - - - message: "#^Property pocketmine\\\\plugin\\\\PluginDescription\\:\\:\\$srcNamespacePrefix \\(string\\) does not accept mixed\\.$#" - count: 1 - path: ../../../src/plugin/PluginDescription.php - - message: "#^Cannot call method addChild\\(\\) on pocketmine\\\\permission\\\\Permission\\|null\\.$#" count: 4 diff --git a/tests/phpstan/configs/impossible-generics.neon b/tests/phpstan/configs/impossible-generics.neon index 0281bcd7f..b0e67d294 100644 --- a/tests/phpstan/configs/impossible-generics.neon +++ b/tests/phpstan/configs/impossible-generics.neon @@ -10,8 +10,3 @@ parameters: count: 1 path: ../../../src/event/RegisteredListener.php - - - message: "#^Property pocketmine\\\\event\\\\RegisteredListener\\:\\:\\$handler type has no signature specified for Closure\\.$#" - count: 1 - path: ../../../src/event/RegisteredListener.php - diff --git a/tests/phpstan/configs/php-bugs.neon b/tests/phpstan/configs/php-bugs.neon index f4754087b..c70ef1ecb 100644 --- a/tests/phpstan/configs/php-bugs.neon +++ b/tests/phpstan/configs/php-bugs.neon @@ -1,7 +1,6 @@ parameters: ignoreErrors: - - message: "#^Property pocketmine\\\\network\\\\mcpe\\\\handler\\\\StupidJsonDecodeTest\\:\\:\\$stupidJsonDecodeFunc \\(Closure\\(string, bool\\)\\: mixed\\) does not accept Closure\\|null\\.$#" + message: "#^Property pocketmine\\\\network\\\\mcpe\\\\handler\\\\StupidJsonDecodeTest\\:\\:\\$stupidJsonDecodeFunc \\(Closure\\(string, bool=\\)\\: mixed\\) does not accept Closure\\|null\\.$#" count: 1 path: ../../phpunit/network/mcpe/handler/StupidJsonDecodeTest.php - diff --git a/tests/phpstan/configs/phpstan-bugs.neon b/tests/phpstan/configs/phpstan-bugs.neon index dcfda66bc..b9e3e76b8 100644 --- a/tests/phpstan/configs/phpstan-bugs.neon +++ b/tests/phpstan/configs/phpstan-bugs.neon @@ -55,6 +55,11 @@ parameters: count: 1 path: ../../../src/plugin/PluginManager.php + - + message: "#^Offset \\(int\\|string\\) on non\\-empty\\-array\\ in isset\\(\\) always exists and is not nullable\\.$#" + count: 1 + path: ../../../src/plugin/PluginManager.php + - message: "#^Static property pocketmine\\\\scheduler\\\\AsyncTask\\:\\:\\$threadLocalStorage \\(ArrayObject\\\\>\\|null\\) does not accept non\\-empty\\-array\\\\>\\|ArrayObject\\\\>\\.$#" count: 1 @@ -70,6 +75,11 @@ parameters: count: 1 path: ../../../src/thread/Worker.php + - + message: "#^Offset \\(int\\|string\\) on non\\-empty\\-array\\ in isset\\(\\) always exists and is not nullable\\.$#" + count: 1 + path: ../../../src/world/WorldManager.php + - message: "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#" count: 2