Merge commit '260ac47588c76a2e6814cfba46773a990fb8c5da'

# Conflicts:
#	resources/vanilla
#	src/Server.php
#	src/lang/Language.php
#	src/network/mcpe/protocol/AddItemActorPacket.php
#	src/network/mcpe/protocol/AddPlayerPacket.php
#	src/network/mcpe/protocol/SetActorDataPacket.php
#	src/network/mcpe/serializer/NetworkBinaryStream.php
#	src/permission/Permission.php
#	src/pocketmine/block/Leaves.php
#	src/pocketmine/entity/DataPropertyManager.php
#	src/pocketmine/entity/Entity.php
#	src/pocketmine/item/Banner.php
#	src/pocketmine/item/Item.php
#	src/pocketmine/level/format/io/LevelProvider.php
#	src/pocketmine/level/format/io/LevelProviderManager.php
#	src/pocketmine/network/mcpe/protocol/AddActorPacket.php
#	src/pocketmine/network/mcpe/protocol/LoginPacket.php
#	src/pocketmine/tile/Banner.php
#	src/scheduler/BulkCurlTask.php
#	src/updater/AutoUpdater.php
#	src/utils/Config.php
#	src/utils/Utils.php
#	src/world/generator/Flat.php
#	src/world/generator/Generator.php
This commit is contained in:
Dylan K. Taylor
2020-01-31 21:07:34 +00:00
39 changed files with 164 additions and 25 deletions

View File

@@ -68,10 +68,16 @@ class Config{
public const ENUM = 5; // .txt, .list, .enum
public const ENUMERATION = Config::ENUM;
/** @var mixed[] */
/**
* @var mixed[]
* @phpstan-var array<string, mixed>
*/
private $config = [];
/** @var mixed[] */
/**
* @var mixed[]
* @phpstan-var array<string, mixed>
*/
private $nestedCache = [];
/** @var string */
@@ -107,6 +113,7 @@ class Config{
* @param string $file Path of the file to be loaded
* @param int $type Config type to load, -1 by default (detect)
* @param mixed[] $default Array with the default values that will be written to the file if it did not exist
* @phpstan-param array<string, mixed> $default
*/
public function __construct(string $file, int $type = Config::DETECT, array $default = []){
$this->load($file, $type, $default);
@@ -135,6 +142,7 @@ class Config{
/**
* @param mixed[] $default
* @phpstan-param array<string, mixed> $default
*
* @throws \InvalidArgumentException if config type could not be auto-detected
* @throws \InvalidStateException if config type is invalid
@@ -428,6 +436,7 @@ class Config{
/**
* @param mixed[] $v
* @phpstan-param array<string, mixed> $v
*/
public function setAll(array $v) : void{
$this->config = $v;
@@ -458,6 +467,7 @@ class Config{
/**
* @return mixed[]
* @phpstan-return list<string>|array<string, mixed>
*/
public function getAll(bool $keys = false) : array{
return ($keys ? array_keys($this->config) : $this->config);
@@ -465,6 +475,7 @@ class Config{
/**
* @param mixed[] $defaults
* @phpstan-param array<string, mixed> $defaults
*/
public function setDefaults(array $defaults) : void{
$this->fillDefaults($defaults, $this->config);
@@ -473,6 +484,8 @@ class Config{
/**
* @param mixed[] $default
* @param mixed[] $data reference parameter
* @phpstan-param array<string, mixed> $default
* @phpstan-param array<string, mixed> $data
*/
private function fillDefaults(array $default, &$data) : int{
$changed = 0;

View File

@@ -140,6 +140,7 @@ class MainLogger extends \AttachableThreadedLogger{
/**
* @param mixed[][]|null $trace
* @phpstan-param list<array<string, mixed>>|null $trace
*
* @return void
*/

View File

@@ -354,6 +354,7 @@ class Utils{
/**
* @return mixed[] array of claims
* @phpstan-return array<string, mixed>
*
* @throws \UnexpectedValueException
*/
@@ -392,6 +393,7 @@ class Utils{
/**
* @param mixed[][] $trace
* @phpstan-param list<array<string, mixed>> $trace
*
* @return string[]
*/
@@ -426,6 +428,7 @@ class Utils{
/**
* @return mixed[][]
* @phpstan-return list<array<string, mixed>>
*/
public static function currentTrace(int $skipFrames = 0) : array{
++$skipFrames; //omit this frame from trace, in addition to other skipped frames