Compare commits

..

40 Commits
4.0.5 ... 4.0.7

Author SHA1 Message Date
58ba4f680f Release 4.0.7 2022-01-21 19:39:30 +00:00
8c5cc67e07 Updated baseline 2022-01-21 19:38:59 +00:00
ab8b24bcd2 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2022-01-21 19:15:59 +00:00
94c4f58667 Fixed bogus test 2022-01-21 19:13:36 +00:00
c10eda5eae InGamePacketHandler: limit depth of form responses to 2
form responses should only contain string|int|float|bool|null. Arrays or objects appearing in here are likely malicious.
2022-01-21 19:11:58 +00:00
ed312863a7 ignore phpstan bug 2022-01-21 18:43:53 +00:00
387c13beff InGamePacketHandler: fixed invalid JSON being treated as form close 2022-01-21 18:32:58 +00:00
56fe71d939 InGamePacketHandler: fixed crash in form handling when invalid JSON is given 2022-01-21 17:34:13 +00:00
73d8c87b76 Bump phpunit/phpunit from 9.5.11 to 9.5.12 (#4748)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.11 to 9.5.12.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.11...9.5.12)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-21 14:53:03 +00:00
061d851fbd World: do not update entities which have been flagged for despawn
fixes #4718
2022-01-20 16:27:21 +00:00
a67aef0477 PlayerInteractEvent: updated documentation 2022-01-20 16:10:37 +00:00
858024afb7 Remove useless docs noticed by php-cs-fixer 3.5 2022-01-18 00:24:12 +00:00
eaaf00ca2b Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2022-01-18 00:23:39 +00:00
f1723acfd3 UnsafeForeachArrayOfStringRule: use statically analysable function reference
this will ensure that it get automatically updated during refactors.
2022-01-18 00:23:29 +00:00
8da27ea0aa UnsafeForeachArrayOfStringRule: fixed outdated function name 2022-01-18 00:15:44 +00:00
388622d55d Bump pocketmine/locale-data from 2.3.0 to 2.3.33 (#4735)
Bumps [pocketmine/locale-data](https://github.com/pmmp/Language) from 2.3.0 to 2.3.33.
- [Release notes](https://github.com/pmmp/Language/releases)
- [Commits](https://github.com/pmmp/Language/compare/2.3.0...2.3.33)

---
updated-dependencies:
- dependency-name: pocketmine/locale-data
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-17 20:46:38 +00:00
9f4fcfafdb Fixed some incorrect block breaking times (#4723) 2022-01-16 20:57:16 +00:00
6679c53e56 BrewingStand: fixed collision box 2022-01-15 16:41:27 +00:00
9d061e86af 4.0.7 is next 2022-01-13 21:46:30 +00:00
f7d25f251e Release 4.0.6 2022-01-13 21:46:30 +00:00
0ccb47fb07 make-release: trap more errors 2022-01-13 21:46:06 +00:00
0973472842 actions: bump to 8.0.14 2022-01-13 21:23:23 +00:00
f126479c37 InGamePacketHandler: check the validity of facing values given by the client 2022-01-13 21:21:15 +00:00
d34f4b28b3 Bump pocketmine/binaryutils from 0.2.3 to 0.2.4 (#4726)
Bumps [pocketmine/binaryutils](https://github.com/pmmp/BinaryUtils) from 0.2.3 to 0.2.4.
- [Release notes](https://github.com/pmmp/BinaryUtils/releases)
- [Commits](https://github.com/pmmp/BinaryUtils/compare/0.2.3...0.2.4)

---
updated-dependencies:
- dependency-name: pocketmine/binaryutils
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-13 14:21:32 +00:00
8a65fd273a Updated RakLib to 0.14.3 2022-01-10 22:29:38 +00:00
248cc0ef49 actions: colorize diff output on CS failure 2022-01-10 22:06:07 +00:00
d1726aa20c CS: use fully_qualified_strict_types 2022-01-10 21:41:56 +00:00
58e1e7bd6f Worker: fixed missing AsyncTask import for documentation (#4719)
OCD from f5c9c02e09
2022-01-10 15:12:37 +00:00
0a5b146189 substr() returns an empty string instead of false in 8.0
an empty string will pass through preg_match_all() without any harmful effects, so we don't need to check for it.
2022-01-07 22:38:00 +00:00
b4e1871899 Updated PHPStan baseline 2022-01-07 21:49:49 +00:00
78eaa0993d Merge branch 'legacy/pm3' into stable 2022-01-07 21:48:28 +00:00
bee2aba813 Updated PHPStan baseline 2022-01-07 21:46:35 +00:00
af81f80cf3 Updated PHPStan 2022-01-07 21:45:35 +00:00
43c5d08042 Merge branch 'stable' of github.com:pmmp/PocketMine-MP into stable 2022-01-07 20:15:30 +00:00
6d249026cc Merge branch 'legacy/pm3' into stable 2022-01-07 20:15:15 +00:00
ed2145b6a4 php-cs-fixer: enforce EOF newlines 2022-01-07 20:12:21 +00:00
3e6c157217 Bump phpstan/phpstan from 1.3.1 to 1.3.3 (#4712)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.3.1 to 1.3.3.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/master/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.3.1...1.3.3)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-07 15:20:33 +00:00
86beeb8255 readme: update badge links
[ci skip]
2022-01-06 17:11:03 +00:00
230a3c9839 Bump phpstan/phpstan from 1.2.0 to 1.3.1 (#4702)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.2.0 to 1.3.1.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/master/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.2.0...1.3.1)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-05 13:49:29 +00:00
35f205b476 4.0.6 is next 2022-01-04 20:51:37 +00:00
56 changed files with 216 additions and 163 deletions

View File

@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
php: [8.0.14]
steps:
- name: Build and prepare PHP cache
@ -31,7 +31,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
php: [8.0.14]
steps:
- uses: actions/checkout@v2
@ -69,7 +69,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
php: [8.0.14]
steps:
- uses: actions/checkout@v2
@ -107,7 +107,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
php: [8.0.14]
steps:
- uses: actions/checkout@v2
@ -147,7 +147,7 @@ jobs:
fail-fast: false
matrix:
image: [ubuntu-20.04]
php: [8.0.11]
php: [8.0.14]
steps:
- uses: actions/checkout@v2
@ -201,4 +201,4 @@ jobs:
tools: php-cs-fixer:3.2
- name: Run PHP-CS-Fixer
run: php-cs-fixer fix --dry-run --diff
run: php-cs-fixer fix --dry-run --diff --ansi

View File

@ -36,6 +36,7 @@ return (new PhpCsFixer\Config)
],
'declare_strict_types' => true,
'elseif' => true,
'fully_qualified_strict_types' => true,
'global_namespace_import' => [
'import_constants' => true,
'import_functions' => true,
@ -74,6 +75,7 @@ return (new PhpCsFixer\Config)
'return_type_declaration' => [
'space_before' => 'one'
],
'single_blank_line_at_eof' => true,
'single_import_per_statement' => true,
'strict_param' => true,
'unary_operator_spaces' => true,

View File

@ -4,13 +4,13 @@
</p>
<p align="center">
<img src="https://github.com/pmmp/PocketMine-MP/workflows/CI/badge.svg" alt="CI" />
<img alt="GitHub release (latest SemVer)" src="https://img.shields.io/github/v/release/pmmp/PocketMine-MP?label=release&sort=semver">
<a href="https://github.com/pmmp/PocketMine-MP/actions/workflows/main.yml"><img src="https://github.com/pmmp/PocketMine-MP/workflows/CI/badge.svg" alt="CI" /></a>
<a href="https://github.com/pmmp/PocketMine-MP/releases/latest"><img alt="GitHub release (latest SemVer)" src="https://img.shields.io/github/v/release/pmmp/PocketMine-MP?label=release&sort=semver"></a>
<a href="https://hub.docker.com/r/pmmp/pocketmine-mp"><img src="https://img.shields.io/docker/v/pmmp/pocketmine-mp?logo=docker&label=image" alt="Docker image version (latest semver)" /></a>
<a href="https://discord.gg/bmSAZBG"><img src="https://img.shields.io/discord/373199722573201408?label=discord&color=7289DA&logo=discord" alt="Discord" /></a>
<br>
<img alt="GitHub all releases" src="https://img.shields.io/github/downloads/pmmp/PocketMine-MP/total?label=downloads%40total">
<img alt="GitHub release (latest by SemVer)" src="https://img.shields.io/github/downloads/pmmp/PocketMine-MP/latest/total?sort=semver">
<a href="https://github.com/pmmp/PocketMine-MP/releases"><img alt="GitHub all releases" src="https://img.shields.io/github/downloads/pmmp/PocketMine-MP/total?label=downloads%40total"></a>
<a href="https://github.com/pmmp/PocketMine-MP/releases/latest"><img alt="GitHub release (latest by SemVer)" src="https://img.shields.io/github/downloads/pmmp/PocketMine-MP/latest/total?sort=semver"></a>
</p>
## Getting started

View File

@ -116,4 +116,3 @@ foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($argv[1],
echo "No changes made to file $file\n";
}
}

View File

@ -75,6 +75,14 @@ const ACCEPTED_OPTS = [
"channel" => "Release channel to post this build into"
];
function systemWrapper(string $command, string $errorMessage) : void{
system($command, $result);
if($result !== 0){
echo "error: $errorMessage; aborting\n";
exit(1);
}
}
function main() : void{
$filteredOpts = [];
foreach(Utils::stringifyKeys(getopt("", ["current:", "next:", "channel:", "help"])) as $optName => $optValue){
@ -115,7 +123,7 @@ function main() : void{
echo "$currentVer will be published on release channel \"$channel\".\n";
echo "please add appropriate notes to the changelog and press enter...";
fgets(STDIN);
system('git add "' . dirname(__DIR__) . '/changelogs"');
systemWrapper('git add "' . dirname(__DIR__) . '/changelogs"', "failed to stage changelog changes");
system('git diff --cached --quiet "' . dirname(__DIR__) . '/changelogs"', $result);
if($result === 0){
echo "error: no changelog changes detected; aborting\n";
@ -123,14 +131,15 @@ function main() : void{
}
$versionInfoPath = dirname(__DIR__) . '/src/VersionInfo.php';
replaceVersion($versionInfoPath, $currentVer->getBaseVersion(), false, $channel);
system('git commit -m "Release ' . $currentVer->getBaseVersion() . '" --include "' . $versionInfoPath . '"');
system('git tag ' . $currentVer->getBaseVersion());
systemWrapper('git commit -m "Release ' . $currentVer->getBaseVersion() . '" --include "' . $versionInfoPath . '"', "failed to create release commit");
systemWrapper('git tag ' . $currentVer->getBaseVersion(), "failed to create release tag");
replaceVersion($versionInfoPath, $nextVer->getBaseVersion(), true, $channel);
system('git add "' . $versionInfoPath . '"');
system('git commit -m "' . $nextVer->getBaseVersion() . ' is next" --include "' . $versionInfoPath . '"');
systemWrapper('git add "' . $versionInfoPath . '"', "failed to stage changes for post-release commit");
systemWrapper('git commit -m "' . $nextVer->getBaseVersion() . ' is next" --include "' . $versionInfoPath . '"', "failed to create post-release commit");
echo "pushing changes in 5 seconds\n";
sleep(5);
system('git push origin HEAD ' . $currentVer->getBaseVersion());
systemWrapper('git push origin HEAD ' . $currentVer->getBaseVersion(), "failed to push changes to remote");
}
main();

View File

@ -1600,3 +1600,23 @@ Released 4th January 2022.
- Fixed several denial-of-service attack vectors related to skin data field lengths.
- Fixed food bar desync when cancelling `PlayerItemConsumeEvent` in a plugin.
- Fixed compass needles not updating when the world spawn is changed.
# 4.0.6
Released 13th January 2022.
## Fixes
- Fixed server crash on invalid facing values provided by the client when placing or breaking blocks.
- Fixed documentation link to AsyncTask in Worker.
# 4.0.7
Released 21st January 2022.
## General
- Max nesting of form responses is now limited to 2.
- Updated outdated documentation of `PlayerInteractEvent`.
## Fixes
- Fixed server crash on invalid JSON provided by the client in `ModalFormResponsePacket`.
- Fixed ender pearls teleporting players when thrown by a player directly against a wall when cancelling `ProjectileLaunchEvent`.
- Fixed collision box of brewing stand.
- Fixed break times and tool types of bamboo, nether wart blocks, infested stone and leaves.

View File

@ -53,7 +53,7 @@
"webmozart/path-util": "^2.3"
},
"require-dev": {
"phpstan/phpstan": "1.2.0",
"phpstan/phpstan": "1.3.3",
"phpstan/phpstan-phpunit": "^1.0.0",
"phpstan/phpstan-strict-rules": "^1.0.0",
"phpunit/phpunit": "^9.2"

126
composer.lock generated
View File

@ -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": "5dc75b1eaa0493544081f223d3e2304c",
"content-hash": "055bec16a9bbc839f4410d09b09f2703",
"packages": [
{
"name": "adhocore/json-comment",
@ -322,16 +322,16 @@
},
{
"name": "pocketmine/binaryutils",
"version": "0.2.3",
"version": "0.2.4",
"source": {
"type": "git",
"url": "https://github.com/pmmp/BinaryUtils.git",
"reference": "dc94786fc6c30012b1892f548dbb8a8c9c0a8cd9"
"reference": "5ac7eea91afbad8dc498f5ce34ce6297d5e6ea9a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/BinaryUtils/zipball/dc94786fc6c30012b1892f548dbb8a8c9c0a8cd9",
"reference": "dc94786fc6c30012b1892f548dbb8a8c9c0a8cd9",
"url": "https://api.github.com/repos/pmmp/BinaryUtils/zipball/5ac7eea91afbad8dc498f5ce34ce6297d5e6ea9a",
"reference": "5ac7eea91afbad8dc498f5ce34ce6297d5e6ea9a",
"shasum": ""
},
"require": {
@ -340,7 +340,7 @@
},
"require-dev": {
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "1.2.0",
"phpstan/phpstan": "1.3.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0.0",
"phpunit/phpunit": "^9.5"
@ -358,9 +358,9 @@
"description": "Classes and methods for conveniently handling binary data",
"support": {
"issues": "https://github.com/pmmp/BinaryUtils/issues",
"source": "https://github.com/pmmp/BinaryUtils/tree/0.2.3"
"source": "https://github.com/pmmp/BinaryUtils/tree/0.2.4"
},
"time": "2021-12-04T20:56:05+00:00"
"time": "2022-01-12T18:06:33+00:00"
},
{
"name": "pocketmine/callback-validator",
@ -535,16 +535,16 @@
},
{
"name": "pocketmine/locale-data",
"version": "2.3.0",
"version": "2.3.33",
"source": {
"type": "git",
"url": "https://github.com/pmmp/Language.git",
"reference": "a16e5899709387ff03db8bba7f903a15c7c0a9af"
"reference": "44998ca9c055f872a33e59cd4d2736d081ba84b5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/Language/zipball/a16e5899709387ff03db8bba7f903a15c7c0a9af",
"reference": "a16e5899709387ff03db8bba7f903a15c7c0a9af",
"url": "https://api.github.com/repos/pmmp/Language/zipball/44998ca9c055f872a33e59cd4d2736d081ba84b5",
"reference": "44998ca9c055f872a33e59cd4d2736d081ba84b5",
"shasum": ""
},
"type": "library",
@ -552,9 +552,9 @@
"description": "Language resources used by PocketMine-MP",
"support": {
"issues": "https://github.com/pmmp/Language/issues",
"source": "https://github.com/pmmp/Language/tree/2.3.0"
"source": "https://github.com/pmmp/Language/tree/2.3.33"
},
"time": "2022-01-04T00:42:11+00:00"
"time": "2022-01-16T22:08:04+00:00"
},
{
"name": "pocketmine/log",
@ -726,16 +726,16 @@
},
{
"name": "pocketmine/raklib",
"version": "0.14.2",
"version": "0.14.3",
"source": {
"type": "git",
"url": "https://github.com/pmmp/RakLib.git",
"reference": "e3a861187470e1facc6625040128f447ebbcbaec"
"reference": "4798576fec0364266dce23b368a7fec5e5de7927"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/e3a861187470e1facc6625040128f447ebbcbaec",
"reference": "e3a861187470e1facc6625040128f447ebbcbaec",
"url": "https://api.github.com/repos/pmmp/RakLib/zipball/4798576fec0364266dce23b368a7fec5e5de7927",
"reference": "4798576fec0364266dce23b368a7fec5e5de7927",
"shasum": ""
},
"require": {
@ -747,8 +747,8 @@
"pocketmine/log": "^0.3.0 || ^0.4.0"
},
"require-dev": {
"phpstan/phpstan": "0.12.99",
"phpstan/phpstan-strict-rules": "^0.12.2"
"phpstan/phpstan": "1.3.3",
"phpstan/phpstan-strict-rules": "^1.0"
},
"type": "library",
"autoload": {
@ -763,9 +763,9 @@
"description": "A RakNet server implementation written in PHP",
"support": {
"issues": "https://github.com/pmmp/RakLib/issues",
"source": "https://github.com/pmmp/RakLib/tree/0.14.2"
"source": "https://github.com/pmmp/RakLib/tree/0.14.3"
},
"time": "2021-10-04T20:39:11+00:00"
"time": "2022-01-10T21:29:48+00:00"
},
{
"name": "pocketmine/raklib-ipc",
@ -1027,21 +1027,24 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.23.0",
"version": "v1.24.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce"
"reference": "30885182c981ab175d4d034db0f6f469898070ab"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab",
"reference": "30885182c981ab175d4d034db0f6f469898070ab",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"provide": {
"ext-ctype": "*"
},
"suggest": {
"ext-ctype": "For best performance"
},
@ -1086,7 +1089,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0"
},
"funding": [
{
@ -1102,20 +1105,20 @@
"type": "tidelift"
}
],
"time": "2021-02-19T12:13:01+00:00"
"time": "2021-10-20T20:35:02+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.23.1",
"version": "v1.24.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be"
"reference": "57b712b08eddb97c762a8caa32c84e037892d2e9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be",
"reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9",
"reference": "57b712b08eddb97c762a8caa32c84e037892d2e9",
"shasum": ""
},
"require": {
@ -1169,7 +1172,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0"
},
"funding": [
{
@ -1185,20 +1188,20 @@
"type": "tidelift"
}
],
"time": "2021-07-28T13:41:28+00:00"
"time": "2021-09-13T13:58:33+00:00"
},
{
"name": "symfony/polyfill-php81",
"version": "v1.23.0",
"version": "v1.24.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php81.git",
"reference": "e66119f3de95efc359483f810c4c3e6436279436"
"reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/e66119f3de95efc359483f810c4c3e6436279436",
"reference": "e66119f3de95efc359483f810c4c3e6436279436",
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f",
"reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f",
"shasum": ""
},
"require": {
@ -1248,7 +1251,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php81/tree/v1.23.0"
"source": "https://github.com/symfony/polyfill-php81/tree/v1.24.0"
},
"funding": [
{
@ -1264,7 +1267,7 @@
"type": "tidelift"
}
],
"time": "2021-05-21T13:25:03+00:00"
"time": "2021-09-13T13:58:11+00:00"
},
{
"name": "webmozart/assert",
@ -1463,9 +1466,6 @@
"require": {
"php": "^7.1 || ^8.0"
},
"replace": {
"myclabs/deep-copy": "self.version"
},
"require-dev": {
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
@ -1783,16 +1783,16 @@
},
{
"name": "phpdocumentor/type-resolver",
"version": "1.5.1",
"version": "1.6.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae"
"reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae",
"reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706",
"reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706",
"shasum": ""
},
"require": {
@ -1827,9 +1827,9 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1"
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0"
},
"time": "2021-10-02T14:08:47+00:00"
"time": "2022-01-04T19:58:01+00:00"
},
{
"name": "phpspec/prophecy",
@ -1900,16 +1900,16 @@
},
{
"name": "phpstan/phpstan",
"version": "1.2.0",
"version": "1.3.3",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "cbe085f9fdead5b6d62e4c022ca52dc9427a10ee"
"reference": "151a51f6149855785fbd883e79768c0abc96b75f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/cbe085f9fdead5b6d62e4c022ca52dc9427a10ee",
"reference": "cbe085f9fdead5b6d62e4c022ca52dc9427a10ee",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/151a51f6149855785fbd883e79768c0abc96b75f",
"reference": "151a51f6149855785fbd883e79768c0abc96b75f",
"shasum": ""
},
"require": {
@ -1925,7 +1925,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2-dev"
"dev-master": "1.3-dev"
}
},
"autoload": {
@ -1940,7 +1940,7 @@
"description": "PHPStan - PHP Static Analysis Tool",
"support": {
"issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.2.0"
"source": "https://github.com/phpstan/phpstan/tree/1.3.3"
},
"funding": [
{
@ -1960,7 +1960,7 @@
"type": "tidelift"
}
],
"time": "2021-11-18T14:09:01+00:00"
"time": "2022-01-07T09:49:03+00:00"
},
{
"name": "phpstan/phpstan-phpunit",
@ -2388,16 +2388,16 @@
},
{
"name": "phpunit/phpunit",
"version": "9.5.11",
"version": "9.5.12",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "2406855036db1102126125537adb1406f7242fdd"
"reference": "93d4bf4c37aec6384bb9e5d390d9049a463a7256"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2406855036db1102126125537adb1406f7242fdd",
"reference": "2406855036db1102126125537adb1406f7242fdd",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/93d4bf4c37aec6384bb9e5d390d9049a463a7256",
"reference": "93d4bf4c37aec6384bb9e5d390d9049a463a7256",
"shasum": ""
},
"require": {
@ -2475,7 +2475,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.11"
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.12"
},
"funding": [
{
@ -2487,7 +2487,7 @@
"type": "github"
}
],
"time": "2021-12-25T07:07:57+00:00"
"time": "2022-01-21T05:54:47+00:00"
},
{
"name": "sebastian/cli-parser",
@ -3541,5 +3541,5 @@
"platform-overrides": {
"php": "8.0.0"
},
"plugin-api-version": "2.1.0"
"plugin-api-version": "2.2.0"
}

View File

@ -31,7 +31,7 @@ use function str_repeat;
final class VersionInfo{
public const NAME = "PocketMine-MP";
public const BASE_VERSION = "4.0.5";
public const BASE_VERSION = "4.0.7";
public const IS_DEVELOPMENT_BUILD = false;
public const BUILD_CHANNEL = "stable";

View File

@ -115,7 +115,14 @@ class BlockFactory{
$this->registerAllMeta(new ActivatorRail(new BID(Ids::ACTIVATOR_RAIL, 0), "Activator Rail", $railBreakInfo));
$this->registerAllMeta(new Air(new BID(Ids::AIR, 0), "Air", BlockBreakInfo::indestructible(-1.0)));
$this->registerAllMeta(new Anvil(new BID(Ids::ANVIL, 0), "Anvil", new BlockBreakInfo(5.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel(), 6000.0)));
$this->registerAllMeta(new Bamboo(new BID(Ids::BAMBOO, 0), "Bamboo", new BlockBreakInfo(2.0 /* 1.0 in PC */, BlockToolType::AXE)));
$this->registerAllMeta(new Bamboo(new BID(Ids::BAMBOO, 0), "Bamboo", new class(2.0 /* 1.0 in PC */, BlockToolType::AXE) extends BlockBreakInfo{
public function getBreakTime(Item $item) : float{
if($item->getBlockToolType() === BlockToolType::SWORD){
return 0.0;
}
return parent::getBreakTime($item);
}
}));
$this->registerAllMeta(new BambooSapling(new BID(Ids::BAMBOO_SAPLING, 0), "Bamboo Sapling", BlockBreakInfo::instant()));
$bannerBreakInfo = new BlockBreakInfo(1.0, BlockToolType::AXE);
@ -270,7 +277,7 @@ class BlockFactory{
$this->registerAllMeta(new NetherPortal(new BID(Ids::PORTAL, 0), "Nether Portal", BlockBreakInfo::indestructible(0.0)));
$this->registerAllMeta(new NetherQuartzOre(new BID(Ids::NETHER_QUARTZ_ORE, 0), "Nether Quartz Ore", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())));
$this->registerAllMeta(new NetherReactor(new BID(Ids::NETHERREACTOR, 0), "Nether Reactor Core", new BlockBreakInfo(3.0, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())));
$this->registerAllMeta(new Opaque(new BID(Ids::NETHER_WART_BLOCK, 0), "Nether Wart Block", new BlockBreakInfo(1.0)));
$this->registerAllMeta(new Opaque(new BID(Ids::NETHER_WART_BLOCK, 0), "Nether Wart Block", new BlockBreakInfo(1.0, BlockToolType::HOE)));
$this->registerAllMeta(new NetherWartPlant(new BID(Ids::NETHER_WART_PLANT, 0, ItemIds::NETHER_WART), "Nether Wart", BlockBreakInfo::instant()));
$this->registerAllMeta(new Netherrack(new BID(Ids::NETHERRACK, 0), "Netherrack", new BlockBreakInfo(0.4, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel())));
$this->registerAllMeta(new Note(new BID(Ids::NOTEBLOCK, 0, null, TileNote::class), "Note Block", new BlockBreakInfo(0.8, BlockToolType::AXE)));
@ -365,7 +372,7 @@ class BlockFactory{
$crackedStoneBrick = new Opaque(new BID(Ids::STONEBRICK, Meta::STONE_BRICK_CRACKED), "Cracked Stone Bricks", $stoneBreakInfo),
$chiseledStoneBrick = new Opaque(new BID(Ids::STONEBRICK, Meta::STONE_BRICK_CHISELED), "Chiseled Stone Bricks", $stoneBreakInfo)
);
$infestedStoneBreakInfo = new BlockBreakInfo(0.75);
$infestedStoneBreakInfo = new BlockBreakInfo(0.75, BlockToolType::PICKAXE);
$this->registerAllMeta(
new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_STONE), "Infested Stone", $infestedStoneBreakInfo, $stone),
new InfestedStone(new BID(Ids::MONSTER_EGG, Meta::INFESTED_STONE_BRICK), "Infested Stone Brick", $infestedStoneBreakInfo, $stoneBrick),
@ -441,7 +448,7 @@ class BlockFactory{
$this->registerAllMeta(new UnderwaterTorch(new BID(Ids::UNDERWATER_TORCH, 0), "Underwater Torch", BlockBreakInfo::instant()));
$this->registerAllMeta(new Vine(new BID(Ids::VINE, 0), "Vines", new BlockBreakInfo(0.2, BlockToolType::AXE)));
$this->registerAllMeta(new Water(new BIDFlattened(Ids::FLOWING_WATER, [Ids::STILL_WATER], 0), "Water", BlockBreakInfo::indestructible(500.0)));
$this->registerAllMeta(new WaterLily(new BID(Ids::LILY_PAD, 0), "Lily Pad", new BlockBreakInfo(0.6)));
$this->registerAllMeta(new WaterLily(new BID(Ids::LILY_PAD, 0), "Lily Pad", BlockBreakInfo::instant()));
$weightedPressurePlateBreakInfo = new BlockBreakInfo(0.5, BlockToolType::PICKAXE, ToolTier::WOOD()->getHarvestLevel());
$this->registerAllMeta(new WeightedPressurePlateHeavy(new BID(Ids::HEAVY_WEIGHTED_PRESSURE_PLATE, 0), "Weighted Pressure Plate Heavy", $weightedPressurePlateBreakInfo));
@ -449,7 +456,14 @@ class BlockFactory{
$this->registerAllMeta(new Wheat(new BID(Ids::WHEAT_BLOCK, 0), "Wheat Block", BlockBreakInfo::instant()));
$planksBreakInfo = new BlockBreakInfo(2.0, BlockToolType::AXE, 0, 15.0);
$leavesBreakInfo = new BlockBreakInfo(0.2, BlockToolType::SHEARS);
$leavesBreakInfo = new class(0.2, BlockToolType::HOE) extends BlockBreakInfo{
public function getBreakTime(Item $item) : float{
if($item->getBlockToolType() === BlockToolType::SHEARS){
return 0.0;
}
return parent::getBreakTime($item);
}
};
$signBreakInfo = new BlockBreakInfo(1.0, BlockToolType::AXE);
$logBreakInfo = new BlockBreakInfo(2.0, BlockToolType::AXE);
$woodenDoorBreakInfo = new BlockBreakInfo(3.0, BlockToolType::AXE, 0, 15.0);

View File

@ -26,6 +26,9 @@ namespace pocketmine\block;
use pocketmine\block\tile\BrewingStand as TileBrewingStand;
use pocketmine\block\utils\BrewingStandSlot;
use pocketmine\item\Item;
use pocketmine\math\Axis;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\player\Player;
use function array_key_exists;
@ -67,6 +70,19 @@ class BrewingStand extends Transparent{
return 0b111;
}
protected function recalculateCollisionBoxes() : array{
return [
//bottom slab part - in PC this is also inset on X/Z by 1/16, but Bedrock sucks
AxisAlignedBB::one()->trim(Facing::UP, 7 / 8),
//center post
AxisAlignedBB::one()
->squash(Axis::X, 7 / 16)
->squash(Axis::Z, 7 / 16)
->trim(Facing::UP, 1 / 8)
];
}
public function hasSlot(BrewingStandSlot $slot) : bool{
return array_key_exists($slot->id(), $this->slots);
}

View File

@ -34,4 +34,4 @@ final class CraftingTableInventory extends CraftingGrid implements BlockInventor
$this->holder = $holder;
parent::__construct(CraftingGrid::SIZE_BIG);
}
}
}

View File

@ -65,4 +65,4 @@ final class FurnaceRecipeManager{
public function match(Item $input) : ?FurnaceRecipe{
return $this->furnaceRecipes[$input->getId() . ":" . $input->getMeta()] ?? $this->furnaceRecipes[$input->getId() . ":?"] ?? null;
}
}
}

View File

@ -81,4 +81,4 @@ final class CrashDumpData implements \JsonSerializable{
$result["server.properties"] = $this->serverDotProperties;
return $result;
}
}
}

View File

@ -43,4 +43,4 @@ final class CrashDumpDataGeneral{
public string $os,
public array $composer_libraries,
){}
}
}

View File

@ -42,4 +42,4 @@ final class CrashDumpDataPluginEntry{
public string $load,
public string $website,
){}
}
}

View File

@ -100,4 +100,4 @@ final class CrashDumpRenderer{
public function addLine(string $line = "") : void{
fwrite($this->fp, $line . PHP_EOL);
}
}
}

View File

@ -25,4 +25,4 @@ namespace pocketmine\data;
final class SavedDataLoadingException extends \RuntimeException{
}
}

View File

@ -32,4 +32,4 @@ final class LegacyBiomeIdToStringIdMap extends LegacyToStringBidirectionalIdMap{
public function __construct(){
parent::__construct(Path::join(\pocketmine\BEDROCK_DATA_PATH, 'biome_id_map.json'));
}
}
}

View File

@ -25,4 +25,4 @@ namespace pocketmine\entity;
final class InvalidSkinException extends \InvalidArgumentException{
}
}

View File

@ -70,4 +70,4 @@ final class StringToEffectParser extends StringToTParser{
public function parse(string $input) : ?Effect{
return parent::parse($input);
}
}
}

View File

@ -103,8 +103,6 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
/**
* Variadic hack for easy array member type enforcement.
*
* @param Item ...$drops
*/
public function setDropsVariadic(Item ...$drops) : void{
$this->blockDrops = $drops;

View File

@ -57,4 +57,4 @@ class BlockItemPickupEvent extends BlockEvent implements Cancellable{
public function setInventory(?Inventory $inventory) : void{
$this->inventory = $inventory;
}
}
}

View File

@ -37,4 +37,4 @@ class StructureGrowEvent extends BlockEvent implements Cancellable{
public function getPlayer() : ?Player{
return $this->player;
}
}
}

