From 29e2d92098736d397c5f38efc8e1fc96cfd9575f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Nov 2021 11:27:42 +0000 Subject: [PATCH 1/3] Bump phpstan/phpstan from 1.0.0 to 1.0.1 (#4541) Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.0.0 to 1.0.1. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Commits](https://github.com/phpstan/phpstan/compare/1.0.0...1.0.1) --- 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 | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index fccbfaccc..01c384bcc 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "pocketmine/spl": "^0.4.0" }, "require-dev": { - "phpstan/phpstan": "1.0.0", + "phpstan/phpstan": "1.0.1", "phpstan/phpstan-phpunit": "^1.0.0", "phpstan/phpstan-strict-rules": "^1.0.0", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index 399d6141b..48796f4b5 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": "c55df4140fb828ab8add33e0a0e84136", + "content-hash": "9600d7526f3a45137fc4ba7030b2d58d", "packages": [ { "name": "adhocore/json-comment", @@ -1011,16 +1011,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0d13a99513182e521271d46bde8f28caa4f84d97" + "reference": "0eb6ecdfbcebf2207668087dfb2e215581a75023" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0d13a99513182e521271d46bde8f28caa4f84d97", - "reference": "0d13a99513182e521271d46bde8f28caa4f84d97", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0eb6ecdfbcebf2207668087dfb2e215581a75023", + "reference": "0eb6ecdfbcebf2207668087dfb2e215581a75023", "shasum": "" }, "require": { @@ -1051,7 +1051,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.0.0" + "source": "https://github.com/phpstan/phpstan/tree/1.0.1" }, "funding": [ { @@ -1071,7 +1071,7 @@ "type": "tidelift" } ], - "time": "2021-11-01T06:38:20+00:00" + "time": "2021-11-02T10:25:31+00:00" }, { "name": "phpstan/phpstan-phpunit", From 729f831b8f1d9627edfcd8cea255ed214e1f5920 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 3 Nov 2021 20:26:32 +0000 Subject: [PATCH 2/3] PHPStan 1.0.2 --- composer.json | 2 +- composer.lock | 14 +++++++------- tests/phpstan/configs/phpstan-bugs.neon | 10 ---------- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/composer.json b/composer.json index 01c384bcc..15ee28133 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "pocketmine/spl": "^0.4.0" }, "require-dev": { - "phpstan/phpstan": "1.0.1", + "phpstan/phpstan": "1.0.2", "phpstan/phpstan-phpunit": "^1.0.0", "phpstan/phpstan-strict-rules": "^1.0.0", "phpunit/phpunit": "^9.2" diff --git a/composer.lock b/composer.lock index 48796f4b5..6ef7a0726 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": "9600d7526f3a45137fc4ba7030b2d58d", + "content-hash": "352902efd3a960977acfb3ae7bda38da", "packages": [ { "name": "adhocore/json-comment", @@ -1011,16 +1011,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "0eb6ecdfbcebf2207668087dfb2e215581a75023" + "reference": "e9e2a501102ba0b126b2f63a7f0a3b151056fe91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0eb6ecdfbcebf2207668087dfb2e215581a75023", - "reference": "0eb6ecdfbcebf2207668087dfb2e215581a75023", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e9e2a501102ba0b126b2f63a7f0a3b151056fe91", + "reference": "e9e2a501102ba0b126b2f63a7f0a3b151056fe91", "shasum": "" }, "require": { @@ -1051,7 +1051,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.0.1" + "source": "https://github.com/phpstan/phpstan/tree/1.0.2" }, "funding": [ { @@ -1071,7 +1071,7 @@ "type": "tidelift" } ], - "time": "2021-11-02T10:25:31+00:00" + "time": "2021-11-03T16:09:51+00:00" }, { "name": "phpstan/phpstan-phpunit", diff --git a/tests/phpstan/configs/phpstan-bugs.neon b/tests/phpstan/configs/phpstan-bugs.neon index 4291463fa..fdc5a57df 100644 --- a/tests/phpstan/configs/phpstan-bugs.neon +++ b/tests/phpstan/configs/phpstan-bugs.neon @@ -80,16 +80,6 @@ parameters: count: 1 path: ../../../src/pocketmine/network/mcpe/protocol/DataPacket.php - - - message: "#^Parameter \\#1 \\$array of function array_values expects array, array given\\.$#" - count: 1 - path: ../../../src/pocketmine/plugin/PluginDescription.php - - - - message: "#^Parameter \\#2 \\$array of function array_map expects array, array given\\.$#" - count: 3 - path: ../../../src/pocketmine/plugin/PluginDescription.php - - message: "#^Dead catch \\- ReflectionException is never thrown in the try block\\.$#" count: 2 From e0b07ff3087b652407439a29c941f3b66ca92c86 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 3 Nov 2021 20:45:55 +0000 Subject: [PATCH 3/3] Human: do not add more XP if totalXp limit was already reached this matches the vanilla behaviour. For some reason it doesn't consider levels (so you can have a level higher or lower than this without actually having that amount of XP), but this matches Java behaviour as of 1.10. fixes #4543 --- src/pocketmine/entity/Human.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pocketmine/entity/Human.php b/src/pocketmine/entity/Human.php index 9d590db0c..5036415bd 100644 --- a/src/pocketmine/entity/Human.php +++ b/src/pocketmine/entity/Human.php @@ -403,6 +403,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ * @param bool $playSound Whether to play level-up and XP gained sounds. */ public function addXp(int $amount, bool $playSound = true) : bool{ + $amount = min($amount, INT32_MAX - $this->totalXp); $oldLevel = $this->getXpLevel(); $oldTotal = $this->getCurrentTotalXp();