diff --git a/composer.json b/composer.json index fcbb4e8a1..999131857 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "pocketmine/pocketmine-mp", - "description": "A server software for Minecraft: Pocket Edition written in PHP", + "description": "A server software for Minecraft: Bedrock Edition written in PHP", "type": "project", "homepage": "https://pmmp.io", "license": "LGPL-3.0", @@ -53,7 +53,7 @@ "webmozart/path-util": "^2.3" }, "require-dev": { - "phpstan/phpstan": "0.12.92", + "phpstan/phpstan": "0.12.95", "phpstan/phpstan-phpunit": "^0.12.6", "phpstan/phpstan-strict-rules": "^0.12.2", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index cdfebc0da..69ac419f9 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": "6aa42d767f14ce036f410d0001fd3845", + "content-hash": "db2d0f1b7626686a7d1d368052ff9a0a", "packages": [ { "name": "adhocore/json-comment", @@ -1919,16 +1919,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.92", + "version": "0.12.95", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "64d4c5dc8ea96972bc18432d137a330239a5d2b2" + "reference": "4ffddfe86e85dcc494a47e5f3dcfd1a2dccdce58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/64d4c5dc8ea96972bc18432d137a330239a5d2b2", - "reference": "64d4c5dc8ea96972bc18432d137a330239a5d2b2", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/4ffddfe86e85dcc494a47e5f3dcfd1a2dccdce58", + "reference": "4ffddfe86e85dcc494a47e5f3dcfd1a2dccdce58", "shasum": "" }, "require": { @@ -1959,7 +1959,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/0.12.92" + "source": "https://github.com/phpstan/phpstan/tree/0.12.95" }, "funding": [ { @@ -1979,7 +1979,7 @@ "type": "tidelift" } ], - "time": "2021-07-10T13:53:49+00:00" + "time": "2021-08-20T12:53:41+00:00" }, { "name": "phpstan/phpstan-phpunit", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index c3b6a99fd..1247fd7e1 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -9,6 +9,7 @@ includes: - tests/phpstan/configs/phpstan-bugs.neon - tests/phpstan/configs/pthreads-bugs.neon - tests/phpstan/configs/runtime-type-checks.neon + - tests/phpstan/configs/spl-fixed-array-sucks.neon - vendor/phpstan/phpstan-phpunit/extension.neon - vendor/phpstan/phpstan-phpunit/rules.neon - vendor/phpstan/phpstan-strict-rules/rules.neon diff --git a/src/utils/Config.php b/src/utils/Config.php index 0a42deac3..841b7f860 100644 --- a/src/utils/Config.php +++ b/src/utils/Config.php @@ -237,7 +237,7 @@ class Config{ /** * Sets the options for the JSON encoding when saving * - * @return Config $this + * @return $this * @throws \RuntimeException if the Config is not in JSON * @see json_encode */ @@ -254,7 +254,7 @@ class Config{ /** * Enables the given option in addition to the currently set JSON options * - * @return Config $this + * @return $this * @throws \RuntimeException if the Config is not in JSON * @see json_encode */ @@ -271,7 +271,7 @@ class Config{ /** * Disables the given option for the JSON encoding when saving * - * @return Config $this + * @return $this * @throws \RuntimeException if the Config is not in JSON * @see json_encode */ diff --git a/start.cmd b/start.cmd index 4e4c3a93e..929e5f7bb 100644 --- a/start.cmd +++ b/start.cmd @@ -1,5 +1,5 @@ @echo off -TITLE PocketMine-MP server software for Minecraft: Pocket Edition +TITLE PocketMine-MP server software for Minecraft: Bedrock Edition cd /d %~dp0 if exist bin\php\php.exe ( diff --git a/tests/phpstan/configs/l7-baseline.neon b/tests/phpstan/configs/l7-baseline.neon index f7e9f17e7..443b0f812 100644 --- a/tests/phpstan/configs/l7-baseline.neon +++ b/tests/phpstan/configs/l7-baseline.neon @@ -126,7 +126,7 @@ parameters: path: ../../../src/block/DragonEgg.php - - message: "#^Parameter \\#2 \\$y of method pocketmine\\\\world\\\\World\\:\\:getBlockAt\\(\\) expects int, float\\|int given\\.$#" + message: "#^Parameter \\#2 \\$y of method pocketmine\\\\world\\\\World\\:\\:getBlockAt\\(\\) expects int, float\\|int\\<0, max\\> given\\.$#" count: 1 path: ../../../src/block/DragonEgg.php @@ -555,11 +555,6 @@ parameters: count: 1 path: ../../../src/entity/projectile/Projectile.php - - - message: "#^Parameter \\#1 \\$objectOrClass of class ReflectionClass constructor expects class\\-string\\\\|T of object, string given\\.$#" - count: 1 - path: ../../../src/event/HandlerListManager.php - - message: "#^Parameter \\#1 \\$json of function json_decode expects string, string\\|false given\\.$#" count: 1 diff --git a/tests/phpstan/configs/phpstan-bugs.neon b/tests/phpstan/configs/phpstan-bugs.neon index efc2e88e4..a46b05a10 100644 --- a/tests/phpstan/configs/phpstan-bugs.neon +++ b/tests/phpstan/configs/phpstan-bugs.neon @@ -25,11 +25,6 @@ parameters: count: 1 path: ../../../src/entity/projectile/Projectile.php - - - message: "#^Parameter \\#1 \\$read of function socket_select expects array\\\\|null, array\\ given\\.$#" - count: 1 - path: ../../../src/network/query/DedicatedQueryNetworkInterface.php - - message: "#^Parameter \\#1 \\$ of closure expects TValue, TValue given\\.$#" count: 2 @@ -40,71 +35,6 @@ parameters: count: 1 path: ../../../src/utils/Promise.php - - - message: "#^Match arm comparison between string and '§3' is always false\\.$#" - count: 1 - path: ../../../src/utils/Terminal.php - - - - message: "#^Match arm comparison between string and '§4' is always false\\.$#" - count: 1 - path: ../../../src/utils/Terminal.php - - - - message: "#^Match arm comparison between string and '§5' is always false\\.$#" - count: 1 - path: ../../../src/utils/Terminal.php - - - - message: "#^Match arm comparison between string and '§6' is always false\\.$#" - count: 1 - path: ../../../src/utils/Terminal.php - - - - message: "#^Match arm comparison between string and '§7' is always false\\.$#" - count: 1 - path: ../../../src/utils/Terminal.php - - - - message: "#^Match arm comparison between string and '§8' is always false\\.$#" - count: 1 - path: ../../../src/utils/Terminal.php - - - - message: "#^Match arm comparison between string and '§9' is always false\\.$#" - count: 1 - path: ../../../src/utils/Terminal.php - - - - message: "#^Match arm comparison between string and '§a' is always false\\.$#" - count: 1 - path: ../../../src/utils/Terminal.php - - - - message: "#^Match arm comparison between string and '§b' is always false\\.$#" - count: 1 - path: ../../../src/utils/Terminal.php - - - - message: "#^Match arm comparison between string and '§c' is always false\\.$#" - count: 1 - path: ../../../src/utils/Terminal.php - - - - message: "#^Match arm comparison between string and '§d' is always false\\.$#" - count: 1 - path: ../../../src/utils/Terminal.php - - - - message: "#^Match arm comparison between string and '§e' is always false\\.$#" - count: 1 - path: ../../../src/utils/Terminal.php - - - - message: "#^Match arm comparison between string and '§f' is always false\\.$#" - count: 1 - path: ../../../src/utils/Terminal.php - - message: "#^Parameter \\#1 \\$ of closure expects TMemberType, TMemberType given\\.$#" count: 1 @@ -121,7 +51,7 @@ parameters: path: ../../../src/world/format/io/region/RegionLoader.php - - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotNull\\(\\) with int and string will always evaluate to true\\.$#" - count: 1 - path: ../../phpunit/block/BlockTest.php + message: "#^Parameter \\#2 \\$count of function array_fill expects int\\<0, max\\>, int given\\.$#" + count: 2 + path: ../../../src/world/generator/noise/Noise.php diff --git a/tests/phpstan/configs/spl-fixed-array-sucks.neon b/tests/phpstan/configs/spl-fixed-array-sucks.neon new file mode 100644 index 000000000..f984dc555 --- /dev/null +++ b/tests/phpstan/configs/spl-fixed-array-sucks.neon @@ -0,0 +1,77 @@ +parameters: + ignoreErrors: + - + message: "#^Cannot call method getFullBlock\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/World.php + + - + message: "#^Cannot call method isEmptyFast\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/World.php + + - + message: "#^Cannot call method collectGarbage\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/format/Chunk.php + + - + message: "#^Method pocketmine\\\\world\\\\format\\\\HeightArray\\:\\:getValues\\(\\) should return array\\ but returns array\\\\.$#" + count: 1 + path: ../../../src/world/format/HeightArray.php + + - + message: "#^Cannot call method getBlockLayers\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/format/io/FastChunkSerializer.php + + - + message: "#^Cannot call method getBlockLightArray\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/format/io/FastChunkSerializer.php + + - + message: "#^Cannot call method getBlockSkyLightArray\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/format/io/FastChunkSerializer.php + + - + message: "#^Cannot call method getEmptyBlockId\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/format/io/FastChunkSerializer.php + + - + message: "#^Cannot call method getBlockLayers\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/format/io/leveldb/LevelDB.php + + - + message: "#^Cannot call method isEmptyAuthoritative\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/format/io/leveldb/LevelDB.php + + - + message: "#^Cannot call method getBlockLayers\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/light/BlockLightUpdate.php + + - + message: "#^Cannot call method setBlockLightArray\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/light/BlockLightUpdate.php + + - + message: "#^Parameter \\#1 \\$subChunk of method pocketmine\\\\world\\\\light\\\\BlockLightUpdate\\:\\:scanForLightEmittingBlocks\\(\\) expects pocketmine\\\\world\\\\format\\\\SubChunk, pocketmine\\\\world\\\\format\\\\SubChunk\\|null given\\.$#" + count: 1 + path: ../../../src/world/light/BlockLightUpdate.php + + - + message: "#^Cannot call method getBlockLightArray\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/light/LightPopulationTask.php + + - + message: "#^Cannot call method getBlockSkyLightArray\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#" + count: 1 + path: ../../../src/world/light/LightPopulationTask.php +