diff --git a/build/make-release.php b/build/make-release.php index 8106be1d9..f7be518e7 100644 --- a/build/make-release.php +++ b/build/make-release.php @@ -28,7 +28,6 @@ use function dirname; use function fgets; use function file_get_contents; use function file_put_contents; -use function preg_quote; use function preg_replace; use function sleep; use function sprintf; @@ -59,7 +58,7 @@ function replaceVersion(string $versionInfoPath, string $newVersion, bool $isDev ); $versionInfo = preg_replace( '/^const IS_DEVELOPMENT_BUILD = (?:true|false);$/m', - 'const IS_DEVELOPMENT_BUILD = ' . ($isDev ? 'true' : 'false'). ';', + 'const IS_DEVELOPMENT_BUILD = ' . ($isDev ? 'true' : 'false') . ';', $versionInfo ); file_put_contents($versionInfoPath, $versionInfo); diff --git a/build/server-phar.php b/build/server-phar.php index 617d1cdb0..bbe298641 100644 --- a/build/server-phar.php +++ b/build/server-phar.php @@ -24,12 +24,28 @@ declare(strict_types=1); namespace pocketmine\build\server_phar; use pocketmine\utils\Git; +use function array_map; +use function count; +use function defined; +use function dirname; +use function file_exists; +use function getcwd; +use function getopt; +use function implode; +use function ini_get; +use function microtime; +use function preg_quote; +use function realpath; +use function round; +use function rtrim; +use function sprintf; +use function str_replace; +use function unlink; require dirname(__DIR__) . '/vendor/autoload.php'; /** * @param string[] $strings - * @param string|null $delim * * @return string[] */ @@ -38,13 +54,8 @@ function preg_quote_array(array $strings, string $delim = null) : array{ } /** - * @param string $pharPath - * @param string $basePath * @param string[] $includedPaths * @param mixed[] $metadata - * @param string $stub - * @param int $signatureAlgo - * @param int|null $compression * @phpstan-param array $metadata * * @return \Generator|string[] diff --git a/changelogs/3.11.md b/changelogs/3.11.md index d9e90b546..d6efefbd3 100644 --- a/changelogs/3.11.md +++ b/changelogs/3.11.md @@ -53,3 +53,16 @@ Plugin developers should **only** update their required API to this version if y - Populate type information in lots of places where it was previously missing; this will improve the quality of static analysis for plugins. - `MainLogger::logException()` now logs previous exceptions recursively. - `MainLogger::logException()` now always logs exceptions as `critical`. + +# 3.11.5 +- PHPStan and PHPUnit are now managed as Composer dev dependencies. +- Core code is now analyzed using PHPStan level 6 (full, including iterable types checking). +- Improved type information available to PHPStan in many areas. +- Mass-removal of useless PHPDoc. +- Fixed incorrect documentation of `Internet::getURL()`, `Internet::postURL()` and `Internet::simpleCurl()`. +- Fixed crash on use of case-mismatched recursive command aliases. +- Basic build instructions are now provided in `BUILDING.md`. +- `build/server-phar.php` now uses GZIP compression on created phars, providing a 75% size reduction. +- `ClientboundMapItemDataPacket` now uses `MapDecoration` objects for decorations instead of associative arrays. +- Updated Composer dependencies to get bug fixes in `pocketmine/nbt` and other libraries. +- Packages `pocketmine/classloader` and `pocketmine/log` are now required; these provide classes previously part of `pocketmine/spl`. This change has no effect on API compatibility. diff --git a/src/block/Chest.php b/src/block/Chest.php index b6d09431d..523812a38 100644 --- a/src/block/Chest.php +++ b/src/block/Chest.php @@ -96,7 +96,7 @@ class Chest extends Transparent{ if($chest instanceof TileChest){ if( !$this->getSide(Facing::UP)->isTransparent() or - ($chest->isPaired() and !$chest->getPair()->getBlock()->getSide(Facing::UP)->isTransparent()) or + (($pair = $chest->getPair()) !== null and !$pair->getBlock()->getSide(Facing::UP)->isTransparent()) or !$chest->canOpenWith($item->getCustomName()) ){ return true; diff --git a/src/plugin/PharPluginLoader.php b/src/plugin/PharPluginLoader.php index 98b3bed07..2907a0e60 100644 --- a/src/plugin/PharPluginLoader.php +++ b/src/plugin/PharPluginLoader.php @@ -57,10 +57,7 @@ class PharPluginLoader implements PluginLoader{ public function getPluginDescription(string $file) : ?PluginDescription{ $phar = new \Phar($file); if(isset($phar["plugin.yml"])){ - $pluginYml = $phar["plugin.yml"]; - if($pluginYml instanceof \PharFileInfo){ - return new PluginDescription($pluginYml->getContent()); - } + return new PluginDescription($phar["plugin.yml"]->getContent()); } return null; diff --git a/tests/travis.sh b/tests/travis.sh index a4d0e744b..3259be303 100755 --- a/tests/travis.sh +++ b/tests/travis.sh @@ -1,13 +1,9 @@ #!/bin/bash -PHP_BINARY="php" PM_WORKERS="auto" -while getopts "p:t:" OPTION 2> /dev/null; do +while getopts "t:" OPTION 2> /dev/null; do case ${OPTION} in - p) - PHP_BINARY="$OPTARG" - ;; t) PM_WORKERS="$OPTARG" ;; @@ -22,10 +18,10 @@ rm -rf "$DATA_DIR" rm PocketMine-MP.phar 2> /dev/null cd tests/plugins/PocketMine-DevTools -"$PHP_BINARY" -dphar.readonly=0 ./src/DevTools/ConsoleScript.php --make ./ --relative ./ --out ../../../DevTools.phar +php -dphar.readonly=0 ./src/DevTools/ConsoleScript.php --make ./ --relative ./ --out ../../../DevTools.phar cd ../../.. -"$PHP_BINARY" -dphar.readonly=0 ./build/server-phar.php ./PocketMine-MP.phar +php -dphar.readonly=0 ./build/server-phar.php ./PocketMine-MP.phar if [ -f PocketMine-MP.phar ]; then echo Server phar created successfully. else @@ -37,7 +33,7 @@ mkdir "$DATA_DIR" mkdir "$PLUGINS_DIR" mv DevTools.phar "$PLUGINS_DIR" cp -r tests/plugins/TesterPlugin "$PLUGINS_DIR" -echo -e "stop\n" | "$PHP_BINARY" PocketMine-MP.phar --no-wizard --disable-ansi --disable-readline --debug.level=2 --data="$DATA_DIR" --plugins="$PLUGINS_DIR" --anonymous-statistics.enabled=0 --settings.async-workers="$PM_WORKERS" --settings.enable-dev-builds=1 +echo -e "stop\n" | php PocketMine-MP.phar --no-wizard --disable-ansi --disable-readline --debug.level=2 --data="$DATA_DIR" --plugins="$PLUGINS_DIR" --anonymous-statistics.enabled=0 --settings.async-workers="$PM_WORKERS" --settings.enable-dev-builds=1 output=$(grep '\[TesterPlugin\]' "$DATA_DIR/server.log") if [ "$output" == "" ]; then