View File

@ -45,4 +45,4 @@ class PlayerDisplayNameChangeEvent extends PlayerEvent{
public function getNewName() : string{
return $this->newName;
}
}
}

View File

@ -31,7 +31,8 @@ use pocketmine\math\Vector3;
use pocketmine\player\Player;
/**
* Called when a player interacts or touches a block (including air?)
* Called when a player interacts or touches a block.
* This is called for both left click (start break) and right click (use).
*/
class PlayerInteractEvent extends PlayerEvent implements Cancellable{
use CancellableTrait;

View File

@ -52,8 +52,6 @@ interface Inventory{
*
* Returns the Items that did not fit.
*
* @param Item ...$slots
*
* @return Item[]
*/
public function addItem(Item ...$slots) : array;
@ -72,8 +70,6 @@ interface Inventory{
* Removes the given Item from the inventory.
* It will return the Items that couldn't be removed.
*
* @param Item ...$slots
*
* @return Item[]
*/
public function removeItem(Item ...$slots) : array;

View File

@ -33,4 +33,4 @@ final class PlayerCraftingInventory extends CraftingGrid implements TemporaryInv
}
public function getHolder() : Player{ return $this->holder; }
}
}

View File

@ -25,4 +25,4 @@ namespace pocketmine\inventory;
interface TemporaryInventory extends Inventory{
}
}

