From 912fd3f5c61e880d192a7e4dbd2c8f4cc740e959 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 21 Sep 2023 13:22:14 +0100 Subject: [PATCH 1/2] PHPStan 1.10.35, plus workarounds --- composer.json | 2 +- composer.lock | 12 ++++++------ src/MemoryManager.php | 2 +- tests/phpstan/configs/actual-problems.neon | 10 ---------- tests/phpstan/configs/php-bugs.neon | 9 +++++++-- tests/phpstan/configs/phpstan-bugs.neon | 5 +++++ 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/composer.json b/composer.json index 96715ef8f..10f10e6ca 100644 --- a/composer.json +++ b/composer.json @@ -56,7 +56,7 @@ "webmozart/path-util": "~2.3.0" }, "require-dev": { - "phpstan/phpstan": "1.10.15", + "phpstan/phpstan": "1.10.35", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", "phpunit/phpunit": "^10.1" diff --git a/composer.lock b/composer.lock index 8679a0810..acf98a172 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": "dc69846ccf19272d45811712f038f167", + "content-hash": "544d6f936592b418497d61fec8058656", "packages": [ { "name": "adhocore/json-comment", @@ -1738,16 +1738,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.15", + "version": "1.10.35", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd" + "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/762c4dac4da6f8756eebb80e528c3a47855da9bd", - "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e730e5facb75ffe09dfb229795e8c01a459f26c3", + "reference": "e730e5facb75ffe09dfb229795e8c01a459f26c3", "shasum": "" }, "require": { @@ -1796,7 +1796,7 @@ "type": "tidelift" } ], - "time": "2023-05-09T15:28:01+00:00" + "time": "2023-09-19T15:27:56+00:00" }, { "name": "phpstan/phpstan-phpunit", diff --git a/src/MemoryManager.php b/src/MemoryManager.php index 1db31615d..13cf769a4 100644 --- a/src/MemoryManager.php +++ b/src/MemoryManager.php @@ -361,7 +361,7 @@ class MemoryManager{ '_SESSION' => true ]; - foreach(Utils::stringifyKeys($GLOBALS) as $varName => $value){ + foreach($GLOBALS as $varName => $value){ if(isset($ignoredGlobals[$varName])){ continue; } diff --git a/tests/phpstan/configs/actual-problems.neon b/tests/phpstan/configs/actual-problems.neon index 8e28edaa5..698230208 100644 --- a/tests/phpstan/configs/actual-problems.neon +++ b/tests/phpstan/configs/actual-problems.neon @@ -1315,16 +1315,6 @@ parameters: count: 1 path: ../../phpunit/block/regenerate_consistency_check.php - - - message: "#^Property pocketmine\\\\event\\\\HandlerListManagerTest\\:\\:\\$isValidFunc \\(Closure\\(ReflectionClass\\\\)\\: bool\\) does not accept Closure\\|null\\.$#" - count: 1 - path: ../../phpunit/event/HandlerListManagerTest.php - - - - message: "#^Property pocketmine\\\\event\\\\HandlerListManagerTest\\:\\:\\$resolveParentFunc \\(Closure\\(ReflectionClass\\\\)\\: ReflectionClass\\\\|null\\) does not accept Closure\\|null\\.$#" - count: 1 - path: ../../phpunit/event/HandlerListManagerTest.php - - message: "#^Parameter \\#1 \\$logFile of class pocketmine\\\\utils\\\\MainLogger constructor expects string, string\\|false given\\.$#" count: 1 diff --git a/tests/phpstan/configs/php-bugs.neon b/tests/phpstan/configs/php-bugs.neon index 4475ec468..13a42a53b 100644 --- a/tests/phpstan/configs/php-bugs.neon +++ b/tests/phpstan/configs/php-bugs.neon @@ -1,6 +1,11 @@ parameters: ignoreErrors: - - message: "#^Property pocketmine\\\\network\\\\mcpe\\\\handler\\\\StupidJsonDecodeTest\\:\\:\\$stupidJsonDecodeFunc \\(Closure\\(string, bool\\=\\)\\: mixed\\) does not accept Closure\\|null\\.$#" + message: "#^Property pocketmine\\\\event\\\\HandlerListManagerTest\\:\\:\\$isValidFunc \\(Closure\\(ReflectionClass\\\\)\\: bool\\) does not accept Closure\\|null\\.$#" count: 1 - path: ../../phpunit/network/mcpe/handler/StupidJsonDecodeTest.php + path: ../../phpunit/event/HandlerListManagerTest.php + + - + message: "#^Property pocketmine\\\\event\\\\HandlerListManagerTest\\:\\:\\$resolveParentFunc \\(Closure\\(ReflectionClass\\\\)\\: \\(ReflectionClass\\\\|null\\)\\) does not accept Closure\\|null\\.$#" + count: 1 + path: ../../phpunit/event/HandlerListManagerTest.php diff --git a/tests/phpstan/configs/phpstan-bugs.neon b/tests/phpstan/configs/phpstan-bugs.neon index 99cf2aaa7..62f945fc7 100644 --- a/tests/phpstan/configs/phpstan-bugs.neon +++ b/tests/phpstan/configs/phpstan-bugs.neon @@ -10,6 +10,11 @@ parameters: count: 1 path: ../../../src/entity/projectile/Projectile.php + - + message: "#^Match arm comparison between 1\\|2\\|3\\|4 and 0 is always false\\.$#" + count: 1 + path: ../../../src/network/mcpe/handler/InGamePacketHandler.php + - message: "#^Match arm comparison between 4 and 4 is always true\\.$#" count: 1 From 7a2cfa92b637ddc5d297ea9c2299b8f23f487d42 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 21 Sep 2023 13:23:09 +0100 Subject: [PATCH 2/2] Update composer dependencies --- composer.lock | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/composer.lock b/composer.lock index acf98a172..81f584bde 100644 --- a/composer.lock +++ b/composer.lock @@ -1901,16 +1901,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.4", + "version": "10.1.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "cd59bb34756a16ca8253ce9b2909039c227fff71" + "reference": "56f33548fe522c8d82da7ff3824b42829d324364" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/cd59bb34756a16ca8253ce9b2909039c227fff71", - "reference": "cd59bb34756a16ca8253ce9b2909039c227fff71", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/56f33548fe522c8d82da7ff3824b42829d324364", + "reference": "56f33548fe522c8d82da7ff3824b42829d324364", "shasum": "" }, "require": { @@ -1967,7 +1967,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.4" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.6" }, "funding": [ { @@ -1975,7 +1975,7 @@ "type": "github" } ], - "time": "2023-08-31T14:04:38+00:00" + "time": "2023-09-19T04:59:03+00:00" }, { "name": "phpunit/php-file-iterator", @@ -2222,16 +2222,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.3.3", + "version": "10.3.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "241ed4dd0db1c096984e62d414c4e1ac8d5dbff4" + "reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/241ed4dd0db1c096984e62d414c4e1ac8d5dbff4", - "reference": "241ed4dd0db1c096984e62d414c4e1ac8d5dbff4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/747c3b2038f1139e3dcd9886a3f5a948648b7503", + "reference": "747c3b2038f1139e3dcd9886a3f5a948648b7503", "shasum": "" }, "require": { @@ -2245,7 +2245,7 @@ "phar-io/manifest": "^2.0.3", "phar-io/version": "^3.0.2", "php": ">=8.1", - "phpunit/php-code-coverage": "^10.1.1", + "phpunit/php-code-coverage": "^10.1.5", "phpunit/php-file-iterator": "^4.0", "phpunit/php-invoker": "^4.0", "phpunit/php-text-template": "^3.0", @@ -2255,7 +2255,7 @@ "sebastian/comparator": "^5.0", "sebastian/diff": "^5.0", "sebastian/environment": "^6.0", - "sebastian/exporter": "^5.0", + "sebastian/exporter": "^5.1", "sebastian/global-state": "^6.0.1", "sebastian/object-enumerator": "^5.0", "sebastian/recursion-context": "^5.0", @@ -2303,7 +2303,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.3" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.5" }, "funding": [ { @@ -2319,7 +2319,7 @@ "type": "tidelift" } ], - "time": "2023-09-05T04:34:51+00:00" + "time": "2023-09-19T05:42:37+00:00" }, { "name": "sebastian/cli-parser", @@ -2756,16 +2756,16 @@ }, { "name": "sebastian/exporter", - "version": "5.0.0", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0" + "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", - "reference": "f3ec4bf931c0b31e5b413f5b4fc970a7d03338c0", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c3fa8483f9539b190f7cd4bfc4a07631dd1df344", + "reference": "c3fa8483f9539b190f7cd4bfc4a07631dd1df344", "shasum": "" }, "require": { @@ -2821,7 +2821,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/5.0.0" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.0" }, "funding": [ { @@ -2829,7 +2830,7 @@ "type": "github" } ], - "time": "2023-02-03T07:06:49+00:00" + "time": "2023-09-18T07:15:37+00:00" }, { "name": "sebastian/global-state",