From abbb8bbf559164a8261f18fe442315026533754b Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 24 Oct 2019 13:37:24 +0100 Subject: [PATCH 01/21] travis.sh: allow latest phpunit v7 now that we have XML not ready to move to v8 yet because of BC breaks --- tests/travis.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/travis.sh b/tests/travis.sh index b0ccce1e8..049ec0526 100755 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -21,9 +21,7 @@ if [ $? -ne 0 ]; then exit 1 fi -#Run PHPUnit tests -#7.5.12 introduces changes that set the build on fire because we don't ship libxml - TODO FIX -curl https://phar.phpunit.de/phpunit-7.5.11.phar --silent --location -o phpunit.phar +curl https://phar.phpunit.de/phpunit-7.phar --silent --location -o phpunit.phar "$PHP_BINARY" phpunit.phar --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit || exit 1 #Run-the-server tests From d1ca779c1a6d1bd537d5cb9c33e4cf9d229db8a7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 25 Oct 2019 15:49:47 +0100 Subject: [PATCH 02/21] fix PHPStan @throws incompatible warning --- src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php b/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php index 89295717e..9af852bba 100644 --- a/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php +++ b/src/pocketmine/network/mcpe/protocol/AvailableCommandsPacket.php @@ -29,6 +29,7 @@ use pocketmine\network\mcpe\NetworkSession; use pocketmine\network\mcpe\protocol\types\CommandData; use pocketmine\network\mcpe\protocol\types\CommandEnum; use pocketmine\network\mcpe\protocol\types\CommandParameter; +use pocketmine\utils\BinaryDataException; use function count; use function dechex; From a145e18c1e23ea4772a6daa55b1541c963f02229 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 25 Oct 2019 16:08:37 +0100 Subject: [PATCH 03/21] CrashDump: use fully qualified reference for GIT_COMMIT constant this makes it easier to filter out PHPStan noise. --- src/pocketmine/CrashDump.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/CrashDump.php b/src/pocketmine/CrashDump.php index a18765297..df7d0fb48 100644 --- a/src/pocketmine/CrashDump.php +++ b/src/pocketmine/CrashDump.php @@ -333,7 +333,7 @@ class CrashDump{ $this->data["general"]["php_os"] = PHP_OS; $this->data["general"]["os"] = Utils::getOS(); $this->addLine($this->server->getName() . " version: " . $version->getFullVersion(true) . " [Protocol " . ProtocolInfo::CURRENT_PROTOCOL . "]"); - $this->addLine("Git commit: " . GIT_COMMIT); + $this->addLine("Git commit: " . \pocketmine\GIT_COMMIT); $this->addLine("uname -a: " . php_uname("a")); $this->addLine("PHP Version: " . phpversion()); $this->addLine("Zend version: " . zend_version()); From 0d5d5e21a80e41bd0f15bbeff1386b42d05d5200 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 25 Oct 2019 16:11:02 +0100 Subject: [PATCH 04/21] CommandReader: define $w and $e to make PHPStan happy --- src/pocketmine/command/CommandReader.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pocketmine/command/CommandReader.php b/src/pocketmine/command/CommandReader.php index dfa66ba28..1aaa1721d 100644 --- a/src/pocketmine/command/CommandReader.php +++ b/src/pocketmine/command/CommandReader.php @@ -141,6 +141,7 @@ class CommandReader extends Thread{ case self::TYPE_STREAM: //stream_select doesn't work on piped streams for some reason $r = [self::$stdin]; + $w = $e = null; if(($count = stream_select($r, $w, $e, 0, 200000)) === 0){ //nothing changed in 200000 microseconds return true; }elseif($count === false){ //stream error From 1bce5d0bc2da25dbb375a37fd5db402500447b3b Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 25 Oct 2019 21:26:22 +0100 Subject: [PATCH 05/21] PocketMine.php: move BaseClassLoader creation to where it's actually used --- src/pocketmine/PocketMine.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index a17d9797c..f4f5c5e68 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -187,12 +187,6 @@ namespace pocketmine { set_error_handler([Utils::class, 'errorExceptionHandler']); - /* - * We now use the Composer autoloader, but this autoloader is still for loading plugins. - */ - $autoloader = new \BaseClassLoader(); - $autoloader->register(false); - $version = new VersionString(\pocketmine\BASE_VERSION, \pocketmine\IS_DEVELOPMENT_BUILD, \pocketmine\BUILD_NUMBER); define('pocketmine\VERSION', $version->getFullVersion(true)); @@ -275,6 +269,13 @@ namespace pocketmine { //TODO: move this to a Server field define('pocketmine\START_TIME', microtime(true)); ThreadManager::init(); + + /* + * We now use the Composer autoloader, but this autoloader is still for loading plugins. + */ + $autoloader = new \BaseClassLoader(); + $autoloader->register(false); + new Server($autoloader, $logger, \pocketmine\DATA, \pocketmine\PLUGIN_PATH); $logger->info("Stopping other threads"); From 274cf58ccf8821e48dc8527c76b9b786ddd9d60f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 25 Oct 2019 21:38:47 +0100 Subject: [PATCH 06/21] PocketMine.php: remove useless ini_set() (this is a PHP_INI_SYSTEM directive which can't be changed at runtime) --- src/pocketmine/PocketMine.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index f4f5c5e68..00e1aae43 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -141,7 +141,6 @@ namespace pocketmine { ini_set("display_errors", '1'); ini_set("display_startup_errors", '1'); ini_set("default_charset", "utf-8"); - @ini_set("opcache.mmap_base", bin2hex(random_bytes(8))); //Fix OPCache address errors ini_set('assert.exception', '1'); } From 0840ba8067af7fc9fabbbd29ae27ec06f4087013 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 26 Oct 2019 21:37:15 +0100 Subject: [PATCH 07/21] PocketMine.php: reduce unnecessary pocketmine\NAME dependencies --- src/pocketmine/PocketMine.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index 00e1aae43..1b040dcb5 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -57,18 +57,18 @@ namespace pocketmine { if(version_compare(MIN_PHP_VERSION, PHP_VERSION) > 0){ //If PHP version isn't high enough, anything below might break, so don't bother checking it. return [ - \pocketmine\NAME . " requires PHP >= " . MIN_PHP_VERSION . ", but you have PHP " . PHP_VERSION . "." + "PHP >= " . MIN_PHP_VERSION . " is required, but you have PHP " . PHP_VERSION . "." ]; } $messages = []; if(PHP_INT_SIZE < 8){ - $messages[] = "Running " . \pocketmine\NAME . " with 32-bit systems/PHP is no longer supported. Please upgrade to a 64-bit system, or use a 64-bit PHP binary if this is a 64-bit system."; + $messages[] = "32-bit systems/PHP are no longer supported. Please upgrade to a 64-bit system, or use a 64-bit PHP binary if this is a 64-bit system."; } if(php_sapi_name() !== "cli"){ - $messages[] = "You must run " . \pocketmine\NAME . " using the CLI."; + $messages[] = "Only PHP CLI is supported."; } $extensions = [ From b5a98a993faebc39033b0fdb24c3a57bdb19a657 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 27 Oct 2019 20:58:43 +0000 Subject: [PATCH 08/21] lazy-init RuntimeBlockMapping --- .../mcpe/protocol/types/RuntimeBlockMapping.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pocketmine/network/mcpe/protocol/types/RuntimeBlockMapping.php b/src/pocketmine/network/mcpe/protocol/types/RuntimeBlockMapping.php index 9ba73cbb4..606148d1b 100644 --- a/src/pocketmine/network/mcpe/protocol/types/RuntimeBlockMapping.php +++ b/src/pocketmine/network/mcpe/protocol/types/RuntimeBlockMapping.php @@ -40,8 +40,8 @@ final class RuntimeBlockMapping{ private static $legacyToRuntimeMap = []; /** @var int[] */ private static $runtimeToLegacyMap = []; - /** @var mixed[] */ - private static $bedrockKnownStates; + /** @var mixed[]|null */ + private static $bedrockKnownStates = null; private function __construct(){ //NOOP @@ -77,6 +77,12 @@ final class RuntimeBlockMapping{ } } + private static function lazyInit() : void{ + if(self::$bedrockKnownStates === null){ + self::init(); + } + } + /** * Randomizes the order of the runtimeID table to prevent plugins relying on them. * Plugins shouldn't use this stuff anyway, but plugin devs have an irritating habit of ignoring what they @@ -101,6 +107,7 @@ final class RuntimeBlockMapping{ * @return int */ public static function toStaticRuntimeId(int $id, int $meta = 0) : int{ + self::lazyInit(); /* * try id+meta first * if not found, try id+0 (strip meta) @@ -115,6 +122,7 @@ final class RuntimeBlockMapping{ * @return int[] [id, meta] */ public static function fromStaticRuntimeId(int $runtimeId) : array{ + self::lazyInit(); $v = self::$runtimeToLegacyMap[$runtimeId]; return [$v >> 4, $v & 0xf]; } @@ -128,7 +136,7 @@ final class RuntimeBlockMapping{ * @return array */ public static function getBedrockKnownStates() : array{ + self::lazyInit(); return self::$bedrockKnownStates; } } -RuntimeBlockMapping::init(); From 35fabc77651d50e1da338e58a0591efdc7e628b7 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 28 Oct 2019 16:03:26 +0000 Subject: [PATCH 09/21] updated DevTools submodule to 1.13.5 --- tests/plugins/PocketMine-DevTools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/plugins/PocketMine-DevTools b/tests/plugins/PocketMine-DevTools index 3fadb2c3f..73c96dfdb 160000 --- a/tests/plugins/PocketMine-DevTools +++ b/tests/plugins/PocketMine-DevTools @@ -1 +1 @@ -Subproject commit 3fadb2c3f45a528a715733ba41c273289ef8ffb1 +Subproject commit 73c96dfdbac9c9d44f3b10192540d7ff71a1051b From 0c91d568b41e9406778c97695486d85c5f88e280 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 28 Oct 2019 16:07:35 +0000 Subject: [PATCH 10/21] Release 3.9.7 --- changelogs/3.9.md | 7 ++++++- src/pocketmine/VersionInfo.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/changelogs/3.9.md b/changelogs/3.9.md index 0618aef71..57c82b7cd 100644 --- a/changelogs/3.9.md +++ b/changelogs/3.9.md @@ -99,4 +99,9 @@ Plugin developers should **only** update their required API to this version if y - `pocketmine\level\Explosion`: - `explodeA()` - `explodeB()` -- Fixed various cosmetic documentation inconsistencies in the core and dependencies. \ No newline at end of file +- Fixed various cosmetic documentation inconsistencies in the core and dependencies. + +# 3.9.7 +- Fixed a crash that could occur during timezone detection. +- Squid no longer spin around constantly in enclosed spaces. Their performance impact is reduced. +- Cleaned up the bootstrap file. \ No newline at end of file diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index fd7e7bd86..4ae068b90 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -23,5 +23,5 @@ namespace pocketmine; const NAME = "PocketMine-MP"; const BASE_VERSION = "3.9.7"; -const IS_DEVELOPMENT_BUILD = true; +const IS_DEVELOPMENT_BUILD = false; const BUILD_NUMBER = 0; From 5edff79f5f4466130e8de1043f65da6a3a86a491 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 28 Oct 2019 16:07:35 +0000 Subject: [PATCH 11/21] 3.9.8 is next --- src/pocketmine/VersionInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/VersionInfo.php b/src/pocketmine/VersionInfo.php index 4ae068b90..c9c78f83e 100644 --- a/src/pocketmine/VersionInfo.php +++ b/src/pocketmine/VersionInfo.php @@ -22,6 +22,6 @@ namespace pocketmine; const NAME = "PocketMine-MP"; -const BASE_VERSION = "3.9.7"; -const IS_DEVELOPMENT_BUILD = false; +const BASE_VERSION = "3.9.8"; +const IS_DEVELOPMENT_BUILD = true; const BUILD_NUMBER = 0; From 4cb0b319c046f6cd22a35d604ba90cff2365cfcb Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 5 Nov 2019 11:16:22 +0000 Subject: [PATCH 12/21] load some non-class constants with composer this makes PHPStan happy and also makes working with PM code externally less of a pain in the ass. --- composer.json | 6 +++++- src/pocketmine/GlobalConstants.php | 30 ++++++++++++++++++++++++++++++ src/pocketmine/PocketMine.php | 6 ------ src/pocketmine/VersionInfo.php | 8 ++++++++ 4 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 src/pocketmine/GlobalConstants.php diff --git a/composer.json b/composer.json index cce152633..d9216be1a 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,11 @@ "autoload": { "psr-4": { "": ["src"] - } + }, + "files": [ + "src/pocketmine/GlobalConstants.php", + "src/pocketmine/VersionInfo.php" + ] }, "autoload-dev": { "psr-4": { diff --git a/src/pocketmine/GlobalConstants.php b/src/pocketmine/GlobalConstants.php new file mode 100644 index 000000000..a9550cc43 --- /dev/null +++ b/src/pocketmine/GlobalConstants.php @@ -0,0 +1,30 @@ + Date: Tue, 5 Nov 2019 11:16:49 +0000 Subject: [PATCH 13/21] introduced baseline PHPStan configuration --- phpstan.neon | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 phpstan.neon diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 000000000..2f01e8fe9 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,158 @@ + + +parameters: + level: 1 + paths: + - src + #reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings + ignoreErrors: + - + message: "#^pocketmine\\\\Player\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\entity\\\\Human\\.$#" + path: src/pocketmine/Player.php + + - + message: "#^Function pocketmine\\\\critical_error not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function pocketmine\\\\check_platform_dependencies not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function pocketmine\\\\emit_performance_warnings not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function pocketmine\\\\set_ini_entries not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function pocketmine\\\\server not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function check_platform_dependencies not found\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function critical_error not found\\.$#" + count: 6 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function set_ini_entries not found\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function emit_performance_warnings not found\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Function pocketmine\\\\server not found\\.$#" + count: 1 + path: src/pocketmine/PocketMine.php + + - + message: "#^Constant MIN_PHP_VERSION not found\\.$#" + count: 2 + path: src/pocketmine/PocketMine.php + + - + message: "#^pocketmine\\\\block\\\\[A-Za-z\\d]+\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#" + path: src/pocketmine/block + + - + message: "#^pocketmine\\\\block\\\\Block\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\level\\\\Position\\.$#" + count: 1 + path: src/pocketmine/block/Block.php + + - + message: "#^pocketmine\\\\inventory\\\\DoubleChestInventory\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\inventory\\\\ChestInventory\\.$#" + count: 1 + path: src/pocketmine/inventory/DoubleChestInventory.php + + - + message: "#^pocketmine\\\\inventory\\\\EnderChestInventory\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\inventory\\\\ChestInventory\\.$#" + count: 1 + path: src/pocketmine/inventory/EnderChestInventory.php + + - + message: "#^pocketmine\\\\item\\\\GoldenAppleEnchanted\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\item\\\\GoldenApple\\.$#" + count: 1 + path: src/pocketmine/item/GoldenAppleEnchanted.php + + - + message: "#^pocketmine\\\\item\\\\WrittenBook\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\item\\\\WritableBook\\.$#" + count: 1 + path: src/pocketmine/item/WrittenBook.php + + - + message: "#^Constructor of class pocketmine\\\\level\\\\generator\\\\hell\\\\Nether has an unused parameter \\$options\\.$#" + count: 1 + path: src/pocketmine/level/generator/hell/Nether.php + + - + message: "#^Constructor of class pocketmine\\\\level\\\\generator\\\\normal\\\\Normal has an unused parameter \\$options\\.$#" + count: 1 + path: src/pocketmine/level/generator/normal/Normal.php + + - + message: "#^Used constant pocketmine\\\\RESOURCE_PATH not found\\.$#" + count: 1 + path: src/pocketmine/network/mcpe/protocol/StartGamePacket.php + + - + message: "#^Instantiated class COM not found\\.$#" + count: 2 + path: src/pocketmine/network/upnp/UPnP.php + comment: "only available on Windows" + + - + message: "#^Constructor of class pocketmine\\\\scheduler\\\\TaskScheduler has an unused parameter \\$logger\\.$#" + count: 1 + path: src/pocketmine/scheduler/TaskScheduler.php + + - + message: "#^Variable \\$GLOBALS in isset\\(\\) always exists and is not nullable\\.$#" + path: src/pocketmine/MemoryManager.php + comment: "this isn't defined on threads (thanks pthreads)" + + - + message: "#^Constant pocketmine\\\\COMPOSER_AUTOLOADER_PATH not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\DATA not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\GIT_COMMIT not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\PATH not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\PLUGIN_PATH not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\RESOURCE_PATH not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\START_TIME not found\\.$#" + path: src/pocketmine + + - + message: "#^Constant pocketmine\\\\VERSION not found\\.$#" + path: src/pocketmine From a86bcd51105a748e1e28c1d79c9bc99476f5bd23 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 5 Nov 2019 19:39:04 +0000 Subject: [PATCH 14/21] travis.sh: don't redownload phpunit if it already locally exists --- tests/travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/travis.sh b/tests/travis.sh index 049ec0526..45d5672e4 100755 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -21,7 +21,7 @@ if [ $? -ne 0 ]; then exit 1 fi -curl https://phar.phpunit.de/phpunit-7.phar --silent --location -o phpunit.phar +[ ! -f phpunit.phar ] && echo "Downloading PHPUnit..." && curl https://phar.phpunit.de/phpunit-7.phar --silent --location -o phpunit.phar "$PHP_BINARY" phpunit.phar --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit || exit 1 #Run-the-server tests From 714f4dc023dde8e7455faa21ac135bb55ec34db2 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 5 Nov 2019 19:42:37 +0000 Subject: [PATCH 15/21] fortify CI with PHPStan --- tests/travis.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/travis.sh b/tests/travis.sh index 45d5672e4..a58341493 100755 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -21,6 +21,10 @@ if [ $? -ne 0 ]; then exit 1 fi +[ ! -f phpstan.phar ] && echo "Downloading PHPStan..." && curl -sSLO https://github.com/phpstan/phpstan/releases/download/0.11.19/phpstan.phar +"$PHP_BINARY" phpstan.phar analyze --no-progress --memory-limit=2G || exit 1 +echo "PHPStan scan succeeded" + [ ! -f phpunit.phar ] && echo "Downloading PHPUnit..." && curl https://phar.phpunit.de/phpunit-7.phar --silent --location -o phpunit.phar "$PHP_BINARY" phpunit.phar --bootstrap vendor/autoload.php --fail-on-warning tests/phpunit || exit 1 From c5d3e9be767c6227e7d269e97c63366fbb80cfa9 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 5 Nov 2019 20:21:36 +0000 Subject: [PATCH 16/21] phpstan: silence leveldb noise maybe there's a better way to do this, but I don't know it yet. --- phpstan.neon | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 2f01e8fe9..f5178b81c 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -4,7 +4,7 @@ parameters: level: 1 paths: - src - #reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings + reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings ignoreErrors: - message: "#^pocketmine\\\\Player\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\entity\\\\Human\\.$#" @@ -156,3 +156,21 @@ parameters: - message: "#^Constant pocketmine\\\\VERSION not found\\.$#" path: src/pocketmine + - + message: "#^Used constant LEVELDB_ZLIB_RAW_COMPRESSION not found\\.$#" + path: src/pocketmine/level/format/io/leveldb/LevelDB.php + comment: "explicitly checked" + - + message: "#^Constant LEVELDB_ZLIB_RAW_COMPRESSION not found\\.$#" + path: src/pocketmine/level/format/io/leveldb/LevelDB.php + comment: "explicitly checked" + - + message: "#^Instantiated class LevelDB not found\\.$#" + path: src/pocketmine/level/format/io/leveldb/LevelDB.php + comment: "leveldb extension currently optional" + - + message: "#^Return typehint of method pocketmine\\\\level\\\\format\\\\io\\\\leveldb\\\\LevelDB\\:\\:createDB\\(\\) has invalid type LevelDB\\.$#" + path: src/pocketmine/level/format/io/leveldb/LevelDB.php + - + message: "#^Return typehint of method pocketmine\\\\level\\\\format\\\\io\\\\leveldb\\\\LevelDB\\:\\:getDatabase\\(\\) has invalid type LevelDB\\.$#" + path: src/pocketmine/level/format/io/leveldb/LevelDB.php From cac3c356a5a83cf6cada0269e86f8d8d11e80c52 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 6 Nov 2019 14:29:43 -0500 Subject: [PATCH 17/21] Painting: fix dropping multiple items when multiple blockupdates occur in the same tick test case: place sand on top of a line of signs, put a painting on the sand and break the supporting sign fixes #2774 for stable --- src/pocketmine/entity/object/Painting.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pocketmine/entity/object/Painting.php b/src/pocketmine/entity/object/Painting.php index 70e47307f..f60368519 100644 --- a/src/pocketmine/entity/object/Painting.php +++ b/src/pocketmine/entity/object/Painting.php @@ -90,6 +90,9 @@ class Painting extends Entity{ } public function kill() : void{ + if(!$this->isAlive()){ + return; + } parent::kill(); $drops = true; From 95812252d6969c300d18e9dc1c339114c2b75b1c Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Wed, 6 Nov 2019 22:48:08 +0000 Subject: [PATCH 18/21] NetworkBinaryStream: fix a mistake in doc for putEntityRuntimeId() --- src/pocketmine/network/mcpe/NetworkBinaryStream.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/network/mcpe/NetworkBinaryStream.php b/src/pocketmine/network/mcpe/NetworkBinaryStream.php index ba48a129b..32a3629e9 100644 --- a/src/pocketmine/network/mcpe/NetworkBinaryStream.php +++ b/src/pocketmine/network/mcpe/NetworkBinaryStream.php @@ -378,7 +378,7 @@ class NetworkBinaryStream extends BinaryStream{ } /** - * Writes an EntityUniqueID + * Writes an EntityRuntimeID * * @param int $eid */ From 932418b951684f57a02e8202a0a3a663e1a1b3a1 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Thu, 7 Nov 2019 18:22:21 +0000 Subject: [PATCH 19/21] fixing some PHPStan complaints about bootstrap this isn't an ideal fix, but it'll do. --- phpstan.neon | 58 ++--------------------------------- src/pocketmine/PocketMine.php | 4 ++- tests/phpstan/bootstrap.php | 24 +++++++++++++++ 3 files changed, 30 insertions(+), 56 deletions(-) create mode 100644 tests/phpstan/bootstrap.php diff --git a/phpstan.neon b/phpstan.neon index f5178b81c..eeae576fe 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,6 +2,9 @@ parameters: level: 1 + autoload_files: + - tests/phpstan/bootstrap.php + - src/pocketmine/PocketMine.php paths: - src reportUnmatchedIgnoredErrors: false #no other way to silence platform-specific non-warnings @@ -10,61 +13,6 @@ parameters: message: "#^pocketmine\\\\Player\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\entity\\\\Human\\.$#" path: src/pocketmine/Player.php - - - message: "#^Function pocketmine\\\\critical_error not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function pocketmine\\\\check_platform_dependencies not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function pocketmine\\\\emit_performance_warnings not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function pocketmine\\\\set_ini_entries not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function pocketmine\\\\server not found while trying to analyse it \\- autoloading is probably not configured properly\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function check_platform_dependencies not found\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function critical_error not found\\.$#" - count: 6 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function set_ini_entries not found\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function emit_performance_warnings not found\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Function pocketmine\\\\server not found\\.$#" - count: 1 - path: src/pocketmine/PocketMine.php - - - - message: "#^Constant MIN_PHP_VERSION not found\\.$#" - count: 2 - path: src/pocketmine/PocketMine.php - - message: "#^pocketmine\\\\block\\\\[A-Za-z\\d]+\\:\\:__construct\\(\\) does not call parent constructor from pocketmine\\\\block\\\\Block\\.$#" path: src/pocketmine/block diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index bf01d54fa..bf3912e9e 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -291,5 +291,7 @@ namespace pocketmine { exit($exitCode); } - \pocketmine\server(); + if(!defined('pocketmine\_PHPSTAN_ANALYSIS')){ + \pocketmine\server(); + } } diff --git a/tests/phpstan/bootstrap.php b/tests/phpstan/bootstrap.php new file mode 100644 index 000000000..10b2da0fc --- /dev/null +++ b/tests/phpstan/bootstrap.php @@ -0,0 +1,24 @@ + Date: Sat, 9 Nov 2019 17:33:25 +0000 Subject: [PATCH 20/21] updated build/php submodule --- build/php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/php b/build/php index 8666ae5ad..185d74199 160000 --- a/build/php +++ b/build/php @@ -1 +1 @@ -Subproject commit 8666ae5add7a8b5213d68b491ebf0de211998cc9 +Subproject commit 185d7419914005530298bd5e069449bdf4c0be56 From 025cb73bf5d13af95425998c074322c412ccea8e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sat, 9 Nov 2019 17:34:04 +0000 Subject: [PATCH 21/21] update travis pthreads --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2525a1f80..dcc2e1298 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_script: - echo | pecl install channel://pecl.php.net/yaml-2.0.4 - git clone https://github.com/pmmp/pthreads.git - cd pthreads - - git checkout 6ca019c58b4fa09ee2ff490f2444e34bef0773d0 + - git checkout 1b7da492b944146fa9680f6399bd9c6c6c6095e0 - phpize - ./configure - make