View File

@ -63,4 +63,4 @@ final class StringToEnchantmentParser extends StringToTParser{
public function parse(string $input) : ?Enchantment{
return parent::parse($input);
}
}
}

View File

@ -29,4 +29,4 @@ namespace pocketmine\network;
*/
final class NetworkInterfaceStartException extends \RuntimeException{
}
}

View File

@ -33,4 +33,4 @@ interface Compressor{
public function decompress(string $payload) : string;
public function compress(string $payload) : string;
}
}

View File

@ -25,4 +25,4 @@ namespace pocketmine\network\mcpe\compression;
final class DecompressionException extends \RuntimeException{
}
}

View File

@ -39,6 +39,7 @@ use pocketmine\item\VanillaItems;
use pocketmine\item\WritableBook;
use pocketmine\item\WritableBookPage;
use pocketmine\item\WrittenBook;
use pocketmine\math\Facing;
use pocketmine\math\Vector3;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\StringTag;
@ -104,11 +105,11 @@ use function base64_encode;
use function count;
use function fmod;
use function implode;
use function in_array;
use function is_infinite;
use function is_nan;
use function json_decode;
use function json_encode;
use function json_last_error_msg;
use function max;
use function mb_strlen;
use function microtime;
@ -118,11 +119,13 @@ use function strlen;
use function strpos;
use function substr;
use function trim;
use const JSON_THROW_ON_ERROR;
/**
* This handler handles packets related to general gameplay.
*/
class InGamePacketHandler extends PacketHandler{
private const MAX_FORM_RESPONSE_DEPTH = 2; //modal/simple will be 1, custom forms 2 - they will never contain anything other than string|int|float|bool|null
/** @var Player */
private $player;
@ -361,6 +364,8 @@ class InGamePacketHandler extends PacketHandler{
}
//TODO: end hack for client spam bug
self::validateFacing($data->getFace());
$blockPos = $data->getBlockPosition();
$vBlockPos = new Vector3($blockPos->getX(), $blockPos->getY(), $blockPos->getZ());
if(!$this->player->interactBlock($vBlockPos, $data->getFace(), $clickPos)){
@ -392,6 +397,15 @@ class InGamePacketHandler extends PacketHandler{
return false;
}
/**
* @throws PacketHandlingException
*/
private static function validateFacing(int $facing) : void{
if(!in_array($facing, Facing::ALL, true)){
throw new PacketHandlingException("Invalid facing value $facing");
}
}
/**
* Internal function used to execute rollbacks when an action fails on a block.
*/
@ -504,6 +518,7 @@ class InGamePacketHandler extends PacketHandler{
switch($packet->action){
case PlayerAction::START_BREAK:
self::validateFacing($packet->face);
if(!$this->player->attackBlock($pos, $packet->face)){
$this->onFailedBlockAction($pos, $packet->face);
}
@ -547,6 +562,7 @@ class InGamePacketHandler extends PacketHandler{
case PlayerAction::STOP_GLIDE:
break; //TODO
case PlayerAction::CRACK_BREAK:
self::validateFacing($packet->face);
$this->player->continueBreakBlock($pos, $packet->face);
break;
case PlayerAction::START_SWIMMING:
@ -864,14 +880,18 @@ class InGamePacketHandler extends PacketHandler{
}
$fixed = "[" . implode(",", $newParts) . "]";
if(($ret = json_decode($fixed, $assoc)) === null){
throw new \InvalidArgumentException("Failed to fix JSON: " . json_last_error_msg() . "(original: $json, modified: $fixed)");
try{
return json_decode($fixed, $assoc, self::MAX_FORM_RESPONSE_DEPTH, JSON_THROW_ON_ERROR);
}catch(\JsonException $e){
throw PacketHandlingException::wrap($e, "Failed to fix JSON (original: $json, modified: $fixed)");
}
return $ret;
}
return json_decode($json, $assoc);
try{
return json_decode($json, $assoc, self::MAX_FORM_RESPONSE_DEPTH, JSON_THROW_ON_ERROR);
}catch(\JsonException $e){
throw PacketHandlingException::wrap($e);
}
}
public function handleServerSettingsRequest(ServerSettingsRequestPacket $packet) : bool{

View File

@ -59,4 +59,4 @@ final class RakLibThreadCrashInfo{
public function makePrettyMessage() : string{
return sprintf("%s: \"%s\" in %s on line %d", $this->class ?? "Fatal error", $this->message, Filesystem::cleanPath($this->file), $this->line);
}
}
}

View File

@ -39,4 +39,4 @@ final class PluginLoadTriageEntry{
public function getLoader() : PluginLoader{ return $this->loader; }
public function getDescription() : PluginDescription{ return $this->description; }
}
}

View File

@ -110,4 +110,4 @@ final class PluginLoadabilityChecker{
return null;
}
}
}

View File

@ -52,4 +52,4 @@ final class Promise{
public function isResolved() : bool{
return $this->shared->resolved;
}
}
}

