From a750af72db402b1d3c75a8f56ebd50256b2682f6 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 14 Dec 2023 16:05:38 +0000 Subject: [PATCH 01/14] Updated build/php submodule to pmmp/PHP-Binaries@73e5950eb90033a8de589044b92aa5e95de9c494 --- build/php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/php b/build/php index 6dc09c57e..73e5950eb 160000 --- a/build/php +++ b/build/php @@ -1 +1 @@ -Subproject commit 6dc09c57eb2a044b3c71e65fa3760dfcaed7fa5e +Subproject commit 73e5950eb90033a8de589044b92aa5e95de9c494 From daeba95101e6278d1f2552397043d29d29d272f8 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 14 Dec 2023 16:54:38 +0000 Subject: [PATCH 02/14] Release 5.10.0 --- changelogs/5.10.md | 46 +++++++++++++++++++++++++++++++++++++++++++++ src/VersionInfo.php | 4 ++-- 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 changelogs/5.10.md diff --git a/changelogs/5.10.md b/changelogs/5.10.md new file mode 100644 index 000000000..551bc40ed --- /dev/null +++ b/changelogs/5.10.md @@ -0,0 +1,46 @@ +# 5.10.0 +Released 14th December 2023. + +**For Minecraft: Bedrock Edition 1.20.50** + +This is a minor feature release, including new gameplay features and minor performance improvements. + +**Plugin compatibility:** Plugins for previous 5.x versions will run unchanged on this release, unless they use internal APIs, reflection, or packages like the `pocketmine\network\mcpe` or `pocketmine\data` namespace. +Do not update plugin minimum API versions unless you need new features added in this release. + +**WARNING: If your plugin uses the `pocketmine\network\mcpe` namespace, you're not shielded by API change constraints.** +Consider using the `mcpe-protocol` directive in `plugin.yml` as a constraint if you're using packets directly. + +## General +- PHP 8.2 is now used by default. PHP 8.1 is still supported, but will be removed in a future 5.x release. +- Improved timings reports by removing `Breakdown` timings group. This group serves no purpose with tree timings and made for confusing reading. + +## Performance +- Improved performance of `Block::encodeFullState()` in most conditions. This in turn improves performance of `World::setBlock()` and `World::setBlockAt()`. +- Improved network compression performance by avoiding unnecessary object allocations. +- Timings now report time spent in individual `Snooze` handlers, making it easier to debug performance issues. + +## Gameplay +### Blocks +- Implemented crop growth speed modifiers. + - The following things now positively affect crop growth speed: + - Being planted on or being adjacent to farmland (hydrated farmland offers a larger benefit than dry farmland) + - Potential light level of at least 9 + - Being planted in rows with space between them (or a different type of crop) + - The following things now negatively affect crop growth speed: + - Improper arrangement (e.g. the same crop on all sides) + - Insufficient light level (below 9) + - Poorly arranged crops will grow slower in this version. Past versions behaved as if crops were always planted in ideal conditions. + - Crops planted in ideal conditions will grow at the same speed as before. + +### Items +- Added the following new items: + - All types of Smithing Template +- Pitcher Pod is now correctly registered. In previous versions, it was mapped to the Pitcher Crop block, causing incorrect name display in commands. + +## Internals +- Cleaned up various getter usages where direct property access is possible. +- Avoided unnecessary repeated getter calls in some loops. +- `NetworkSession` may now track `string` instead of `CompressBatchPromise` when a batch was synchronously compressed. This significantly reduces object allocations and improves performance. +- `NetworkSession` now sends less information to clients on login validation failure. This avoids leaking potentially sensitive error information to clients. + - Clients can correlate their disconnects with server-side logs using the `Error ID` shown on the disconnect screen. diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 4459f9551..405e285fb 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -31,8 +31,8 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; - public const BASE_VERSION = "5.9.1"; - public const IS_DEVELOPMENT_BUILD = true; + public const BASE_VERSION = "5.10.0"; + public const IS_DEVELOPMENT_BUILD = false; public const BUILD_CHANNEL = "stable"; /** From 00a8ea267cd6b16e82e1c9fdbe97e50ddafbf964 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 14 Dec 2023 16:54:42 +0000 Subject: [PATCH 03/14] 5.10.1 is next --- src/VersionInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 405e285fb..6c7963405 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -31,8 +31,8 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; - public const BASE_VERSION = "5.10.0"; - public const IS_DEVELOPMENT_BUILD = false; + public const BASE_VERSION = "5.10.1"; + public const IS_DEVELOPMENT_BUILD = true; public const BUILD_CHANNEL = "stable"; /** From 053abfbb6ff96b54e40f8038e0c1b5573cda8db1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 12:23:49 +0000 Subject: [PATCH 04/14] Bump actions/upload-artifact from 3 to 4 (#6199) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/draft-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index 9ffae467d..62fa41332 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -77,7 +77,7 @@ jobs: > build_info.json - name: Upload release artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: release_artifacts path: | From a03013d582881feacc0fb42b3cbdf1368a27d4ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 14:49:32 +0000 Subject: [PATCH 05/14] Bump phpstan/phpstan from 1.10.47 to 1.10.50 (#6198) Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.47 to 1.10.50. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/1.10.47...1.10.50) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- composer.json | 2 +- composer.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 1a19711e9..689e5ccb3 100644 --- a/composer.json +++ b/composer.json @@ -52,7 +52,7 @@ "symfony/filesystem": "~6.3.0" }, "require-dev": { - "phpstan/phpstan": "1.10.47", + "phpstan/phpstan": "1.10.50", "phpstan/phpstan-phpunit": "^1.1.0", "phpstan/phpstan-strict-rules": "^1.2.0", "phpunit/phpunit": "~10.3.0 || ~10.2.0 || ~10.1.0" diff --git a/composer.lock b/composer.lock index cc7af15d8..527ef0a88 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": "828ee775e4e3548ef3fb0d9690ca2f44", + "content-hash": "4797ac9fe9d3626738a7d13ae485fa2a", "packages": [ { "name": "adhocore/json-comment", @@ -1378,16 +1378,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.47", + "version": "1.10.50", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "84dbb33b520ea28b6cf5676a3941f4bae1c1ff39" + "reference": "06a98513ac72c03e8366b5a0cb00750b487032e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/84dbb33b520ea28b6cf5676a3941f4bae1c1ff39", - "reference": "84dbb33b520ea28b6cf5676a3941f4bae1c1ff39", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/06a98513ac72c03e8366b5a0cb00750b487032e4", + "reference": "06a98513ac72c03e8366b5a0cb00750b487032e4", "shasum": "" }, "require": { @@ -1436,7 +1436,7 @@ "type": "tidelift" } ], - "time": "2023-12-01T15:19:17+00:00" + "time": "2023-12-13T10:59:42+00:00" }, { "name": "phpstan/phpstan-phpunit", From 944dd7d3e4cca0fe9ceb79548293c56c92ed8da1 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 15 Dec 2023 15:19:44 +0000 Subject: [PATCH 06/14] BaseBanner: remove unnecessary array_filter() usage --- src/block/BaseBanner.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/block/BaseBanner.php b/src/block/BaseBanner.php index c2bbaf737..6b9e493d1 100644 --- a/src/block/BaseBanner.php +++ b/src/block/BaseBanner.php @@ -34,7 +34,6 @@ use pocketmine\math\AxisAlignedBB; use pocketmine\math\Vector3; use pocketmine\player\Player; use pocketmine\world\BlockTransaction; -use function array_filter; use function assert; use function count; @@ -89,11 +88,12 @@ abstract class BaseBanner extends Transparent{ * @return $this */ public function setPatterns(array $patterns) : self{ - $checked = array_filter($patterns, fn($v) => $v instanceof BannerPatternLayer); - if(count($checked) !== count($patterns)){ - throw new \TypeError("Deque must only contain " . BannerPatternLayer::class . " objects"); + foreach($patterns as $pattern){ + if(!$pattern instanceof BannerPatternLayer){ + throw new \TypeError("Array must only contain " . BannerPatternLayer::class . " objects"); + } } - $this->patterns = $checked; + $this->patterns = $patterns; return $this; } From d3d7f24015626442ccd73f92697ed9dd3999b565 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 15 Dec 2023 15:32:54 +0000 Subject: [PATCH 07/14] Noise: make calls with many parameters less nauseating to read --- src/world/generator/noise/Noise.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/world/generator/noise/Noise.php b/src/world/generator/noise/Noise.php index af9cefe14..54d3c2759 100644 --- a/src/world/generator/noise/Noise.php +++ b/src/world/generator/noise/Noise.php @@ -217,7 +217,13 @@ abstract class Noise{ for($xx = 0; $xx < $xSize; ++$xx){ if($xx % $samplingRate !== 0){ $nx = (int) ($xx / $samplingRate) * $samplingRate; - $noiseArray[$xx] = self::linearLerp($xx, $nx, $nx + $samplingRate, $noiseArray[$nx], $noiseArray[$nx + $samplingRate]); + $noiseArray[$xx] = self::linearLerp( + x: $xx, + x1: $nx, + x2: $nx + $samplingRate, + q0: $noiseArray[$nx], + q1: $noiseArray[$nx + $samplingRate] + ); } } @@ -253,9 +259,16 @@ abstract class Noise{ $nx = (int) ($xx / $samplingRate) * $samplingRate; $nz = (int) ($zz / $samplingRate) * $samplingRate; $noiseArray[$xx][$zz] = Noise::bilinearLerp( - $xx, $zz, $noiseArray[$nx][$nz], $noiseArray[$nx][$nz + $samplingRate], - $noiseArray[$nx + $samplingRate][$nz], $noiseArray[$nx + $samplingRate][$nz + $samplingRate], - $nx, $nx + $samplingRate, $nz, $nz + $samplingRate + x: $xx, + y: $zz, + q00: $noiseArray[$nx][$nz], + q01: $noiseArray[$nx][$nz + $samplingRate], + q10: $noiseArray[$nx + $samplingRate][$nz], + q11: $noiseArray[$nx + $samplingRate][$nz + $samplingRate], + x1: $nx, + x2: $nx + $samplingRate, + y1: $nz, + y2: $nz + $samplingRate ); } } From e1f4fd3048c3504d5af957705084f124dedb2824 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 15 Dec 2023 16:01:43 +0000 Subject: [PATCH 08/14] ProcessLoginTask: remove dead comments This is no longer an issue since b2df405cc0355dcffe202bc4040fae316940d427. --- src/network/mcpe/auth/ProcessLoginTask.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/network/mcpe/auth/ProcessLoginTask.php b/src/network/mcpe/auth/ProcessLoginTask.php index 607b75c89..c396338da 100644 --- a/src/network/mcpe/auth/ProcessLoginTask.php +++ b/src/network/mcpe/auth/ProcessLoginTask.php @@ -128,7 +128,6 @@ class ProcessLoginTask extends AsyncTask{ try{ [$headersArray, $claimsArray, ] = JwtUtils::parse($jwt); }catch(JwtException $e){ - //TODO: we shouldn't be showing internal information like this to the client throw new VerifyLoginException("Failed to parse JWT: " . $e->getMessage(), null, 0, $e); } @@ -141,13 +140,11 @@ class ProcessLoginTask extends AsyncTask{ /** @var JwtHeader $headers */ $headers = $mapper->map($headersArray, new JwtHeader()); }catch(\JsonMapper_Exception $e){ - //TODO: we shouldn't be showing internal information like this to the client throw new VerifyLoginException("Invalid JWT header: " . $e->getMessage(), null, 0, $e); } $headerDerKey = base64_decode($headers->x5u, true); if($headerDerKey === false){ - //TODO: we shouldn't be showing internal information like this to the client throw new VerifyLoginException("Invalid JWT public key: base64 decoding error decoding x5u"); } @@ -163,7 +160,6 @@ class ProcessLoginTask extends AsyncTask{ try{ $signingKeyOpenSSL = JwtUtils::parseDerPublicKey($headerDerKey); }catch(JwtException $e){ - //TODO: we shouldn't be showing this internal information to the client throw new VerifyLoginException("Invalid JWT public key: " . $e->getMessage(), null, 0, $e); } try{ From c8da9dea9545c917fcbf5fd1514e83186af3cc17 Mon Sep 17 00:00:00 2001 From: DiamondStrider1 <62265561+Swift-Strider@users.noreply.github.com> Date: Wed, 20 Dec 2023 11:38:00 +0100 Subject: [PATCH 09/14] WorldManager: Remove unused if in unloadWorld() (#6203) --- src/world/WorldManager.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/world/WorldManager.php b/src/world/WorldManager.php index bd968f904..ff603a2df 100644 --- a/src/world/WorldManager.php +++ b/src/world/WorldManager.php @@ -129,10 +129,6 @@ class WorldManager{ } $ev = new WorldUnloadEvent($world); - if($world === $this->defaultWorld && !$forceUnload){ - $ev->cancel(); - } - $ev->call(); if(!$forceUnload && $ev->isCancelled()){ From 90af8cfd694ef1132dde6eede85e12f2be4a6218 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 20 Dec 2023 14:29:02 +0000 Subject: [PATCH 10/14] Update composer dependencies --- composer.json | 2 +- composer.lock | 38 +++++++++++++++++++------------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/composer.json b/composer.json index 689e5ccb3..bcec3a72b 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "pocketmine/raklib-ipc": "^0.2.0", "pocketmine/snooze": "^0.5.0", "ramsey/uuid": "~4.7.0", - "symfony/filesystem": "~6.3.0" + "symfony/filesystem": "~6.4.0" }, "require-dev": { "phpstan/phpstan": "1.10.50", diff --git a/composer.lock b/composer.lock index 527ef0a88..f8e0b31af 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": "4797ac9fe9d3626738a7d13ae485fa2a", + "content-hash": "894648a63ed7cd84303937208d1684af", "packages": [ { "name": "adhocore/json-comment", @@ -922,16 +922,16 @@ }, { "name": "symfony/filesystem", - "version": "v6.3.1", + "version": "v6.4.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae" + "reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", - "reference": "edd36776956f2a6fcf577edb5b05eb0e3bdc52ae", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/952a8cb588c3bc6ce76f6023000fb932f16a6e59", + "reference": "952a8cb588c3bc6ce76f6023000fb932f16a6e59", "shasum": "" }, "require": { @@ -965,7 +965,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v6.3.1" + "source": "https://github.com/symfony/filesystem/tree/v6.4.0" }, "funding": [ { @@ -981,7 +981,7 @@ "type": "tidelift" } ], - "time": "2023-06-01T08:30:39+00:00" + "time": "2023-07-26T17:27:13+00:00" }, { "name": "symfony/polyfill-ctype", @@ -1211,16 +1211,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.17.1", + "version": "v4.18.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999", + "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999", "shasum": "" }, "require": { @@ -1261,9 +1261,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0" }, - "time": "2023-08-13T19:53:39+00:00" + "time": "2023-12-10T21:03:43+00:00" }, { "name": "phar-io/manifest", @@ -1541,16 +1541,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.9", + "version": "10.1.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "a56a9ab2f680246adcf3db43f38ddf1765774735" + "reference": "599109c8ca6bae97b23482d557d2874c25a65e59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/a56a9ab2f680246adcf3db43f38ddf1765774735", - "reference": "a56a9ab2f680246adcf3db43f38ddf1765774735", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/599109c8ca6bae97b23482d557d2874c25a65e59", + "reference": "599109c8ca6bae97b23482d557d2874c25a65e59", "shasum": "" }, "require": { @@ -1607,7 +1607,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.9" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.10" }, "funding": [ { @@ -1615,7 +1615,7 @@ "type": "github" } ], - "time": "2023-11-23T12:23:20+00:00" + "time": "2023-12-11T06:28:43+00:00" }, { "name": "phpunit/php-file-iterator", From 74cb0be868b5a56023bd6a17d91833a184df831e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 20 Dec 2023 14:32:05 +0000 Subject: [PATCH 11/14] Noise: give PHPStan some help understanding SplFixedArray --- src/world/generator/noise/Noise.php | 2 ++ tests/phpstan/configs/actual-problems.neon | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/world/generator/noise/Noise.php b/src/world/generator/noise/Noise.php index 54d3c2759..d91a58350 100644 --- a/src/world/generator/noise/Noise.php +++ b/src/world/generator/noise/Noise.php @@ -208,6 +208,7 @@ abstract class Noise{ throw new \InvalidArgumentException("xSize % samplingRate must return 0"); } + /** @phpstan-var \SplFixedArray $noiseArray */ $noiseArray = new \SplFixedArray($xSize + 1); for($xx = 0; $xx <= $xSize; $xx += $samplingRate){ @@ -240,6 +241,7 @@ abstract class Noise{ assert($xSize % $samplingRate === 0, new \InvalidArgumentException("xSize % samplingRate must return 0")); assert($zSize % $samplingRate === 0, new \InvalidArgumentException("zSize % samplingRate must return 0")); + /** @phpstan-var \SplFixedArray<\SplFixedArray> $noiseArray */ $noiseArray = new \SplFixedArray($xSize + 1); for($xx = 0; $xx <= $xSize; $xx += $samplingRate){ diff --git a/tests/phpstan/configs/actual-problems.neon b/tests/phpstan/configs/actual-problems.neon index 51454a708..9fea3803d 100644 --- a/tests/phpstan/configs/actual-problems.neon +++ b/tests/phpstan/configs/actual-problems.neon @@ -1070,6 +1070,21 @@ parameters: count: 1 path: ../../../src/world/generator/hell/Nether.php + - + message: "#^Offset int does not exist on SplFixedArray\\\\|null\\.$#" + count: 4 + path: ../../../src/world/generator/noise/Noise.php + + - + message: "#^Parameter \\$q0 of static method pocketmine\\\\world\\\\generator\\\\noise\\\\Noise\\:\\:linearLerp\\(\\) expects float, float\\|null given\\.$#" + count: 1 + path: ../../../src/world/generator/noise/Noise.php + + - + message: "#^Parameter \\$q1 of static method pocketmine\\\\world\\\\generator\\\\noise\\\\Noise\\:\\:linearLerp\\(\\) expects float, float\\|null given\\.$#" + count: 1 + path: ../../../src/world/generator/noise/Noise.php + - message: "#^Cannot call method getBiomeId\\(\\) on pocketmine\\\\world\\\\format\\\\Chunk\\|null\\.$#" count: 1 From 58ce746ae10771279e553fdb2ac39202f850407d Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 20 Dec 2023 14:44:24 +0000 Subject: [PATCH 12/14] Remove dead PHPStan ignored error --- tests/phpstan/configs/phpstan-bugs.neon | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/phpstan/configs/phpstan-bugs.neon b/tests/phpstan/configs/phpstan-bugs.neon index b3bf3dadd..af0486611 100644 --- a/tests/phpstan/configs/phpstan-bugs.neon +++ b/tests/phpstan/configs/phpstan-bugs.neon @@ -1,10 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Instanceof between pocketmine\\\\block\\\\utils\\\\BannerPatternLayer and pocketmine\\\\block\\\\utils\\\\BannerPatternLayer will always evaluate to true\\.$#" - count: 1 - path: ../../../src/block/BaseBanner.php - - message: "#^Method pocketmine\\\\block\\\\CakeWithCandle\\:\\:onInteractCandle\\(\\) has parameter \\$returnedItems with no value type specified in iterable type array\\.$#" count: 1 From 8dc28b7ea8e7337783dd85c91f73662f9b6283ee Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 20 Dec 2023 15:15:43 +0000 Subject: [PATCH 13/14] RuntimeDataDescriber: remove useless template parameter --- src/data/runtime/LegacyRuntimeEnumDescriberTrait.php | 5 ----- src/data/runtime/RuntimeDataDescriber.php | 4 ---- 2 files changed, 9 deletions(-) diff --git a/src/data/runtime/LegacyRuntimeEnumDescriberTrait.php b/src/data/runtime/LegacyRuntimeEnumDescriberTrait.php index dd35fabfb..3c540f7fa 100644 --- a/src/data/runtime/LegacyRuntimeEnumDescriberTrait.php +++ b/src/data/runtime/LegacyRuntimeEnumDescriberTrait.php @@ -29,11 +29,6 @@ namespace pocketmine\data\runtime; * @deprecated */ trait LegacyRuntimeEnumDescriberTrait{ - - /** - * @phpstan-template T of \UnitEnum - * @phpstan-param T $case - */ abstract protected function enum(\UnitEnum &$case) : void; public function bellAttachmentType(\pocketmine\block\utils\BellAttachmentType &$value) : void{ diff --git a/src/data/runtime/RuntimeDataDescriber.php b/src/data/runtime/RuntimeDataDescriber.php index 04217f5df..6f1d35b98 100644 --- a/src/data/runtime/RuntimeDataDescriber.php +++ b/src/data/runtime/RuntimeDataDescriber.php @@ -89,10 +89,6 @@ interface RuntimeDataDescriber extends RuntimeEnumDescriber{ public function straightOnlyRailShape(int &$railShape) : void; - /** - * @phpstan-template T of \UnitEnum - * @phpstan-param T $case - */ public function enum(\UnitEnum &$case) : void; /** From 80125f9b193a453f6d13df1cca5a0e911f044123 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 20 Dec 2023 15:20:28 +0000 Subject: [PATCH 14/14] Modernize single-use phpstan-template tags --- src/event/HandlerList.php | 3 +-- src/event/HandlerListManager.php | 6 ++---- src/timings/Timings.php | 6 ++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/event/HandlerList.php b/src/event/HandlerList.php index 74eedf3a4..2072cd522 100644 --- a/src/event/HandlerList.php +++ b/src/event/HandlerList.php @@ -37,8 +37,7 @@ class HandlerList{ private array $affectedHandlerCaches = []; /** - * @phpstan-template TEvent of Event - * @phpstan-param class-string $class + * @phpstan-param class-string $class */ public function __construct( private string $class, diff --git a/src/event/HandlerListManager.php b/src/event/HandlerListManager.php index 047632f54..605a38747 100644 --- a/src/event/HandlerListManager.php +++ b/src/event/HandlerListManager.php @@ -86,8 +86,7 @@ class HandlerListManager{ * * Calling this method also lazily initializes the $classMap inheritance tree of handler lists. * - * @phpstan-template TEvent of Event - * @phpstan-param class-string $event + * @phpstan-param class-string $event * * @throws \ReflectionException * @throws \InvalidArgumentException @@ -113,8 +112,7 @@ class HandlerListManager{ } /** - * @phpstan-template TEvent of Event - * @phpstan-param class-string $event + * @phpstan-param class-string $event * * @return RegisteredListener[] */ diff --git a/src/timings/Timings.php b/src/timings/Timings.php index 61a8bbc92..563af69bf 100644 --- a/src/timings/Timings.php +++ b/src/timings/Timings.php @@ -210,8 +210,7 @@ abstract class Timings{ } /** - * @phpstan-template T of object - * @phpstan-param class-string $class + * @phpstan-param class-string $class */ private static function shortenCoreClassName(string $class, string $prefix) : string{ if(str_starts_with($class, $prefix)){ @@ -302,8 +301,7 @@ abstract class Timings{ } /** - * @phpstan-template TEvent of Event - * @phpstan-param class-string $event + * @phpstan-param class-string $event */ public static function getEventHandlerTimings(string $event, string $handlerName, string $group) : TimingsHandler{ if(!isset(self::$eventHandlers[$event][$handlerName])){