diff --git a/src/pocketmine/PocketMine.php b/src/pocketmine/PocketMine.php index fae48b793..e5c056ef6 100644 --- a/src/pocketmine/PocketMine.php +++ b/src/pocketmine/PocketMine.php @@ -291,7 +291,7 @@ namespace pocketmine { /** * @param string $offset In the format of +09:00, +02:00, -04:00 etc. * - * @return string + * @return string|bool */ function parse_offset($offset){ //Make signed offsets unsigned for date_parse diff --git a/src/pocketmine/block/Block.php b/src/pocketmine/block/Block.php index 2bf5099d5..20c8aa624 100644 --- a/src/pocketmine/block/Block.php +++ b/src/pocketmine/block/Block.php @@ -680,7 +680,7 @@ class Block extends Position implements BlockIds, Metadatable{ * @param Vector3 $pos1 * @param Vector3 $pos2 * - * @return MovingObjectPosition + * @return MovingObjectPosition|null */ public function calculateIntercept(Vector3 $pos1, Vector3 $pos2){ $bb = $this->getBoundingBox(); diff --git a/src/pocketmine/command/Command.php b/src/pocketmine/command/Command.php index 65f6b5411..d0e07587f 100644 --- a/src/pocketmine/command/Command.php +++ b/src/pocketmine/command/Command.php @@ -139,7 +139,7 @@ abstract class Command{ } /** - * @return string + * @return string|null */ public function getPermission(){ return $this->commandData["pocketminePermission"] ?? null; diff --git a/src/pocketmine/command/CommandReader.php b/src/pocketmine/command/CommandReader.php index e8bab2a84..093a4d9ee 100644 --- a/src/pocketmine/command/CommandReader.php +++ b/src/pocketmine/command/CommandReader.php @@ -160,7 +160,7 @@ class CommandReader extends Thread{ */ public function getLine(){ if($this->buffer->count() !== 0){ - return $this->buffer->shift(); + return (string) $this->buffer->shift(); } return null; diff --git a/src/pocketmine/command/defaults/ParticleCommand.php b/src/pocketmine/command/defaults/ParticleCommand.php index 0e7c5dec4..ba51cf0ed 100644 --- a/src/pocketmine/command/defaults/ParticleCommand.php +++ b/src/pocketmine/command/defaults/ParticleCommand.php @@ -133,7 +133,7 @@ class ParticleCommand extends VanillaCommand{ * @param float $zd * @param int|null $data * - * @return Particle + * @return Particle|null */ private function getParticle($name, Vector3 $pos, $xd, $yd, $zd, $data){ switch($name){ diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index e95a69026..f82321ae7 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -698,7 +698,7 @@ abstract class Entity extends Location implements Metadatable{ * @param CompoundTag $nbt * @param $args * - * @return Entity + * @return Entity|null */ public static function createEntity($type, Level $level, CompoundTag $nbt, ...$args){ if(isset(self::$knownEntities[$type])){ @@ -1897,7 +1897,7 @@ abstract class Entity extends Location implements Metadatable{ /** * @param int $id * - * @return int + * @return int|null */ public function getDataPropertyType($id){ return isset($this->dataProperties[$id]) ? $this->dataProperties[$id][0] : null; diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index 1fa732c80..6e2bf3d98 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -328,7 +328,7 @@ abstract class Living extends Entity implements Damageable{ * @param int $maxDistance * @param array $transparent * - * @return Block + * @return Block|null */ public function getTargetBlock($maxDistance, array $transparent = []){ try{ diff --git a/src/pocketmine/event/Event.php b/src/pocketmine/event/Event.php index a5e6fef75..caff3e999 100644 --- a/src/pocketmine/event/Event.php +++ b/src/pocketmine/event/Event.php @@ -36,7 +36,9 @@ abstract class Event{ * Not doing so will deny the proper event initialization */ + /** @var string|null */ protected $eventName = null; + /** @var bool */ private $isCancelled = false; /** diff --git a/src/pocketmine/event/TranslationContainer.php b/src/pocketmine/event/TranslationContainer.php index f71ffcdaa..67c6c8ca5 100644 --- a/src/pocketmine/event/TranslationContainer.php +++ b/src/pocketmine/event/TranslationContainer.php @@ -48,7 +48,7 @@ class TranslationContainer extends TextContainer{ /** * @param int $i * - * @return string + * @return string|null */ public function getParameter($i){ return isset($this->params[$i]) ? $this->params[$i] : null; diff --git a/src/pocketmine/event/entity/EntityDespawnEvent.php b/src/pocketmine/event/entity/EntityDespawnEvent.php index c35b82bb7..2b783278f 100644 --- a/src/pocketmine/event/entity/EntityDespawnEvent.php +++ b/src/pocketmine/event/entity/EntityDespawnEvent.php @@ -36,6 +36,7 @@ use pocketmine\entity\Vehicle; class EntityDespawnEvent extends EntityEvent{ public static $handlerList = null; + /** @var int */ private $entityType; /** diff --git a/src/pocketmine/event/entity/EntitySpawnEvent.php b/src/pocketmine/event/entity/EntitySpawnEvent.php index 2ef6e8bdd..cae7724e6 100644 --- a/src/pocketmine/event/entity/EntitySpawnEvent.php +++ b/src/pocketmine/event/entity/EntitySpawnEvent.php @@ -36,6 +36,7 @@ use pocketmine\entity\Vehicle; class EntitySpawnEvent extends EntityEvent{ public static $handlerList = null; + /** @var int */ private $entityType; /** diff --git a/src/pocketmine/event/server/LowMemoryEvent.php b/src/pocketmine/event/server/LowMemoryEvent.php index 63151f2aa..c56e1b739 100644 --- a/src/pocketmine/event/server/LowMemoryEvent.php +++ b/src/pocketmine/event/server/LowMemoryEvent.php @@ -33,7 +33,9 @@ use pocketmine\utils\Utils; class LowMemoryEvent extends ServerEvent{ public static $handlerList = null; + /** @var int */ private $memory; + /** @var int */ private $memoryLimit; private $triggerCount; private $global; @@ -60,7 +62,7 @@ class LowMemoryEvent extends ServerEvent{ * @return int */ public function getMemoryLimit(){ - return $this->memory; + return $this->memoryLimit; } /** diff --git a/src/pocketmine/inventory/CraftingManager.php b/src/pocketmine/inventory/CraftingManager.php index 95fd1cced..aca85258b 100644 --- a/src/pocketmine/inventory/CraftingManager.php +++ b/src/pocketmine/inventory/CraftingManager.php @@ -151,7 +151,7 @@ class CraftingManager{ /** * @param UUID $id - * @return Recipe + * @return Recipe|null */ public function getRecipe(UUID $id){ $index = $id->toBinary(); @@ -175,7 +175,7 @@ class CraftingManager{ /** * @param Item $input * - * @return FurnaceRecipe + * @return FurnaceRecipe|null */ public function matchFurnaceRecipe(Item $input){ if(isset($this->furnaceRecipes[$input->getId() . ":" . $input->getDamage()])){ diff --git a/src/pocketmine/inventory/InventoryType.php b/src/pocketmine/inventory/InventoryType.php index a6ff58038..d29e2ba0a 100644 --- a/src/pocketmine/inventory/InventoryType.php +++ b/src/pocketmine/inventory/InventoryType.php @@ -51,7 +51,7 @@ class InventoryType{ /** * @param $index * - * @return InventoryType + * @return InventoryType|null */ public static function get($index){ return static::$default[$index] ?? null; diff --git a/src/pocketmine/item/Item.php b/src/pocketmine/item/Item.php index 14f216cee..2cad38717 100644 --- a/src/pocketmine/item/Item.php +++ b/src/pocketmine/item/Item.php @@ -294,7 +294,7 @@ class Item implements ItemIds, \JsonSerializable{ /** * @param $index * - * @return Item + * @return Item|null */ public static function getCreativeItem(int $index){ return Item::$creative[$index] ?? null; diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 8c248b3a4..337b2e380 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -1848,7 +1848,7 @@ class Level implements ChunkManager, Metadatable{ /** * @param int $entityId * - * @return Entity + * @return Entity|null */ public function getEntity(int $entityId){ return $this->entities[$entityId] ?? null; @@ -1935,7 +1935,7 @@ class Level implements ChunkManager, Metadatable{ /** * @param $tileId * - * @return Tile + * @return Tile|null */ public function getTileById(int $tileId){ return $this->tiles[$tileId] ?? null; @@ -1962,7 +1962,7 @@ class Level implements ChunkManager, Metadatable{ * * @param Vector3 $pos * - * @return Tile + * @return Tile|null */ public function getTile(Vector3 $pos){ $chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false); @@ -2196,7 +2196,7 @@ class Level implements ChunkManager, Metadatable{ * @param int $z * @param bool $create Whether to generate the chunk if it does not exist * - * @return Chunk + * @return Chunk|null */ public function getChunk(int $x, int $z, bool $create = false){ if(isset($this->chunks[$index = Level::chunkHash($x, $z)])){ diff --git a/src/pocketmine/level/SimpleChunkManager.php b/src/pocketmine/level/SimpleChunkManager.php index c22cdcccc..19f088ab1 100644 --- a/src/pocketmine/level/SimpleChunkManager.php +++ b/src/pocketmine/level/SimpleChunkManager.php @@ -33,6 +33,12 @@ class SimpleChunkManager implements ChunkManager{ protected $seed; protected $worldHeight; + /** + * SimpleChunkManager constructor. + * + * @param int $seed + * @param int $worldHeight + */ public function __construct($seed, int $worldHeight = Level::Y_MAX){ $this->seed = $seed; $this->worldHeight = $worldHeight; diff --git a/src/pocketmine/level/format/Chunk.php b/src/pocketmine/level/format/Chunk.php index b71fae29e..0865b28f2 100644 --- a/src/pocketmine/level/format/Chunk.php +++ b/src/pocketmine/level/format/Chunk.php @@ -67,12 +67,13 @@ class Chunk{ /** @var Entity[] */ protected $entities = []; - /** @var int[256] */ + /** @var int[] */ protected $heightMap = []; /** @var string */ protected $biomeIds; + /** @var int[] */ protected $extraData = []; /** @var CompoundTag[] */ diff --git a/src/pocketmine/level/format/io/region/McRegion.php b/src/pocketmine/level/format/io/region/McRegion.php index c23af793d..c8778a2a0 100644 --- a/src/pocketmine/level/format/io/region/McRegion.php +++ b/src/pocketmine/level/format/io/region/McRegion.php @@ -430,7 +430,7 @@ class McRegion extends BaseLevelProvider{ * @param int $x * @param int $z * - * @return RegionLoader + * @return RegionLoader|null */ protected function getRegion(int $x, int $z){ return $this->regions[Level::chunkHash($x, $z)] ?? null; diff --git a/src/pocketmine/math/Vector3.php b/src/pocketmine/math/Vector3.php index e572d2166..b5b8515ee 100644 --- a/src/pocketmine/math/Vector3.php +++ b/src/pocketmine/math/Vector3.php @@ -245,7 +245,7 @@ class Vector3{ * @param Vector3 $v * @param float $x * - * @return Vector3 + * @return Vector3|null */ public function getIntermediateWithXValue(Vector3 $v, $x){ $xDiff = $v->x - $this->x; @@ -272,7 +272,7 @@ class Vector3{ * @param Vector3 $v * @param float $y * - * @return Vector3 + * @return Vector3|null */ public function getIntermediateWithYValue(Vector3 $v, $y){ $xDiff = $v->x - $this->x; @@ -299,7 +299,7 @@ class Vector3{ * @param Vector3 $v * @param float $z * - * @return Vector3 + * @return Vector3|null */ public function getIntermediateWithZValue(Vector3 $v, $z){ $xDiff = $v->x - $this->x; diff --git a/src/pocketmine/permission/BanEntry.php b/src/pocketmine/permission/BanEntry.php index 4d04bd653..fd952e668 100644 --- a/src/pocketmine/permission/BanEntry.php +++ b/src/pocketmine/permission/BanEntry.php @@ -104,9 +104,9 @@ class BanEntry{ /** * @param string $str * - * @return BanEntry + * @return BanEntry|null */ - public static function fromString($str){ + public static function fromString(string $str){ if(strlen($str) < 2){ return null; }else{ diff --git a/src/pocketmine/plugin/PharPluginLoader.php b/src/pocketmine/plugin/PharPluginLoader.php index 6c35e145a..5e7b79241 100644 --- a/src/pocketmine/plugin/PharPluginLoader.php +++ b/src/pocketmine/plugin/PharPluginLoader.php @@ -47,7 +47,7 @@ class PharPluginLoader implements PluginLoader{ * * @param string $file * - * @return Plugin + * @return Plugin|null * * @throws \Exception */ @@ -80,7 +80,7 @@ class PharPluginLoader implements PluginLoader{ * * @param string $file * - * @return PluginDescription + * @return PluginDescription|null */ public function getPluginDescription($file){ $phar = new \Phar($file); diff --git a/src/pocketmine/plugin/Plugin.php b/src/pocketmine/plugin/Plugin.php index befe5a541..3c22f091e 100644 --- a/src/pocketmine/plugin/Plugin.php +++ b/src/pocketmine/plugin/Plugin.php @@ -45,6 +45,9 @@ interface Plugin extends CommandExecutor{ */ public function onEnable(); + /** + * @return bool + */ public function isEnabled(); /** diff --git a/src/pocketmine/plugin/PluginBase.php b/src/pocketmine/plugin/PluginBase.php index 63b2d4d66..b6f0c7fb7 100644 --- a/src/pocketmine/plugin/PluginBase.php +++ b/src/pocketmine/plugin/PluginBase.php @@ -137,7 +137,7 @@ abstract class PluginBase implements Plugin{ /** * @param string $name * - * @return Command|PluginIdentifiableCommand + * @return Command|PluginIdentifiableCommand|null */ public function getCommand($name){ $command = $this->getServer()->getPluginCommand($name); @@ -177,7 +177,7 @@ abstract class PluginBase implements Plugin{ * * @param string $filename * - * @return resource Resource data, or null + * @return resource|null Resource data, or null */ public function getResource($filename){ $filename = rtrim(str_replace("\\", "/", $filename), "/"); diff --git a/src/pocketmine/plugin/ScriptPluginLoader.php b/src/pocketmine/plugin/ScriptPluginLoader.php index c96511e8d..05f2524d8 100644 --- a/src/pocketmine/plugin/ScriptPluginLoader.php +++ b/src/pocketmine/plugin/ScriptPluginLoader.php @@ -48,7 +48,7 @@ class ScriptPluginLoader implements PluginLoader{ * * @param string $file * - * @return Plugin + * @return Plugin|null * * @throws \Exception */ @@ -82,7 +82,7 @@ class ScriptPluginLoader implements PluginLoader{ * * @param string $file * - * @return PluginDescription + * @return PluginDescription|null */ public function getPluginDescription($file){ $content = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); diff --git a/src/pocketmine/tile/Chest.php b/src/pocketmine/tile/Chest.php index c3df50689..46e1fd471 100644 --- a/src/pocketmine/tile/Chest.php +++ b/src/pocketmine/tile/Chest.php @@ -225,7 +225,7 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{ } /** - * @return Chest + * @return Chest|null */ public function getPair(){ if($this->isPaired()){ diff --git a/src/pocketmine/tile/Tile.php b/src/pocketmine/tile/Tile.php index 1138addd6..667ecf7b1 100644 --- a/src/pocketmine/tile/Tile.php +++ b/src/pocketmine/tile/Tile.php @@ -82,7 +82,7 @@ abstract class Tile extends Position{ * @param CompoundTag $nbt * @param $args * - * @return Tile + * @return Tile|null */ public static function createTile($type, Level $level, CompoundTag $nbt, ...$args){ if(isset(self::$knownTiles[$type])){ diff --git a/src/pocketmine/utils/Utils.php b/src/pocketmine/utils/Utils.php index ce8762fb4..d128f5168 100644 --- a/src/pocketmine/utils/Utils.php +++ b/src/pocketmine/utils/Utils.php @@ -36,6 +36,7 @@ class Utils{ public static $online = true; public static $ip = false; public static $os; + /** @var UUID|null */ private static $serverUniqueId = null; /**