phpdoc armageddon for master, pass 1

This commit is contained in:
Dylan K. Taylor
2020-01-22 11:55:03 +00:00
parent 4bae3baa74
commit 67bcc1c0fb
397 changed files with 0 additions and 5391 deletions

View File

@ -46,7 +46,6 @@ abstract class BaseWorldProvider implements WorldProvider{
}
/**
* @return WorldData
* @throws CorruptedWorldException
* @throws UnsupportedWorldFormatException
*/
@ -56,18 +55,11 @@ abstract class BaseWorldProvider implements WorldProvider{
return $this->path;
}
/**
* @return WorldData
*/
public function getWorldData() : WorldData{
return $this->worldData;
}
/**
* @param int $chunkX
* @param int $chunkZ
*
* @return Chunk|null
* @throws CorruptedChunkException
*/
public function loadChunk(int $chunkX, int $chunkZ) : ?Chunk{
@ -82,10 +74,6 @@ abstract class BaseWorldProvider implements WorldProvider{
}
/**
* @param int $chunkX
* @param int $chunkZ
*
* @return Chunk|null
* @throws CorruptedChunkException
*/
abstract protected function readChunk(int $chunkX, int $chunkZ) : ?Chunk;

View File

@ -32,8 +32,6 @@ class ChunkUtils{
* Converts pre-MCPE-1.0 biome color array to biome ID array.
*
* @param int[] $array of biome color values
*
* @return string
*/
public static function convertBiomeColors(array $array) : string{
$result = str_repeat("\x00", 256);

View File

@ -48,10 +48,6 @@ final class FastChunkSerializer{
/**
* Fast-serializes the chunk for passing between threads
* TODO: tiles and entities
*
* @param Chunk $chunk
*
* @return string
*/
public static function serialize(Chunk $chunk) : string{
$stream = new BinaryStream();
@ -97,10 +93,6 @@ final class FastChunkSerializer{
/**
* Deserializes a fast-serialized chunk
*
* @param string $data
*
* @return Chunk
*/
public static function deserialize(string $data) : Chunk{
$stream = new BinaryStream($data);

View File

@ -32,73 +32,42 @@ interface WorldData{
*/
public function save() : void;
/**
* @return string
*/
public function getName() : string;
/**
* Returns the generator name
*
* @return string
*/
public function getGenerator() : string;
/**
* @return array
*/
public function getGeneratorOptions() : array;
/**
* @return int
*/
public function getSeed() : int;
/**
* @return int
*/
public function getTime() : int;
/**
* @param int $value
*/
public function setTime(int $value) : void;
/**
* @return Vector3
*/
public function getSpawn() : Vector3;
/**
* @param Vector3 $pos
*/
public function setSpawn(Vector3 $pos) : void;
/**
* Returns the world difficulty. This will be one of the World constants.
* @return int
*/
public function getDifficulty() : int;
/**
* Sets the world difficulty.
*
* @param int $difficulty
*/
public function setDifficulty(int $difficulty) : void;
/**
* Returns the time in ticks to the next rain level change.
* @return int
*/
public function getRainTime() : int;
/**
* Sets the time in ticks to the next rain level change.
* @param int $ticks
*/
public function setRainTime(int $ticks) : void;
@ -114,13 +83,11 @@ interface WorldData{
/**
* Returns the time in ticks to the next lightning level change.
* @return int
*/
public function getLightningTime() : int;
/**
* Sets the time in ticks to the next lightning level change.
* @param int $ticks
*/
public function setLightningTime(int $ticks) : void;

View File

@ -31,7 +31,6 @@ use pocketmine\world\format\io\exception\UnsupportedWorldFormatException;
interface WorldProvider{
/**
* @param string $path
* @throws CorruptedWorldException
* @throws UnsupportedWorldFormatException
*/
@ -39,34 +38,20 @@ interface WorldProvider{
/**
* Gets the build height limit of this world
*
* @return int
*/
public function getWorldHeight() : int;
/**
* @return string
*/
public function getPath() : string;
/**
* Tells if the path is a valid world.
* This must tell if the current format supports opening the files in the directory
*
* @param string $path
*
* @return bool
*/
public static function isValid(string $path) : bool;
/**
* Loads a chunk (usually from disk storage) and returns it. If the chunk does not exist, null is returned.
*
* @param int $chunkX
* @param int $chunkZ
*
* @return null|Chunk
*
* @throws CorruptedChunkException
*/
public function loadChunk(int $chunkX, int $chunkZ) : ?Chunk;
@ -78,8 +63,6 @@ interface WorldProvider{
/**
* Returns information about the world
*
* @return WorldData
*/
public function getWorldData() : WorldData;
@ -91,10 +74,6 @@ interface WorldProvider{
/**
* Returns a generator which yields all the chunks in this world.
*
* @param bool $skipCorrupted
*
* @param \Logger|null $logger
*
* @return \Generator|Chunk[]
* @throws CorruptedChunkException
*/
@ -102,8 +81,6 @@ interface WorldProvider{
/**
* Returns the number of chunks in the provider. Used for world conversion time estimations.
*
* @return int
*/
public function calculateChunkCount() : int;
}

View File

@ -47,8 +47,6 @@ abstract class WorldProviderManager{
/**
* Returns the default format used to generate new worlds.
*
* @return string
*/
public static function getDefault() : string{
return self::$default;
@ -67,12 +65,6 @@ abstract class WorldProviderManager{
self::$default = $class;
}
/**
* @param string $class
*
* @param string $name
* @param bool $overwrite
*/
public static function addProvider(string $class, string $name, bool $overwrite = false) : void{
Utils::testValidInstance($class, WorldProvider::class);
@ -88,8 +80,6 @@ abstract class WorldProviderManager{
/**
* Returns a WorldProvider class for this path, or null
*
* @param string $path
*
* @return string[]|WorldProvider[]
*/
public static function getMatchingProviders(string $path) : array{
@ -112,10 +102,6 @@ abstract class WorldProviderManager{
/**
* Returns a WorldProvider by name, or null if not found
*
* @param string $name
*
* @return string|null
*/
public static function getProviderByName(string $name) : ?string{
return self::$providers[trim(strtolower($name))] ?? null;

View File

@ -28,19 +28,11 @@ use pocketmine\world\format\Chunk;
interface WritableWorldProvider extends WorldProvider{
/**
* Generate the needed files in the path given
*
* @param string $path
* @param string $name
* @param int $seed
* @param string $generator
* @param array $options
*/
public static function generate(string $path, string $name, int $seed, string $generator, array $options = []) : void;
/**
* Saves a chunk (usually to disk).
*
* @param Chunk $chunk
*/
public function saveChunk(Chunk $chunk) : void;
}

View File

@ -39,8 +39,6 @@ abstract class BaseNbtWorldData implements WorldData{
protected $compoundTag;
/**
* @param string $dataPath
*
* @throws CorruptedWorldException
* @throws UnsupportedWorldFormatException
*/
@ -60,7 +58,6 @@ abstract class BaseNbtWorldData implements WorldData{
}
/**
* @return CompoundTag
* @throws CorruptedWorldException
* @throws UnsupportedWorldFormatException
*/

View File

@ -108,9 +108,6 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
}
/**
* @param string $path
*
* @return \LevelDB
* @throws \LevelDBException
*/
private static function createDB(string $path) : \LevelDB{
@ -197,9 +194,6 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
}
/**
* @param string $index
* @param int $chunkVersion
*
* @return PalettedBlockArray[]
*/
protected function deserializeLegacyExtraData(string $index, int $chunkVersion) : array{
@ -232,10 +226,6 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
}
/**
* @param int $chunkX
* @param int $chunkZ
*
* @return Chunk|null
* @throws CorruptedChunkException
*/
protected function readChunk(int $chunkX, int $chunkZ) : ?Chunk{
@ -490,8 +480,6 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
/**
* @param CompoundTag[] $targets
* @param string $index
* @param \LevelDBWriteBatch $write
*/
private function writeTags(array $targets, string $index, \LevelDBWriteBatch $write) : void{
if(!empty($targets)){
@ -502,9 +490,6 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
}
}
/**
* @return \LevelDB
*/
public function getDatabase() : \LevelDB{
return $this->db;
}

View File

@ -49,9 +49,6 @@ trait LegacyAnvilChunkTrait{
}
/**
* @param string $data
*
* @return Chunk
* @throws CorruptedChunkException
*/
protected function deserializeChunk(string $data) : Chunk{

View File

@ -39,9 +39,6 @@ use function str_repeat;
class McRegion extends RegionWorldProvider{
/**
* @param Chunk $chunk
*
* @return string
* @throws \RuntimeException
*/
protected function serializeChunk(Chunk $chunk) : string{
@ -49,9 +46,6 @@ class McRegion extends RegionWorldProvider{
}
/**
* @param string $data
*
* @return Chunk
* @throws CorruptedChunkException
*/
protected function deserializeChunk(string $data) : Chunk{

View File

@ -111,10 +111,6 @@ class RegionLoader{
}
/**
* @param int $x
* @param int $z
*
* @return null|string
* @throws \InvalidArgumentException if invalid coordinates are given
* @throws CorruptedChunkException if chunk corruption is detected
*/
@ -163,10 +159,6 @@ class RegionLoader{
}
/**
* @param int $x
* @param int $z
*
* @return bool
* @throws \InvalidArgumentException
*/
public function chunkExists(int $x, int $z) : bool{
@ -174,10 +166,6 @@ class RegionLoader{
}
/**
* @param int $x
* @param int $z
* @param string $chunkData
*
* @throws ChunkException
* @throws \InvalidArgumentException
*/
@ -207,9 +195,6 @@ class RegionLoader{
}
/**
* @param int $x
* @param int $z
*
* @throws \InvalidArgumentException
*/
public function removeChunk(int $x, int $z) : void{
@ -219,10 +204,6 @@ class RegionLoader{
}
/**
* @param int $x
* @param int $z
*
* @return int
* @throws \InvalidArgumentException
*/
protected static function getChunkOffset(int $x, int $z) : int{
@ -233,7 +214,6 @@ class RegionLoader{
}
/**
* @param int $offset
* @param int $x reference parameter
* @param int $z reference parameter
*/

View File

@ -35,10 +35,6 @@ class RegionLocationTableEntry{
private $timestamp;
/**
* @param int $firstSector
* @param int $sectorCount
* @param int $timestamp
*
* @throws \InvalidArgumentException
*/
public function __construct(int $firstSector, int $sectorCount, int $timestamp){
@ -53,16 +49,10 @@ class RegionLocationTableEntry{
$this->timestamp = $timestamp;
}
/**
* @return int
*/
public function getFirstSector() : int{
return $this->firstSector;
}
/**
* @return int
*/
public function getLastSector() : int{
return $this->firstSector + $this->sectorCount - 1;
}
@ -75,23 +65,14 @@ class RegionLocationTableEntry{
return range($this->getFirstSector(), $this->getLastSector());
}
/**
* @return int
*/
public function getSectorCount() : int{
return $this->sectorCount;
}
/**
* @return int
*/
public function getTimestamp() : int{
return $this->timestamp;
}
/**
* @return bool
*/
public function isNull() : bool{
return $this->firstSector === 0 or $this->sectorCount === 0;
}

View File

@ -51,13 +51,11 @@ abstract class RegionWorldProvider extends BaseWorldProvider{
/**
* Returns the file extension used for regions in this region-based format.
* @return string
*/
abstract protected static function getRegionFileExtension() : string;
/**
* Returns the storage version as per Minecraft PC world formats.
* @return int
*/
abstract protected static function getPcWorldFormatVersion() : int;
@ -105,8 +103,6 @@ abstract class RegionWorldProvider extends BaseWorldProvider{
}
/**
* @param int $chunkX
* @param int $chunkZ
* @param int $regionX reference parameter
* @param int $regionZ reference parameter
*/
@ -115,32 +111,17 @@ abstract class RegionWorldProvider extends BaseWorldProvider{
$regionZ = $chunkZ >> 5;
}
/**
* @param int $regionX
* @param int $regionZ
*
* @return RegionLoader|null
*/
protected function getRegion(int $regionX, int $regionZ) : ?RegionLoader{
return $this->regions[World::chunkHash($regionX, $regionZ)] ?? null;
}
/**
* Returns the path to a specific region file based on its X/Z coordinates
*
* @param int $regionX
* @param int $regionZ
*
* @return string
*/
protected function pathToRegion(int $regionX, int $regionZ) : string{
return $this->path . "/region/r.$regionX.$regionZ." . static::getRegionFileExtension();
}
/**
* @param int $regionX
* @param int $regionZ
*/
protected function loadRegion(int $regionX, int $regionZ) : void{
if(!isset($this->regions[$index = World::chunkHash($regionX, $regionZ)])){
$path = $this->pathToRegion($regionX, $regionZ);
@ -183,17 +164,11 @@ abstract class RegionWorldProvider extends BaseWorldProvider{
abstract protected function serializeChunk(Chunk $chunk) : string;
/**
* @param string $data
*
* @return Chunk
* @throws CorruptedChunkException
*/
abstract protected function deserializeChunk(string $data) : Chunk;
/**
* @param string $context
* @param ListTag $list
*
* @return CompoundTag[]
* @throws CorruptedChunkException
*/
@ -216,10 +191,6 @@ abstract class RegionWorldProvider extends BaseWorldProvider{
}
/**
* @param int $chunkX
* @param int $chunkZ
*
* @return Chunk|null
* @throws CorruptedChunkException
*/
protected function readChunk(int $chunkX, int $chunkZ) : ?Chunk{