View File

@ -72,4 +72,4 @@ final class PromiseResolver{
public function getPromise() : Promise{
return $this->promise;
}
}
}

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\thread;
use pocketmine\scheduler\AsyncTask;
use const PTHREADS_INHERIT_NONE;
/**

View File

@ -45,4 +45,4 @@ trait SingletonTrait{
public static function reset() : void{
self::$instance = null;
}
}
}

View File

@ -79,4 +79,4 @@ abstract class StringToTParser{
public function getKnownAliases() : array{
return array_keys($this->callbackMap);
}
}
}

View File

@ -503,9 +503,6 @@ final class Utils{
*/
public static function parseDocComment(string $docComment) : array{
$rawDocComment = substr($docComment, 3, -2); //remove the opening and closing markers
if($rawDocComment === false){ //usually empty doc comment, but this is safer and statically analysable
return [];
}
preg_match_all('/(*ANYCRLF)^[\t ]*(?:\* )?@([a-zA-Z\-]+)(?:[\t ]+(.+?))?[\t ]*$/m', $rawDocComment, $matches);
return array_combine($matches[1], $matches[2]);

View File

@ -35,4 +35,4 @@ use pocketmine\utils\NotSerializable;
final class ChunkLockId{
use NotCloneable;
use NotSerializable;
}
}

