added missing @var property types (reported by phpstan)

This commit is contained in:
Dylan K. Taylor 2020-01-09 14:13:54 +00:00
parent cda3e6f4dc
commit 1eedac87b2
63 changed files with 190 additions and 1 deletions

View File

@ -25,6 +25,7 @@ namespace pocketmine;
abstract class Collectable extends \Threaded{
/** @var bool */
private $isGarbage = false;
public function isGarbage() : bool{

View File

@ -96,8 +96,11 @@ class CrashDump{
/** @var Server */
private $server;
/** @var resource */
private $fp;
/** @var int */
private $time;
/** @var mixed[] */
private $data = [];
/** @var string */
private $encodedData = "";

View File

@ -282,6 +282,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** @var string */
protected $xuid = "";
/** @var int */
protected $windowCnt = 2;
/** @var int[] */
protected $windows = [];

View File

@ -33,6 +33,7 @@ abstract class Thread extends \Thread{
/** @var string|null */
protected $composerAutoloaderPath;
/** @var bool */
protected $isKilled = false;
public function getClassLoader(){

View File

@ -33,6 +33,7 @@ abstract class Worker extends \Worker{
/** @var string|null */
protected $composerAutoloaderPath;
/** @var bool */
protected $isKilled = false;
public function getClassLoader(){

View File

@ -39,6 +39,7 @@ class Leaves extends Transparent{
public const DARK_OAK = 1;
protected $id = self::LEAVES;
/** @var int */
protected $woodType = self::WOOD;
public function __construct(int $meta = 0){

View File

@ -29,6 +29,7 @@ use pocketmine\item\ItemFactory;
class Leaves2 extends Leaves{
protected $id = self::LEAVES2;
/** @var int */
protected $woodType = self::WOOD2;
public function getName() : string{

View File

@ -38,6 +38,7 @@ use function min;
abstract class Liquid extends Transparent{
/** @var int */
public $adjacentSources = 0;
/** @var Vector3|null */

View File

@ -54,7 +54,9 @@ class CommandReader extends Thread{
/** @var \Threaded */
protected $buffer;
/** @var bool */
private $shutdown = false;
/** @var int */
private $type = self::TYPE_STREAM;
/** @var SleeperNotifier|null */

View File

@ -37,6 +37,7 @@ use const PHP_INT_MAX;
class ConsoleCommandSender implements CommandSender{
/** @var PermissibleBase */
private $perm;
/** @var int|null */

View File

@ -32,6 +32,7 @@ use function strpos;
use function substr;
class FormattedCommandAlias extends Command{
/** @var string[] */
private $formatStrings = [];
/**

View File

@ -46,14 +46,22 @@ class Attribute{
public const HORSE_JUMP_STRENGTH = 14;
public const ZOMBIE_SPAWN_REINFORCEMENTS = 15;
/** @var int */
private $id;
/** @var float */
protected $minValue;
/** @var float */
protected $maxValue;
/** @var float */
protected $defaultValue;
/** @var float */
protected $currentValue;
/** @var string */
protected $name;
/** @var bool */
protected $shouldSend;
/** @var bool */
protected $desynchronized = true;
/** @var Attribute[] */

View File

@ -32,8 +32,10 @@ use function is_string;
class DataPropertyManager{
/** @var mixed[][] */
private $properties = [];
/** @var mixed[][] */
private $dirtyProperties = [];
public function __construct(){

View File

@ -317,6 +317,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
public const DATA_PLAYER_FLAG_SLEEP = 1;
public const DATA_PLAYER_FLAG_DEAD = 2; //TODO: CHECK
/** @var int */
public static $entityCount = 1;
/** @var string[] */
private static $knownEntities = [];
@ -504,6 +505,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** @var float */
private $health = 20.0;
/** @var int */
private $maxHealth = 20;
/** @var float */

View File

@ -81,6 +81,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** @var UUID */
protected $uuid;
/** @var string */
protected $rawUUID;
public $width = 0.6;
@ -90,10 +91,14 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** @var Skin */
protected $skin;
/** @var int */
protected $foodTickTimer = 0;
/** @var int */
protected $totalXp = 0;
/** @var int */
protected $xpSeed;
/** @var int */
protected $xpCooldown = 0;
protected $baseOffset = 1.62;

View File

@ -70,6 +70,7 @@ abstract class Living extends Entity implements Damageable{
protected $gravity = 0.08;
protected $drag = 0.02;
/** @var int */
protected $attackTime = 0;
/** @var int */
@ -77,6 +78,7 @@ abstract class Living extends Entity implements Damageable{
/** @var int */
protected $maxDeadTicks = 25;
/** @var float */
protected $jumpVelocity = 0.42;
/** @var EffectInstance[] */

View File

@ -42,8 +42,10 @@ class Squid extends WaterAnimal{
/** @var Vector3|null */
public $swimDirection = null;
/** @var float */
public $swimSpeed = 0.1;
/** @var int */
private $switchDirectionTicker = 0;
public function initEntity() : void{

View File

@ -43,6 +43,7 @@ class PrimedTNT extends Entity implements Explosive{
protected $gravity = 0.04;
protected $drag = 0.02;
/** @var int */
protected $fuse;
public $canCollide = false;

View File

@ -27,6 +27,7 @@ use pocketmine\entity\Entity;
use pocketmine\event\Cancellable;
class EntityCombustEvent extends EntityEvent implements Cancellable{
/** @var int */
protected $duration;
/**

View File

@ -40,6 +40,7 @@ class PlayerDeathEvent extends EntityDeathEvent{
/** @var TextContainer|string */
private $deathMessage;
/** @var bool */
private $keepInventory = false;
/**

View File

@ -39,6 +39,7 @@ class MultiRecipe{
public const TYPE_FIREWORKS = "00000000-0000-0000-0000-000000000002";
public const TYPE_MAP_LOCKING_CARTOGRAPHY = "602234E4-CAC1-4353-8BB7-B1EBFF70024B";
/** @var UUID */
private $uuid;
public function __construct(UUID $uuid){

View File

@ -53,6 +53,7 @@ use function spl_object_hash;
* @see InventoryAction
*/
class InventoryTransaction{
/** @var bool */
protected $hasExecuted = false;
/** @var Player */
protected $source;

View File

@ -37,6 +37,7 @@ class CreativeInventoryAction extends InventoryAction{
*/
public const TYPE_CREATE_ITEM = 1;
/** @var int */
protected $actionType;
public function __construct(Item $sourceItem, Item $targetItem, int $actionType){

View File

@ -120,7 +120,9 @@ use const PHP_INT_MIN;
class Level implements ChunkManager, Metadatable{
/** @var int */
private static $levelIdCounter = 1;
/** @var int */
private static $chunkLoaderCounter = 1;
public const Y_MASK = 0xFF;

View File

@ -32,7 +32,9 @@ class SimpleChunkManager implements ChunkManager{
/** @var Chunk[] */
protected $chunks = [];
/** @var int */
protected $seed;
/** @var int */
protected $worldHeight;
/**

View File

@ -32,6 +32,7 @@ class ForestBiome extends GrassyBiome{
public const TYPE_NORMAL = 0;
public const TYPE_BIRCH = 1;
/** @var int */
public $type;
public function __construct(int $type = self::TYPE_NORMAL){

View File

@ -38,9 +38,13 @@ if(!defined(__NAMESPACE__ . '\ZERO_NIBBLE_ARRAY')){
}
class SubChunk implements SubChunkInterface{
/** @var string */
protected $ids;
/** @var string */
protected $data;
/** @var string */
protected $blockLight;
/** @var string */
protected $skyLight;
private static function assignData(&$target, string $data, int $length, string $value = "\x00"){

View File

@ -34,12 +34,17 @@ use function strlen;
class ChunkRequestTask extends AsyncTask{
/** @var int */
protected $levelId;
/** @var string */
protected $chunk;
/** @var int */
protected $chunkX;
/** @var int */
protected $chunkZ;
/** @var int */
protected $compressionLevel;
/** @var int */

View File

@ -31,6 +31,7 @@ use function strtolower;
use function trim;
abstract class LevelProviderManager{
/** @var string[] */
protected static $providers = [];
public static function init() : void{

View File

@ -62,6 +62,7 @@ class RegionLoader{
private const FIRST_SECTOR = 2; //location table occupies 0 and 1
/** @var int */
public static $COMPRESSION_LEVEL = 7;
/** @var int */

View File

@ -34,10 +34,15 @@ use function unserialize;
class GeneratorRegisterTask extends AsyncTask{
/** @var string */
public $generatorClass;
/** @var string */
public $settings;
/** @var int */
public $seed;
/** @var int */
public $levelId;
/** @var int */
public $worldHeight = Level::Y_MAX;
public function __construct(Level $level, string $generatorClass, array $generatorSettings = []){

View File

@ -28,6 +28,7 @@ use pocketmine\scheduler\AsyncTask;
class GeneratorUnregisterTask extends AsyncTask{
/** @var int */
public $levelId;
public function __construct(Level $level){

View File

@ -31,18 +31,31 @@ use pocketmine\Server;
class PopulationTask extends AsyncTask{
/** @var bool */
public $state;
/** @var int */
public $levelId;
/** @var string */
public $chunk;
/** @var string */
public $chunk0;
/** @var string */
public $chunk1;
/** @var string */
public $chunk2;
/** @var string */
public $chunk3;
//center chunk
/** @var string */
public $chunk5;
/** @var string */
public $chunk6;
/** @var string */
public $chunk7;
/** @var string */
public $chunk8;
public function __construct(Level $level, Chunk $chunk){

View File

@ -31,12 +31,19 @@ use function array_fill;
use function assert;
abstract class Noise{
/** @var int[] */
protected $perm = [];
/** @var float */
protected $offsetX = 0;
/** @var float */
protected $offsetY = 0;
/** @var float */
protected $offsetZ = 0;
/** @var int */
protected $octaves = 8;
/** @var float */
protected $persistence;
/** @var float */
protected $expansion;
public static function floor($x) : int{

View File

@ -26,6 +26,7 @@ namespace pocketmine\level\generator\noise;
use pocketmine\utils\Random;
class Perlin extends Noise{
/** @var int[][] */
public static $grad3 = [
[1, 1, 0], [-1, 1, 0], [1, -1, 0], [-1, -1, 0],
[1, 0, 1], [-1, 0, 1], [1, 0, -1], [-1, 0, -1],

View File

@ -34,18 +34,31 @@ use function sqrt;
* http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
*/
class Simplex extends Perlin{
/** @var float */
protected static $SQRT_3;
/** @var float */
protected static $SQRT_5;
/** @var float */
protected static $F2;
/** @var float */
protected static $G2;
/** @var float */
protected static $G22;
/** @var float */
protected static $F3;
/** @var float */
protected static $G3;
/** @var float */
protected static $F4;
/** @var float */
protected static $G4;
/** @var float */
protected static $G42;
/** @var float */
protected static $G43;
/** @var float */
protected static $G44;
/** @var int[][] */
protected static $grad4 = [[0, 1, 1, 1], [0, 1, 1, -1], [0, 1, -1, 1], [0, 1, -1, -1],
[0, -1, 1, 1], [0, -1, 1, -1], [0, -1, -1, 1], [0, -1, -1, -1],
[1, 0, 1, 1], [1, 0, 1, -1], [1, 0, -1, 1], [1, 0, -1, -1],
@ -54,6 +67,8 @@ class Simplex extends Perlin{
[-1, 1, 0, 1], [-1, 1, 0, -1], [-1, -1, 0, 1], [-1, -1, 0, -1],
[1, 1, 1, 0], [1, 1, -1, 0], [1, -1, 1, 0], [1, -1, -1, 0],
[-1, 1, 1, 0], [-1, 1, -1, 0], [-1, -1, 1, 0], [-1, -1, -1, 0]];
/** @var int[][] */
protected static $simplex = [
[0, 1, 2, 3], [0, 1, 3, 2], [0, 0, 0, 0], [0, 2, 3, 1], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [1, 2, 3, 0],
[0, 2, 1, 3], [0, 0, 0, 0], [0, 3, 1, 2], [0, 3, 2, 1], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [1, 3, 2, 0],
@ -63,6 +78,8 @@ class Simplex extends Perlin{
[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0],
[2, 0, 1, 3], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [3, 0, 1, 2], [3, 0, 2, 1], [0, 0, 0, 0], [3, 1, 2, 0],
[2, 1, 0, 3], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [3, 1, 0, 2], [0, 0, 0, 0], [3, 2, 0, 1], [3, 2, 1, 0]];
/** @var float */
protected $offsetW;

View File

@ -55,7 +55,9 @@ class Normal extends Generator{
/** @var BiomeSelector */
private $selector;
/** @var float[][]|null */
private static $GAUSSIAN_KERNEL = null;
/** @var int */
private static $SMOOTH_SIZE = 2;
/**

View File

@ -30,6 +30,7 @@ use pocketmine\utils\Random;
class BirchTree extends Tree{
/** @var bool */
protected $superBirch = false;
public function __construct(bool $superBirch = false){

View File

@ -29,7 +29,9 @@ use pocketmine\math\Vector3;
use pocketmine\utils\Random;
class Pond{
/** @var Random */
private $random;
/** @var Block */
public $type;
public function __construct(Random $random, Block $type){

View File

@ -31,6 +31,7 @@ use pocketmine\utils\Random;
use function abs;
abstract class Tree{
/** @var bool[] */
public $overridable = [
Block::AIR => true,
Block::SAPLING => true,
@ -39,9 +40,13 @@ abstract class Tree{
Block::LEAVES2 => true
];
/** @var int */
public $type = 0;
/** @var int */
public $trunkBlock = Block::LOG;
/** @var int */
public $leafBlock = Block::LEAVES;
/** @var int */
public $treeHeight = 7;
public static function growTree(ChunkManager $level, int $x, int $y, int $z, Random $random, int $type = 0){

View File

@ -30,8 +30,11 @@ use pocketmine\math\Vector3;
use pocketmine\utils\Random;
class Pond extends Populator{
/** @var int */
private $waterOdd = 4;
/** @var int */
private $lavaOdd = 4;
/** @var int */
private $lavaSurfaceOdd = 4;
public function populate(ChunkManager $level, int $chunkX, int $chunkZ, Random $random){

View File

@ -30,7 +30,9 @@ use pocketmine\utils\Random;
class TallGrass extends Populator{
/** @var ChunkManager */
private $level;
/** @var int */
private $randomAmount = 1;
/** @var int */
private $baseAmount = 0;
public function setRandomAmount($amount){

View File

@ -32,9 +32,12 @@ use pocketmine\utils\Random;
class Tree extends Populator{
/** @var ChunkManager */
private $level;
/** @var int */
private $randomAmount = 1;
/** @var int */
private $baseAmount = 0;
/** @var int */
private $type;
public function __construct($type = Sapling::OAK){

View File

@ -31,7 +31,9 @@ use pocketmine\Server;
class LightPopulationTask extends AsyncTask{
/** @var int */
public $levelId;
/** @var string */
public $chunk;
public function __construct(Level $level, Chunk $chunk){

View File

@ -39,9 +39,13 @@ use function str_repeat;
class FloatingTextParticle extends Particle{
//TODO: HACK!
/** @var string */
protected $text;
/** @var string */
protected $title;
protected $entityId;
/** @var int|null */
protected $entityId = null;
/** @var bool */
protected $invisible = false;
/**

View File

@ -30,7 +30,9 @@ use pocketmine\Server;
class CompressBatchedTask extends AsyncTask{
/** @var int */
public $level = 7;
/** @var string */
public $data;
/**

View File

@ -34,6 +34,7 @@ use function spl_object_hash;
class Network{
/** @var int */
public static $BATCH_THRESHOLD = 512;
/** @var Server */
@ -45,7 +46,9 @@ class Network{
/** @var AdvancedSourceInterface[] */
private $advancedInterfaces = [];
/** @var float */
private $upload = 0;
/** @var float */
private $download = 0;
/** @var string */

View File

@ -61,12 +61,18 @@ class AddPlayerPacket extends DataPacket{
public $metadata = [];
//TODO: adventure settings stuff
/** @var int */
public $uvarint1 = 0;
/** @var int */
public $uvarint2 = 0;
/** @var int */
public $uvarint3 = 0;
/** @var int */
public $uvarint4 = 0;
/** @var int */
public $uvarint5 = 0;
/** @var int */
public $long1 = 0;
/** @var EntityLink[] */

View File

@ -62,6 +62,7 @@ class CraftingDataPacket extends DataPacket{
/** @var bool */
public $cleanRecipes = false;
/** @var mixed[][] */
public $decodedEntries = [];
public function clean(){

View File

@ -40,6 +40,7 @@ class Permission{
public const DEFAULT_TRUE = "true";
public const DEFAULT_FALSE = "false";
/** @var string */
public static $DEFAULT_PERMISSION = self::DEFAULT_OP;
/**

View File

@ -28,6 +28,7 @@ use pocketmine\event\Listener;
class MethodEventExecutor implements EventExecutor{
/** @var string */
private $method;
public function __construct($method){

View File

@ -41,20 +41,28 @@ use function version_compare;
use function yaml_parse;
class PluginDescription{
/** @var mixed[] */
private $map;
/** @var string */
private $name;
/** @var string */
private $main;
/** @var string[] */
private $api;
/** @var int[] */
private $compatibleMcpeProtocols = [];
/** @var string[][] */
private $extensions = [];
/** @var string[] */
private $depend = [];
/** @var string[] */
private $softDepend = [];
/** @var string[] */
private $loadBefore = [];
/** @var string */
private $version;
/** @var mixed[][] */
private $commands = [];
/** @var string */
private $description = "";
@ -64,6 +72,7 @@ class PluginDescription{
private $website = "";
/** @var string */
private $prefix = "";
/** @var int */
private $order = PluginLoadOrder::POSTWORLD;
/**

View File

@ -29,6 +29,7 @@ use function spl_object_hash;
class PluginLogger implements \AttachableLogger{
/** @var string */
private $pluginName;
/** @var \LoggerAttachment[] */

View File

@ -24,8 +24,11 @@ declare(strict_types=1);
namespace pocketmine\resourcepacks;
class ResourcePackInfoEntry{
/** @var string */
protected $packId; //UUID
/** @var string */
protected $version;
/** @var int */
protected $packSize;
public function __construct(string $packId, string $version, int $packSize = 0){

View File

@ -59,12 +59,16 @@ abstract class AsyncTask extends Collectable{
/** @var \Threaded */
public $progressUpdates;
/** @var scalar|null */
private $result = null;
/** @var bool */
private $serialized = false;
/** @var bool */
private $cancelRun = false;
/** @var int|null */
private $taskId = null;
/** @var bool */
private $crashed = false;
public function run(){

View File

@ -35,7 +35,9 @@ class AsyncWorker extends Worker{
/** @var mixed[] */
private static $store = [];
/** @var \ThreadedLogger */
private $logger;
/** @var int */
private $id;
/** @var int */

View File

@ -34,6 +34,7 @@ use function unserialize;
* The result of this AsyncTask is an array of arrays (returned from {@link Internet::simpleCurl}) or InternetException objects.
*/
class BulkCurlTask extends AsyncTask{
/** @var string */
private $operations;
/**

View File

@ -44,7 +44,9 @@ class SendUsageTask extends AsyncTask{
public const TYPE_STATUS = 2;
public const TYPE_CLOSE = 3;
/** @var string */
public $endpoint;
/** @var string */
public $data;
/**

View File

@ -71,6 +71,7 @@ class Config{
/** @var array */
private $config = [];
/** @var mixed[] */
private $nestedCache = [];
/** @var string */
@ -85,6 +86,7 @@ class Config{
/** @var bool */
private $changed = false;
/** @var int[] */
public static $formats = [
"properties" => Config::PROPERTIES,
"cnf" => Config::CNF,

View File

@ -62,7 +62,9 @@ use const SOCK_DGRAM;
use const SOL_UDP;
class Internet{
/** @var string|false */
public static $ip = false;
/** @var bool */
public static $online = true;
/**

View File

@ -29,6 +29,7 @@ use function time;
class ServerKiller extends Thread{
/** @var int */
public $time;
/** @var bool */

View File

@ -31,29 +31,51 @@ use function is_array;
use function stream_isatty;
abstract class Terminal{
/** @var string */
public static $FORMAT_BOLD = "";
/** @var string */
public static $FORMAT_OBFUSCATED = "";
/** @var string */
public static $FORMAT_ITALIC = "";
/** @var string */
public static $FORMAT_UNDERLINE = "";
/** @var string */
public static $FORMAT_STRIKETHROUGH = "";
/** @var string */
public static $FORMAT_RESET = "";
/** @var string */
public static $COLOR_BLACK = "";
/** @var string */
public static $COLOR_DARK_BLUE = "";
/** @var string */
public static $COLOR_DARK_GREEN = "";
/** @var string */
public static $COLOR_DARK_AQUA = "";
/** @var string */
public static $COLOR_DARK_RED = "";
/** @var string */
public static $COLOR_PURPLE = "";
/** @var string */
public static $COLOR_GOLD = "";
/** @var string */
public static $COLOR_GRAY = "";
/** @var string */
public static $COLOR_DARK_GRAY = "";
/** @var string */
public static $COLOR_BLUE = "";
/** @var string */
public static $COLOR_GREEN = "";
/** @var string */
public static $COLOR_AQUA = "";
/** @var string */
public static $COLOR_RED = "";
/** @var string */
public static $COLOR_LIGHT_PURPLE = "";
/** @var string */
public static $COLOR_YELLOW = "";
/** @var string */
public static $COLOR_WHITE = "";
/** @var bool|null */

View File

@ -100,6 +100,7 @@ use const STR_PAD_RIGHT;
* Big collection of functions
*/
class Utils{
/** @var string|null */
public static $os;
/** @var UUID|null */
private static $serverUniqueId = null;