diff --git a/build/server-phar.php b/build/server-phar.php index 4bedf6b23..9581a7568 100644 --- a/build/server-phar.php +++ b/build/server-phar.php @@ -45,6 +45,7 @@ function preg_quote_array(array $strings, string $delim = null) : array{ * @param string $stub * @param int $signatureAlgo * @param int|null $compression + * @phpstan-param array $metadata * * @return \Generator|string[] */ diff --git a/src/CrashDump.php b/src/CrashDump.php index 28f57c7f2..05a9304b5 100644 --- a/src/CrashDump.php +++ b/src/CrashDump.php @@ -86,7 +86,10 @@ class CrashDump{ private $fp; /** @var int */ private $time; - /** @var mixed[] */ + /** + * @var mixed[] + * @phpstan-var array + */ private $data = []; /** @var string */ private $encodedData = ""; @@ -129,6 +132,7 @@ class CrashDump{ /** * @return mixed[] + * @phpstan-return array */ public function getData() : array{ return $this->data; diff --git a/src/Server.php b/src/Server.php index 96085f3c7..f7a6c40ca 100644 --- a/src/Server.php +++ b/src/Server.php @@ -267,7 +267,10 @@ class Server{ /** @var string */ private $pluginPath; - /** @var string[] */ + /** + * @var string[] + * @phpstan-var array + */ private $uniquePlayers = []; /** @var QueryRegenerateEvent */ @@ -1417,6 +1420,7 @@ class Server{ /** * @param mixed[][]|null $trace + * @phpstan-param list>|null $trace */ public function exceptionHandler(\Throwable $e, $trace = null) : void{ while(@ob_end_flush()){} diff --git a/src/block/BaseRail.php b/src/block/BaseRail.php index 487a59cbd..ffc1cb8df 100644 --- a/src/block/BaseRail.php +++ b/src/block/BaseRail.php @@ -112,6 +112,7 @@ abstract class BaseRail extends Flowable{ /** * @param int[] $connections * @param int[][] $lookup + * @phpstan-param array> $lookup */ protected static function searchState(array $connections, array $lookup) : int{ $meta = array_search($connections, $lookup, true); @@ -180,6 +181,7 @@ abstract class BaseRail extends Flowable{ * @param int[] $constraints * * @return true[] + * @phpstan-return array */ private function getPossibleConnectionDirections(array $constraints) : array{ switch(count($constraints)){ @@ -207,6 +209,7 @@ abstract class BaseRail extends Flowable{ /** * @return true[] + * @phpstan-return array */ protected function getPossibleConnectionDirectionsOneConstraint(int $constraint) : array{ $opposite = Facing::opposite($constraint & ~self::FLAG_ASCEND); diff --git a/src/block/Leaves.php b/src/block/Leaves.php index 638a78ebc..e24cc2393 100644 --- a/src/block/Leaves.php +++ b/src/block/Leaves.php @@ -69,6 +69,7 @@ class Leaves extends Transparent{ /** * @param true[] $visited reference parameter + * @phpstan-param array $visited */ protected function findLog(Vector3 $pos, array &$visited = [], int $distance = 0) : bool{ $index = World::blockHash($pos->x, $pos->y, $pos->z); diff --git a/src/command/defaults/TimingsCommand.php b/src/command/defaults/TimingsCommand.php index bd497ddba..e42b44b04 100644 --- a/src/command/defaults/TimingsCommand.php +++ b/src/command/defaults/TimingsCommand.php @@ -129,6 +129,7 @@ class TimingsCommand extends VanillaCommand{ /** * @param string[] $data + * @phpstan-param array $data */ public function __construct(CommandSender $sender, string $host, string $agent, array $data){ parent::__construct([ diff --git a/src/entity/Entity.php b/src/entity/Entity.php index f3c8a7b0b..910dd5875 100644 --- a/src/entity/Entity.php +++ b/src/entity/Entity.php @@ -1636,6 +1636,7 @@ abstract class Entity{ /** * @param Player[]|Player $player * @param MetadataProperty[] $data Properly formatted entity data, defaults to everything + * @phpstan-param array $data */ public function sendData($player, ?array $data = null) : void{ if(!is_array($player)){ diff --git a/src/entity/EntityFactory.php b/src/entity/EntityFactory.php index a74d615d9..35c4798b7 100644 --- a/src/entity/EntityFactory.php +++ b/src/entity/EntityFactory.php @@ -65,9 +65,15 @@ final class EntityFactory{ private static $entityCount = 1; /** @var string[] base class => currently used class for construction */ private static $classMapping = []; - /** @var string[] */ + /** + * @var string[] + * @phpstan-var array> + */ private static $knownEntities = []; - /** @var string[][] */ + /** + * @var string[][] + * @phpstan-var array, list> + */ private static $saveNames = []; private function __construct(){ diff --git a/src/entity/Living.php b/src/entity/Living.php index c8f0f72fb..d1af67c6e 100644 --- a/src/entity/Living.php +++ b/src/entity/Living.php @@ -632,6 +632,7 @@ abstract class Living extends Entity{ /** * @param true[] $transparent + * @phpstan-param array $transparent * * @return Block[] */ @@ -674,6 +675,7 @@ abstract class Living extends Entity{ /** * @param true[] $transparent + * @phpstan-param array $transparent */ public function getTargetBlock(int $maxDistance, array $transparent = []) : ?Block{ $line = $this->getLineOfSight($maxDistance, 1, $transparent); diff --git a/src/event/server/QueryRegenerateEvent.php b/src/event/server/QueryRegenerateEvent.php index 8ead91669..3b6a19c2a 100644 --- a/src/event/server/QueryRegenerateEvent.php +++ b/src/event/server/QueryRegenerateEvent.php @@ -63,7 +63,10 @@ class QueryRegenerateEvent extends ServerEvent{ /** @var string */ private $ip; - /** @var string[] */ + /** + * @var string[] + * @phpstan-var array + */ private $extraData = []; /** @var string|null */ @@ -174,6 +177,7 @@ class QueryRegenerateEvent extends ServerEvent{ * Returns the extra Query data in key => value form * * @return string[] + * @phpstan-return array */ public function getExtraData() : array{ return $this->extraData; @@ -181,6 +185,7 @@ class QueryRegenerateEvent extends ServerEvent{ /** * @param string[] $extraData + * @phpstan-param array $extraData */ public function setExtraData(array $extraData) : void{ $this->extraData = $extraData; diff --git a/src/item/Item.php b/src/item/Item.php index e9384f373..e4d678b38 100644 --- a/src/item/Item.php +++ b/src/item/Item.php @@ -575,6 +575,7 @@ class Item implements \JsonSerializable{ * Returns an array of item stack properties that can be serialized to json. * * @return mixed[] + * @phpstan-return array{id: int, damage?: int, count?: int, nbt_b64?: string} */ final public function jsonSerialize() : array{ $data = [ @@ -599,6 +600,14 @@ class Item implements \JsonSerializable{ /** * Returns an Item from properties created in an array by {@link Item#jsonSerialize} * @param mixed[] $data + * @phpstan-param array{ + * id: int, + * damage?: int, + * count?: int, + * nbt?: string, + * nbt_hex?: string, + * nbt_b64?: string + * } $data * * @throws NbtDataException * @throws \InvalidArgumentException diff --git a/src/lang/Language.php b/src/lang/Language.php index 2acce0c35..4e2ebabe7 100644 --- a/src/lang/Language.php +++ b/src/lang/Language.php @@ -45,6 +45,7 @@ class Language{ /** * @return string[] + * @phpstan-return array * * @throws LanguageNotFoundException */ diff --git a/src/network/mcpe/protocol/AddActorPacket.php b/src/network/mcpe/protocol/AddActorPacket.php index ecc4f09c0..30f827f73 100644 --- a/src/network/mcpe/protocol/AddActorPacket.php +++ b/src/network/mcpe/protocol/AddActorPacket.php @@ -165,7 +165,10 @@ class AddActorPacket extends DataPacket implements ClientboundPacket{ /** @var Attribute[] */ public $attributes = []; - /** @var MetadataProperty[] */ + /** + * @var MetadataProperty[] + * @phpstan-var array + */ public $metadata = []; /** @var EntityLink[] */ public $links = []; diff --git a/src/network/mcpe/protocol/AddItemActorPacket.php b/src/network/mcpe/protocol/AddItemActorPacket.php index ded9268cb..0a4efa9ab 100644 --- a/src/network/mcpe/protocol/AddItemActorPacket.php +++ b/src/network/mcpe/protocol/AddItemActorPacket.php @@ -43,7 +43,10 @@ class AddItemActorPacket extends DataPacket implements ClientboundPacket{ public $position; /** @var Vector3|null */ public $motion; - /** @var MetadataProperty[] */ + /** + * @var MetadataProperty[] + * @phpstan-var array + */ public $metadata = []; /** @var bool */ public $isFromFishing = false; diff --git a/src/network/mcpe/protocol/AddPlayerPacket.php b/src/network/mcpe/protocol/AddPlayerPacket.php index df80e2422..b0d281834 100644 --- a/src/network/mcpe/protocol/AddPlayerPacket.php +++ b/src/network/mcpe/protocol/AddPlayerPacket.php @@ -58,7 +58,10 @@ class AddPlayerPacket extends DataPacket implements ClientboundPacket{ public $headYaw = null; //TODO /** @var Item */ public $item; - /** @var MetadataProperty[] */ + /** + * @var MetadataProperty[] + * @phpstan-var array + */ public $metadata = []; //TODO: adventure settings stuff diff --git a/src/network/mcpe/protocol/AvailableCommandsPacket.php b/src/network/mcpe/protocol/AvailableCommandsPacket.php index fcc53843f..f652b2303 100644 --- a/src/network/mcpe/protocol/AvailableCommandsPacket.php +++ b/src/network/mcpe/protocol/AvailableCommandsPacket.php @@ -371,6 +371,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{ /** * @param string[] $postfixes + * @phpstan-param array $postfixes */ private function argTypeToString(int $argtype, array $postfixes) : string{ if($argtype & self::ARG_FLAG_VALID){ diff --git a/src/network/mcpe/protocol/GameRulesChangedPacket.php b/src/network/mcpe/protocol/GameRulesChangedPacket.php index 198634fe4..76895424d 100644 --- a/src/network/mcpe/protocol/GameRulesChangedPacket.php +++ b/src/network/mcpe/protocol/GameRulesChangedPacket.php @@ -30,7 +30,10 @@ use pocketmine\network\mcpe\handler\PacketHandler; class GameRulesChangedPacket extends DataPacket implements ClientboundPacket{ public const NETWORK_ID = ProtocolInfo::GAME_RULES_CHANGED_PACKET; - /** @var mixed[][] */ + /** + * @var mixed[][] + * @phpstan-var array + */ public $gameRules = []; protected function decodePayload() : void{ diff --git a/src/network/mcpe/protocol/LoginPacket.php b/src/network/mcpe/protocol/LoginPacket.php index 51c37bc3f..8eca676e8 100644 --- a/src/network/mcpe/protocol/LoginPacket.php +++ b/src/network/mcpe/protocol/LoginPacket.php @@ -87,7 +87,10 @@ class LoginPacket extends DataPacket implements ServerboundPacket{ public $extraData = null; /** @var string */ public $clientDataJwt; - /** @var mixed[] decoded payload of the clientData JWT */ + /** + * @var mixed[] decoded payload of the clientData JWT + * @phpstan-var array + */ public $clientData = []; /** diff --git a/src/network/mcpe/protocol/SetActorDataPacket.php b/src/network/mcpe/protocol/SetActorDataPacket.php index b25bb91d5..c030b2154 100644 --- a/src/network/mcpe/protocol/SetActorDataPacket.php +++ b/src/network/mcpe/protocol/SetActorDataPacket.php @@ -33,7 +33,10 @@ class SetActorDataPacket extends DataPacket implements ClientboundPacket, Server /** @var int */ public $entityRuntimeId; - /** @var MetadataProperty[] */ + /** + * @var MetadataProperty[] + * @phpstan-var array + */ public $metadata; public static function create(int $entityRuntimeId, array $metadata) : self{ diff --git a/src/network/mcpe/protocol/StartGamePacket.php b/src/network/mcpe/protocol/StartGamePacket.php index 2b5f36926..90c4fed2c 100644 --- a/src/network/mcpe/protocol/StartGamePacket.php +++ b/src/network/mcpe/protocol/StartGamePacket.php @@ -103,7 +103,10 @@ class StartGamePacket extends DataPacket implements ClientboundPacket{ public $commandsEnabled; /** @var bool */ public $isTexturePacksRequired = true; - /** @var mixed[][] */ + /** + * @var mixed[][] + * @phpstan-var array + */ public $gameRules = [ //TODO: implement this "naturalregeneration" => [1, false] //Hack for client side regeneration ]; @@ -153,7 +156,10 @@ class StartGamePacket extends DataPacket implements ClientboundPacket{ /** @var ListTag|null */ public $blockTable = null; - /** @var int[]|null string (name) => int16 (legacyID) */ + /** + * @var int[]|null string (name) => int16 (legacyID) + * @phpstan-var array|null + */ public $itemTable = null; protected function decodePayload() : void{ @@ -302,6 +308,7 @@ class StartGamePacket extends DataPacket implements ClientboundPacket{ /** * @param int[] $table + * @phpstan-param array $table */ private static function serializeItemTable(array $table) : string{ $stream = new NetworkBinaryStream(); diff --git a/src/network/mcpe/protocol/types/entity/EntityMetadataCollection.php b/src/network/mcpe/protocol/types/entity/EntityMetadataCollection.php index c096143a9..5d66c4163 100644 --- a/src/network/mcpe/protocol/types/entity/EntityMetadataCollection.php +++ b/src/network/mcpe/protocol/types/entity/EntityMetadataCollection.php @@ -29,9 +29,15 @@ use function get_class; class EntityMetadataCollection{ - /** @var MetadataProperty[] */ + /** + * @var MetadataProperty[] + * @phpstan-var array + */ private $properties = []; - /** @var MetadataProperty[] */ + /** + * @var MetadataProperty[] + * @phpstan-var array + */ private $dirtyProperties = []; public function __construct(){ @@ -121,6 +127,7 @@ class EntityMetadataCollection{ * Returns all properties. * * @return MetadataProperty[] + * @phpstan-return array */ public function getAll() : array{ return $this->properties; @@ -130,6 +137,7 @@ class EntityMetadataCollection{ * Returns properties that have changed and need to be broadcasted. * * @return MetadataProperty[] + * @phpstan-return array */ public function getDirty() : array{ return $this->dirtyProperties; diff --git a/src/network/mcpe/serializer/NetworkBinaryStream.php b/src/network/mcpe/serializer/NetworkBinaryStream.php index 1b3c591d8..35cf694a5 100644 --- a/src/network/mcpe/serializer/NetworkBinaryStream.php +++ b/src/network/mcpe/serializer/NetworkBinaryStream.php @@ -297,6 +297,7 @@ class NetworkBinaryStream extends BinaryStream{ * Decodes entity metadata from the stream. * * @return MetadataProperty[] + * @phpstan-return array * * @throws BadPacketException * @throws BinaryDataException @@ -334,6 +335,7 @@ class NetworkBinaryStream extends BinaryStream{ * Writes entity metadata to the packet buffer. * * @param MetadataProperty[] $metadata + * @phpstan-param array $metadata */ public function putEntityMetadata(array $metadata) : void{ $this->putUnsignedVarInt(count($metadata)); @@ -530,6 +532,7 @@ class NetworkBinaryStream extends BinaryStream{ * TODO: implement this properly * * @return mixed[][], members are in the structure [name => [type, value]] + * @phpstan-return array * * @throws BadPacketException * @throws BinaryDataException @@ -566,6 +569,7 @@ class NetworkBinaryStream extends BinaryStream{ * TODO: implement this properly * * @param mixed[][] $rules + * @phpstan-param array $rules */ public function putGameRules(array $rules) : void{ $this->putUnsignedVarInt(count($rules)); diff --git a/src/permission/Permission.php b/src/permission/Permission.php index f617e3e5d..9361dea24 100644 --- a/src/permission/Permission.php +++ b/src/permission/Permission.php @@ -45,7 +45,10 @@ class Permission{ /** @var string */ private $description; - /** @var bool[] */ + /** + * @var bool[] + * @phpstan-var array + */ private $children; /** @var string */ @@ -55,6 +58,7 @@ class Permission{ * Creates a new Permission object to be attached to Permissible objects * * @param bool[] $children + * @phpstan-param array $children */ public function __construct(string $name, ?string $description = null, ?string $defaultValue = null, array $children = []){ $this->name = $name; @@ -71,6 +75,7 @@ class Permission{ /** * @return bool[] + * @phpstan-return array */ public function &getChildren() : array{ return $this->children; diff --git a/src/permission/PermissionParser.php b/src/permission/PermissionParser.php index 3cd1cbf38..c0abfb1c9 100644 --- a/src/permission/PermissionParser.php +++ b/src/permission/PermissionParser.php @@ -71,6 +71,7 @@ class PermissionParser{ /** * @param mixed[][] $data + * @phpstan-param array> $data * * @return Permission[] */ @@ -86,6 +87,7 @@ class PermissionParser{ /** * @param mixed[] $data * @param Permission[] $output reference parameter + * @phpstan-param array $data * * @throws \Exception */ diff --git a/src/plugin/PluginDescription.php b/src/plugin/PluginDescription.php index 31dd2546d..2a9a53414 100644 --- a/src/plugin/PluginDescription.php +++ b/src/plugin/PluginDescription.php @@ -39,7 +39,10 @@ use function version_compare; use function yaml_parse; class PluginDescription{ - /** @var mixed[] */ + /** + * @var mixed[] + * @phpstan-var array + */ private $map; /** @var string */ @@ -50,7 +53,10 @@ class PluginDescription{ private $api; /** @var int[] */ private $compatibleMcpeProtocols = []; - /** @var string[][] */ + /** + * @var string[][] + * @phpstan-var array> + */ private $extensions = []; /** @var string[] */ private $depend = []; @@ -60,7 +66,10 @@ class PluginDescription{ private $loadBefore = []; /** @var string */ private $version; - /** @var mixed[][] */ + /** + * @var mixed[][] + * @phpstan-var array> + */ private $commands = []; /** @var string */ private $description = ""; @@ -78,6 +87,7 @@ class PluginDescription{ /** * @param string|mixed[] $yamlString + * @phpstan-param string|array $yamlString */ public function __construct($yamlString){ $this->loadMap(!is_array($yamlString) ? yaml_parse($yamlString) : $yamlString); @@ -85,6 +95,7 @@ class PluginDescription{ /** * @param mixed[] $plugin + * @phpstan-param array $plugin * @throws PluginException */ private function loadMap(array $plugin) : void{ @@ -189,6 +200,7 @@ class PluginDescription{ /** * @return mixed[][] + * @phpstan-return array> */ public function getCommands() : array{ return $this->commands; @@ -196,6 +208,7 @@ class PluginDescription{ /** * @return string[][] + * @phpstan-return array> */ public function getRequiredExtensions() : array{ return $this->extensions; @@ -289,6 +302,7 @@ class PluginDescription{ /** * @return mixed[] + * @phpstan-return array */ public function getMap() : array{ return $this->map; diff --git a/src/scheduler/BulkCurlTask.php b/src/scheduler/BulkCurlTask.php index eaa95ee64..5dd534ebd 100644 --- a/src/scheduler/BulkCurlTask.php +++ b/src/scheduler/BulkCurlTask.php @@ -45,12 +45,14 @@ class BulkCurlTask extends AsyncTask{ * {@link Utils::simpleCurl}. * * @param mixed[][] $operations + * @phpstan-param list, extraOpts?: array}> $operations */ public function __construct(array $operations){ $this->operations = serialize($operations); } public function onRun() : void{ + /** @phpstan-var list, extraOpts?: array}> $operations */ $operations = unserialize($this->operations); $results = []; foreach($operations as $op){ diff --git a/src/scheduler/SendUsageTask.php b/src/scheduler/SendUsageTask.php index 0584b1c6e..d943efb6c 100644 --- a/src/scheduler/SendUsageTask.php +++ b/src/scheduler/SendUsageTask.php @@ -54,6 +54,7 @@ class SendUsageTask extends AsyncTask{ /** * @param string[] $playerList + * @phpstan-param array $playerList */ public function __construct(Server $server, int $type, array $playerList = []){ $endpoint = "http://" . $server->getProperty("anonymous-statistics.host", "stats.pocketmine.net") . "/"; diff --git a/src/updater/AutoUpdater.php b/src/updater/AutoUpdater.php index 39b3ff1f9..95803c243 100644 --- a/src/updater/AutoUpdater.php +++ b/src/updater/AutoUpdater.php @@ -41,7 +41,10 @@ class AutoUpdater{ protected $server; /** @var string */ protected $endpoint; - /** @var mixed[]|null */ + /** + * @var mixed[]|null + * @phpstan-var array|null + */ protected $updateInfo = null; /** @var VersionString|null */ protected $newVersion; @@ -67,6 +70,7 @@ class AutoUpdater{ * Callback used at the end of the update checking task * * @param mixed[] $updateInfo + * @phpstan-param array $updateInfo */ public function checkUpdateCallback(array $updateInfo) : void{ $this->updateInfo = $updateInfo; @@ -145,6 +149,7 @@ class AutoUpdater{ * Returns the last retrieved update data. * * @return mixed[]|null + * @phpstan-return array|null */ public function getUpdateInfo() : ?array{ return $this->updateInfo; diff --git a/src/utils/Config.php b/src/utils/Config.php index dd9298b8d..95d38c270 100644 --- a/src/utils/Config.php +++ b/src/utils/Config.php @@ -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 + */ private $config = []; - /** @var mixed[] */ + /** + * @var mixed[] + * @phpstan-var array + */ 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 $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 $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 $v */ public function setAll(array $v) : void{ $this->config = $v; @@ -458,6 +467,7 @@ class Config{ /** * @return mixed[] + * @phpstan-return list|array */ 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 $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 $default + * @phpstan-param array $data */ private function fillDefaults(array $default, &$data) : int{ $changed = 0; diff --git a/src/utils/MainLogger.php b/src/utils/MainLogger.php index d61465607..353bd7acb 100644 --- a/src/utils/MainLogger.php +++ b/src/utils/MainLogger.php @@ -140,6 +140,7 @@ class MainLogger extends \AttachableThreadedLogger{ /** * @param mixed[][]|null $trace + * @phpstan-param list>|null $trace * * @return void */ diff --git a/src/utils/Utils.php b/src/utils/Utils.php index 64d270467..2a0a83a05 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -354,6 +354,7 @@ class Utils{ /** * @return mixed[] array of claims + * @phpstan-return array * * @throws \UnexpectedValueException */ @@ -392,6 +393,7 @@ class Utils{ /** * @param mixed[][] $trace + * @phpstan-param list> $trace * * @return string[] */ @@ -426,6 +428,7 @@ class Utils{ /** * @return mixed[][] + * @phpstan-return list> */ public static function currentTrace(int $skipFrames = 0) : array{ ++$skipFrames; //omit this frame from trace, in addition to other skipped frames diff --git a/src/world/format/io/WorldProviderManager.php b/src/world/format/io/WorldProviderManager.php index 1c8d0cea8..f2346847a 100644 --- a/src/world/format/io/WorldProviderManager.php +++ b/src/world/format/io/WorldProviderManager.php @@ -32,7 +32,10 @@ use function strtolower; use function trim; abstract class WorldProviderManager{ - /** @var string[] */ + /** + * @var string[] + * @phpstan-var array> + */ protected static $providers = []; /** @var string|WorldProvider */ diff --git a/src/world/format/io/WritableWorldProvider.php b/src/world/format/io/WritableWorldProvider.php index 95a11f704..cd6573ba9 100644 --- a/src/world/format/io/WritableWorldProvider.php +++ b/src/world/format/io/WritableWorldProvider.php @@ -30,6 +30,7 @@ interface WritableWorldProvider extends WorldProvider{ * Generate the needed files in the path given * * @param mixed[] $options + * @phpstan-param array $options */ public static function generate(string $path, string $name, int $seed, string $generator, array $options = []) : void; diff --git a/src/world/generator/Flat.php b/src/world/generator/Flat.php index 01d6d6e58..e3c31a42c 100644 --- a/src/world/generator/Flat.php +++ b/src/world/generator/Flat.php @@ -41,7 +41,10 @@ class Flat extends Generator{ private $chunk; /** @var Populator[] */ private $populators = []; - /** @var int[] */ + /** + * @var int[] + * @phpstan-var array + */ private $structure; /** @var int */ private $floorLevel; @@ -52,6 +55,7 @@ class Flat extends Generator{ /** * @param mixed[] $options + * @phpstan-param array $options * * @throws InvalidGeneratorOptionsException */ @@ -87,6 +91,8 @@ class Flat extends Generator{ /** * @return int[] + * @phpstan-return array + * * @throws InvalidGeneratorOptionsException */ public static function parseLayers(string $layers) : array{ diff --git a/src/world/generator/Generator.php b/src/world/generator/Generator.php index 23906d24b..f57e431eb 100644 --- a/src/world/generator/Generator.php +++ b/src/world/generator/Generator.php @@ -62,6 +62,7 @@ abstract class Generator{ * @throws InvalidGeneratorOptionsException * * @param mixed[] $options + * @phpstan-param array $options */ public function __construct(ChunkManager $world, int $seed, array $options = []){ $this->world = $world; diff --git a/src/world/generator/GeneratorManager.php b/src/world/generator/GeneratorManager.php index 45d8f2083..315595d39 100644 --- a/src/world/generator/GeneratorManager.php +++ b/src/world/generator/GeneratorManager.php @@ -30,7 +30,10 @@ use function array_keys; use function strtolower; final class GeneratorManager{ - /** @var string[] name => classname mapping */ + /** + * @var string[] name => classname mapping + * @phpstan-var array> + */ private static $list = []; /** diff --git a/src/world/generator/GeneratorRegisterTask.php b/src/world/generator/GeneratorRegisterTask.php index d6d7f7e5b..5b31a31f8 100644 --- a/src/world/generator/GeneratorRegisterTask.php +++ b/src/world/generator/GeneratorRegisterTask.php @@ -45,6 +45,7 @@ class GeneratorRegisterTask extends AsyncTask{ /** * @param mixed[] $generatorSettings + * @phpstan-param array $generatorSettings */ public function __construct(World $world, string $generatorClass, array $generatorSettings = []){ $this->generatorClass = $generatorClass; diff --git a/src/world/generator/hell/Nether.php b/src/world/generator/hell/Nether.php index 1b9c645ec..261483f39 100644 --- a/src/world/generator/hell/Nether.php +++ b/src/world/generator/hell/Nether.php @@ -52,6 +52,7 @@ class Nether extends Generator{ /** * @param mixed[] $options + * @phpstan-param array $options * * @throws InvalidGeneratorOptionsException */ diff --git a/src/world/generator/normal/Normal.php b/src/world/generator/normal/Normal.php index 9cfc25538..d7e6a9e14 100644 --- a/src/world/generator/normal/Normal.php +++ b/src/world/generator/normal/Normal.php @@ -59,6 +59,7 @@ class Normal extends Generator{ /** * @param mixed[] $options + * @phpstan-param array $options * * @throws InvalidGeneratorOptionsException */