View File

@ -755,8 +755,6 @@ class World implements ChunkManager{
/**
* @internal
*
* @param Player ...$targets If empty, will send to all players in the world.
*/
public function sendTime(Player ...$targets) : void{
if(count($targets) === 0){
@ -856,7 +854,7 @@ class World implements ChunkManager{
//Update entities that need update
Timings::$tickEntity->startTiming();
foreach($this->updateEntities as $id => $entity){
if($entity->isClosed() or !$entity->onUpdate($currentTick)){
if($entity->isClosed() or $entity->isFlaggedForDespawn() or !$entity->onUpdate($currentTick)){
unset($this->updateEntities[$id]);
}
if($entity->isFlaggedForDespawn()){

View File

@ -124,4 +124,4 @@ final class FlatGeneratorOptions{
return new self($structure, $biomeId, $options);
}
}
}

View File

@ -45,4 +45,4 @@ final class GeneratorManagerEntry{
throw $exception;
}
}
}
}

View File

@ -830,11 +830,6 @@ parameters:
count: 1
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Parameter \\#1 \\$plugin of method pocketmine\\\\plugin\\\\PluginDescription\\:\\:loadMap\\(\\) expects array, mixed given\\.$#"
count: 1
path: ../../../src/plugin/PluginDescription.php
-
message: "#^Parameter \\#2 \\$subject of function preg_match expects string, mixed given\\.$#"
count: 1
@ -900,11 +895,6 @@ parameters:
count: 2
path: ../../../src/resourcepacks/ZippedResourcePack.php
-
message: "#^Parameter \\#2 \\$code of class pocketmine\\\\resourcepacks\\\\ResourcePackException constructor expects int, mixed given\\.$#"
count: 1
path: ../../../src/resourcepacks/ZippedResourcePack.php
-
message: "#^Parameter \\#2 \\$length of function fread expects int\\<0, max\\>, int given\\.$#"
count: 1
@ -1055,11 +1045,6 @@ parameters:
count: 1
path: ../../../src/utils/Utils.php
-
message: "#^Part \\$errno \\(mixed\\) of encapsed string cannot be cast to string\\.$#"
count: 1
path: ../../../src/utils/Utils.php
-
message: "#^Cannot call method getFullBlock\\(\\) on pocketmine\\\\world\\\\format\\\\SubChunk\\|null\\.$#"
count: 1

View File

@ -35,11 +35,6 @@ parameters:
count: 1
path: ../../../src/plugin/ScriptPluginLoader.php
-
message: "#^Strict comparison using \\=\\=\\= between string and false will always evaluate to false\\.$#"
count: 1
path: ../../../src/utils/Utils.php
-
message: "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
count: 2

View File

@ -34,6 +34,7 @@ use PHPStan\Type\StringType;
use PHPStan\Type\Type;
use PHPStan\Type\TypeTraverser;
use PHPStan\Type\VerbosityLevel;
use pocketmine\utils\Utils;
use function sprintf;
/**
@ -77,14 +78,15 @@ final class UnsafeForeachArrayOfStringRule implements Rule{
return $type;
});
if($hasCastableKeyTypes && !$expectsIntKeyTypes){
$func = \Closure::fromCallable([Utils::class, 'stringifyKeys']);
return [
RuleErrorBuilder::message(sprintf(
"Unsafe foreach on array with key type %s (they might be casted to int).",
$iterableType->getIterableKeyType()->describe(VerbosityLevel::value())
))->tip("Use Utils::foreachWithStringKeys() for a safe Generator-based iterator.")->build()
))->tip(sprintf("Use %s() for a safe Generator-based iterator.", Utils::getNiceClosureName($func)))->build()
];
}
return [];
}
}
}

View File

@ -45,7 +45,7 @@ class StupidJsonDecodeTest extends TestCase{
["[\n \"a\",\"b,c,d,e\\\" \",,0,1,2, false, 0.001]", ['a', 'b,c,d,e" ', '', 0, 1, 2, false, 0.001]],
["0", 0],
["false", false],
["NULL", null],
["null", null],
['["\",,\"word","a\",,\"word2",]', ['",,"word', 'a",,"word2', '']],
['["\",,\"word","a\",,\"word2",""]', ['",,"word', 'a",,"word2', '']],
['["Hello,, PocketMine"]', ['Hello,, PocketMine']],

View File

@ -6,4 +6,4 @@ namespace pocketmine\utils\fixtures;
abstract class TestAbstractClass{
}
}

View File

@ -6,4 +6,4 @@ namespace pocketmine\utils\fixtures;
class TestInstantiableClass extends TestAbstractClass implements TestInterface{
}
}

View File

@ -6,4 +6,4 @@ namespace pocketmine\utils\fixtures;
interface TestInterface{
}
}

View File

@ -6,4 +6,4 @@ namespace pocketmine\utils\fixtures;
class TestSubclassOfInstantiableClass extends TestInstantiableClass{
}
}

View File

@ -6,4 +6,4 @@ namespace pocketmine\utils\fixtures;
trait TestTrait{
}
}