mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-04 11:02:29 +00:00
Merge branch 'stable' into minor-next
This commit is contained in:
commit
9f14901820
@ -1 +1 @@
|
||||
Subproject commit 46604f2f6a07e3f68a82e4f4d7efdd45629b101e
|
||||
Subproject commit ed0bc4d2afafd00f9ee92823c6b1bd66789ce4f2
|
@ -22,7 +22,7 @@
|
||||
"ext-openssl": "*",
|
||||
"ext-pcre": "*",
|
||||
"ext-phar": "*",
|
||||
"ext-pmmpthread": "^6.0.4",
|
||||
"ext-pmmpthread": "^6.0.7",
|
||||
"ext-reflection": "*",
|
||||
"ext-simplexml": "*",
|
||||
"ext-sockets": "*",
|
||||
|
18
composer.lock
generated
18
composer.lock
generated
@ -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": "63ecdcea88960659a6977300a0ea79b3",
|
||||
"content-hash": "2d51c1adf069760587b6d36f9c4a5db3",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adhocore/json-comment",
|
||||
@ -1861,16 +1861,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "10.2.7",
|
||||
"version": "10.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "a215d9ee8bac1733796e4ddff3306811f14414e5"
|
||||
"reference": "d442ce7c4104d5683c12e67e4dcb5058159e9804"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a215d9ee8bac1733796e4ddff3306811f14414e5",
|
||||
"reference": "a215d9ee8bac1733796e4ddff3306811f14414e5",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d442ce7c4104d5683c12e67e4dcb5058159e9804",
|
||||
"reference": "d442ce7c4104d5683c12e67e4dcb5058159e9804",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1910,7 +1910,7 @@
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "10.2-dev"
|
||||
"dev-main": "10.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@ -1942,7 +1942,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.2.7"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.3.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -1958,7 +1958,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-08-02T06:46:08+00:00"
|
||||
"time": "2023-08-04T06:48:08+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
@ -2945,7 +2945,7 @@
|
||||
"ext-openssl": "*",
|
||||
"ext-pcre": "*",
|
||||
"ext-phar": "*",
|
||||
"ext-pmmpthread": "^6.0.4",
|
||||
"ext-pmmpthread": "^6.0.7",
|
||||
"ext-reflection": "*",
|
||||
"ext-simplexml": "*",
|
||||
"ext-sockets": "*",
|
||||
|
@ -11,6 +11,7 @@ includes:
|
||||
|
||||
rules:
|
||||
- pocketmine\phpstan\rules\DisallowEnumComparisonRule
|
||||
- pocketmine\phpstan\rules\DisallowForeachByReferenceRule
|
||||
- pocketmine\phpstan\rules\UnsafeForeachArrayOfStringRule
|
||||
# - pocketmine\phpstan\rules\ThreadedSupportedTypesRule
|
||||
|
||||
|
@ -120,8 +120,8 @@ namespace pocketmine {
|
||||
}
|
||||
|
||||
if(($pmmpthread_version = phpversion("pmmpthread")) !== false){
|
||||
if(version_compare($pmmpthread_version, "6.0.4") < 0 || version_compare($pmmpthread_version, "7.0.0") >= 0){
|
||||
$messages[] = "pmmpthread ^6.0.4 is required, while you have $pmmpthread_version.";
|
||||
if(version_compare($pmmpthread_version, "6.0.7") < 0 || version_compare($pmmpthread_version, "7.0.0") >= 0){
|
||||
$messages[] = "pmmpthread ^6.0.7 is required, while you have $pmmpthread_version.";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,10 @@ use pocketmine\item\Item;
|
||||
|
||||
class Podzol extends Opaque{
|
||||
|
||||
public function isAffectedBySilkTouch() : bool{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getDropsForCompatibleTool(Item $item) : array{
|
||||
return [
|
||||
VanillaBlocks::DIRT()->asItem()
|
||||
|
@ -85,6 +85,7 @@ class RakLibServer extends Thread{
|
||||
gc_enable();
|
||||
ini_set("display_errors", '1');
|
||||
ini_set("display_startup_errors", '1');
|
||||
\GlobalLogger::set($this->logger);
|
||||
|
||||
$socket = new ServerSocket($this->address->deserialize());
|
||||
$manager = new Server(
|
||||
@ -107,11 +108,6 @@ class RakLibServer extends Thread{
|
||||
$manager->waitShutdown();
|
||||
}
|
||||
|
||||
protected function onUncaughtException(\Throwable $e) : void{
|
||||
parent::onUncaughtException($e);
|
||||
$this->logger->logException($e);
|
||||
}
|
||||
|
||||
public function getThreadName() : string{
|
||||
return "RakLib";
|
||||
}
|
||||
|
@ -81,9 +81,9 @@ class PermissionManager{
|
||||
}
|
||||
|
||||
public function unsubscribeFromAllPermissions(PermissibleInternal $permissible) : void{
|
||||
foreach($this->permSubs as $permission => &$subs){
|
||||
unset($subs[spl_object_id($permissible)]);
|
||||
if(count($subs) === 0){
|
||||
foreach($this->permSubs as $permission => $subs){
|
||||
unset($this->permSubs[$permission][spl_object_id($permissible)]);
|
||||
if(count($this->permSubs[$permission]) === 0){
|
||||
unset($this->permSubs[$permission]);
|
||||
}
|
||||
}
|
||||
|
@ -69,11 +69,6 @@ class AsyncWorker extends Worker{
|
||||
$this->saveToThreadStore(self::TLS_KEY_NOTIFIER, $this->sleeperEntry->createNotifier());
|
||||
}
|
||||
|
||||
protected function onUncaughtException(\Throwable $e) : void{
|
||||
parent::onUncaughtException($e);
|
||||
$this->logger->logException($e);
|
||||
}
|
||||
|
||||
public function getLogger() : ThreadSafeLogger{
|
||||
return $this->logger;
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ use pocketmine\errorhandler\ErrorToExceptionHandler;
|
||||
use pocketmine\Server;
|
||||
use function error_get_last;
|
||||
use function error_reporting;
|
||||
use function implode;
|
||||
use function register_shutdown_function;
|
||||
use function set_exception_handler;
|
||||
|
||||
@ -115,6 +116,7 @@ trait CommonThreadPartsTrait{
|
||||
protected function onUncaughtException(\Throwable $e) : void{
|
||||
$this->synchronized(function() use ($e) : void{
|
||||
$this->crashInfo = ThreadCrashInfo::fromThrowable($e, $this->getThreadName());
|
||||
\GlobalLogger::get()->logException($e);
|
||||
});
|
||||
}
|
||||
|
||||
@ -124,15 +126,26 @@ trait CommonThreadPartsTrait{
|
||||
*/
|
||||
protected function onShutdown() : void{
|
||||
$this->synchronized(function() : void{
|
||||
if(!$this->isKilled && $this->crashInfo === null){
|
||||
if($this->isTerminated() && $this->crashInfo === null){
|
||||
$last = error_get_last();
|
||||
if($last !== null){
|
||||
//fatal error
|
||||
$this->crashInfo = ThreadCrashInfo::fromLastErrorInfo($last, $this->getThreadName());
|
||||
$crashInfo = ThreadCrashInfo::fromLastErrorInfo($last, $this->getThreadName());
|
||||
}else{
|
||||
//probably misused exit()
|
||||
$this->crashInfo = ThreadCrashInfo::fromThrowable(new \RuntimeException("Thread crashed without an error - perhaps exit() was called?"), $this->getThreadName());
|
||||
$crashInfo = ThreadCrashInfo::fromThrowable(new \RuntimeException("Thread crashed without an error - perhaps exit() was called?"), $this->getThreadName());
|
||||
}
|
||||
$this->crashInfo = $crashInfo;
|
||||
|
||||
$lines = [];
|
||||
//mimic exception printed format
|
||||
$lines[] = "Fatal error: " . $crashInfo->makePrettyMessage();
|
||||
$lines[] = "--- Stack trace ---";
|
||||
foreach($crashInfo->getTrace() as $frame){
|
||||
$lines[] = " " . $frame->getPrintableFrame();
|
||||
}
|
||||
$lines[] = "--- End of fatal error information ---";
|
||||
\GlobalLogger::get()->critical(implode("\n", $lines));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -3003,7 +3003,7 @@ class World implements ChunkManager{
|
||||
* @throws WorldException if the terrain is not generated
|
||||
*/
|
||||
public function getSafeSpawn(?Vector3 $spawn = null) : Position{
|
||||
if(!($spawn instanceof Vector3) || $spawn->y < 1){
|
||||
if(!($spawn instanceof Vector3) || $spawn->y <= $this->minY){
|
||||
$spawn = $this->getSpawnLocation();
|
||||
}
|
||||
|
||||
|
53
tests/phpstan/rules/DisallowForeachByReferenceRule.php
Normal file
53
tests/phpstan/rules/DisallowForeachByReferenceRule.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\phpstan\rules;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\Foreach_;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Rules\Rule;
|
||||
use PHPStan\Rules\RuleErrorBuilder;
|
||||
|
||||
/**
|
||||
* @phpstan-implements Rule<Foreach_>
|
||||
*/
|
||||
final class DisallowForeachByReferenceRule implements Rule{
|
||||
|
||||
public function getNodeType() : string{
|
||||
return Foreach_::class;
|
||||
}
|
||||
|
||||
public function processNode(Node $node, Scope $scope) : array{
|
||||
/** @var Foreach_ $node */
|
||||
if($node->byRef){
|
||||
return [
|
||||
RuleErrorBuilder::message("Foreach by-reference is not allowed, because it has surprising behaviour.")
|
||||
->tip("If the value variable is used outside of the foreach construct (e.g. in a second foreach), the iterable's contents will be unexpectedly altered.")
|
||||
->build()
|
||||
];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
use pocketmine\block\Block;
|
||||
use pocketmine\block\RuntimeBlockStateRegistry;
|
||||
use pocketmine\utils\AssumptionFailedError;
|
||||
use pocketmine\utils\Utils;
|
||||
|
||||
require dirname(__DIR__, 3) . '/vendor/autoload.php';
|
||||
|
||||
@ -91,8 +92,9 @@ foreach($new as $stateId => $name){
|
||||
$newTable[$name][] = $stateId;
|
||||
}
|
||||
ksort($newTable, SORT_STRING);
|
||||
foreach($newTable as &$stateIds){
|
||||
foreach(Utils::stringifyKeys($newTable) as $name => $stateIds){
|
||||
sort($stateIds, SORT_NUMERIC);
|
||||
$newTable[$name] = $stateIds;
|
||||
}
|
||||
|
||||
file_put_contents(__DIR__ . '/block_factory_consistency_check.json', json_encode(
|
||||
|
Loading…
x
Reference in New Issue
Block a user