mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Server: fixup PHPStan 2.x reported issues
This commit is contained in:
parent
a17512de93
commit
28d31c97f8
@ -138,6 +138,7 @@ use function file_put_contents;
|
|||||||
use function filemtime;
|
use function filemtime;
|
||||||
use function fopen;
|
use function fopen;
|
||||||
use function get_class;
|
use function get_class;
|
||||||
|
use function gettype;
|
||||||
use function ini_set;
|
use function ini_set;
|
||||||
use function is_array;
|
use function is_array;
|
||||||
use function is_dir;
|
use function is_dir;
|
||||||
@ -918,6 +919,7 @@ class Server{
|
|||||||
TimingsHandler::getCollectCallbacks()->add(function() : array{
|
TimingsHandler::getCollectCallbacks()->add(function() : array{
|
||||||
$promises = [];
|
$promises = [];
|
||||||
foreach($this->asyncPool->getRunningWorkers() as $workerId){
|
foreach($this->asyncPool->getRunningWorkers() as $workerId){
|
||||||
|
/** @phpstan-var PromiseResolver<list<string>> $resolver */
|
||||||
$resolver = new PromiseResolver();
|
$resolver = new PromiseResolver();
|
||||||
$this->asyncPool->submitTaskToWorker(new TimingsCollectionTask($resolver), $workerId);
|
$this->asyncPool->submitTaskToWorker(new TimingsCollectionTask($resolver), $workerId);
|
||||||
|
|
||||||
@ -1013,7 +1015,11 @@ class Server{
|
|||||||
copy(Path::join(\pocketmine\RESOURCE_PATH, 'plugin_list.yml'), $graylistFile);
|
copy(Path::join(\pocketmine\RESOURCE_PATH, 'plugin_list.yml'), $graylistFile);
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
$pluginGraylist = PluginGraylist::fromArray(yaml_parse(Filesystem::fileGetContents($graylistFile)));
|
$array = yaml_parse(Filesystem::fileGetContents($graylistFile));
|
||||||
|
if(!is_array($array)){
|
||||||
|
throw new \InvalidArgumentException("Expected array for root, but have " . gettype($array));
|
||||||
|
}
|
||||||
|
$pluginGraylist = PluginGraylist::fromArray($array);
|
||||||
}catch(\InvalidArgumentException $e){
|
}catch(\InvalidArgumentException $e){
|
||||||
$this->logger->emergency("Failed to load $graylistFile: " . $e->getMessage());
|
$this->logger->emergency("Failed to load $graylistFile: " . $e->getMessage());
|
||||||
$this->forceShutdownExit();
|
$this->forceShutdownExit();
|
||||||
@ -1174,7 +1180,7 @@ class Server{
|
|||||||
|
|
||||||
if($this->worldManager->getDefaultWorld() === null){
|
if($this->worldManager->getDefaultWorld() === null){
|
||||||
$default = $this->configGroup->getConfigString(ServerProperties::DEFAULT_WORLD_NAME, "world");
|
$default = $this->configGroup->getConfigString(ServerProperties::DEFAULT_WORLD_NAME, "world");
|
||||||
if(trim($default) == ""){
|
if(trim($default) === ""){
|
||||||
$this->logger->warning("level-name cannot be null, using default");
|
$this->logger->warning("level-name cannot be null, using default");
|
||||||
$default = "world";
|
$default = "world";
|
||||||
$this->configGroup->setConfigString(ServerProperties::DEFAULT_WORLD_NAME, "world");
|
$this->configGroup->setConfigString(ServerProperties::DEFAULT_WORLD_NAME, "world");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user