Fixed some doc problems

This commit is contained in:
Dylan K. Taylor 2017-06-25 12:07:28 +01:00
parent c0377fc63a
commit a365c831a8
28 changed files with 50 additions and 33 deletions

View File

@ -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

View File

@ -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();

View File

@ -139,7 +139,7 @@ abstract class Command{
}
/**
* @return string
* @return string|null
*/
public function getPermission(){
return $this->commandData["pocketminePermission"] ?? null;

View File

@ -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;

View File

@ -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){

View File

@ -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;

View File

@ -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{

View File

@ -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;
/**

View File

@ -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;

View File

@ -36,6 +36,7 @@ use pocketmine\entity\Vehicle;
class EntityDespawnEvent extends EntityEvent{
public static $handlerList = null;
/** @var int */
private $entityType;
/**

View File

@ -36,6 +36,7 @@ use pocketmine\entity\Vehicle;
class EntitySpawnEvent extends EntityEvent{
public static $handlerList = null;
/** @var int */
private $entityType;
/**

View File

@ -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;
}
/**

View File

@ -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()])){

View File

@ -51,7 +51,7 @@ class InventoryType{
/**
* @param $index
*
* @return InventoryType
* @return InventoryType|null
*/
public static function get($index){
return static::$default[$index] ?? null;

View File

@ -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;

View File

@ -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)])){

View File

@ -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;

View File

@ -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[] */

View File

@ -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;

View File

@ -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;

View File

@ -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{

View File

@ -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);

View File

@ -45,6 +45,9 @@ interface Plugin extends CommandExecutor{
*/
public function onEnable();
/**
* @return bool
*/
public function isEnabled();
/**

View File

@ -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), "/");

View File

@ -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);

View File

@ -225,7 +225,7 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
}
/**
* @return Chest
* @return Chest|null
*/
public function getPair(){
if($this->isPaired()){

View File

@ -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])){

View File

@ -36,6 +36,7 @@ class Utils{
public static $online = true;
public static $ip = false;
public static $os;
/** @var UUID|null */
private static $serverUniqueId = null;
/**