Align PhpDoc @param tags according to PHP-CS-Fixer

This commit is contained in:
Dylan K. Taylor 2022-12-06 13:21:20 +00:00
parent 0a9b52618d
commit 99996b62d6
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
44 changed files with 87 additions and 86 deletions

View File

@ -45,7 +45,7 @@ use const PHP_EOL;
require dirname(__DIR__) . '/vendor/autoload.php'; require dirname(__DIR__) . '/vendor/autoload.php';
/** /**
* @param string[] $strings * @param string[] $strings
* *
* @return string[] * @return string[]
*/ */

View File

@ -286,7 +286,7 @@ class MemoryManager{
/** /**
* Static memory dumper accessible from any thread. * Static memory dumper accessible from any thread.
* *
* @param mixed $startingObject * @param mixed $startingObject
*/ */
public static function dumpMemory($startingObject, string $outputFolder, int $maxNesting, int $maxStringSize, \Logger $logger) : void{ public static function dumpMemory($startingObject, string $outputFolder, int $maxNesting, int $maxStringSize, \Logger $logger) : void{
$hardLimit = Utils::assumeNotFalse(ini_get('memory_limit'), "memory_limit INI directive should always exist"); $hardLimit = Utils::assumeNotFalse(ini_get('memory_limit'), "memory_limit INI directive should always exist");
@ -480,7 +480,7 @@ class MemoryManager{
/** /**
* @param mixed $from * @param mixed $from
* @param object[] $objects reference parameter * @param object[] $objects reference parameter
* @param int[] $refCounts reference parameter * @param int[] $refCounts reference parameter
* *
* @phpstan-param array<string, object> $objects * @phpstan-param array<string, object> $objects

View File

@ -1268,7 +1268,7 @@ class Server{
} }
/** /**
* @param CommandSender[]|null $recipients * @param CommandSender[]|null $recipients
*/ */
public function broadcastMessage(Translatable|string $message, ?array $recipients = null) : int{ public function broadcastMessage(Translatable|string $message, ?array $recipients = null) : int{
$recipients = $recipients ?? $this->getBroadcastChannelSubscribers(self::BROADCAST_CHANNEL_USERS); $recipients = $recipients ?? $this->getBroadcastChannelSubscribers(self::BROADCAST_CHANNEL_USERS);
@ -1321,9 +1321,9 @@ class Server{
} }
/** /**
* @param int $fadeIn Duration in ticks for fade-in. If -1 is given, client-sided defaults will be used. * @param int $fadeIn Duration in ticks for fade-in. If -1 is given, client-sided defaults will be used.
* @param int $stay Duration in ticks to stay on screen for * @param int $stay Duration in ticks to stay on screen for
* @param int $fadeOut Duration in ticks for fade-out. * @param int $fadeOut Duration in ticks for fade-out.
* @param Player[]|null $recipients * @param Player[]|null $recipients
*/ */
public function broadcastTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1, ?array $recipients = null) : int{ public function broadcastTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1, ?array $recipients = null) : int{

View File

@ -44,7 +44,7 @@ final class ServerConfigGroup{
){} ){}
/** /**
* @param mixed $defaultValue * @param mixed $defaultValue
* *
* @return mixed * @return mixed
*/ */

View File

@ -87,7 +87,7 @@ abstract class BaseBanner extends Transparent{
} }
/** /**
* @param BannerPatternLayer[] $patterns * @param BannerPatternLayer[] $patterns
* *
* @phpstan-param list<BannerPatternLayer> $patterns * @phpstan-param list<BannerPatternLayer> $patterns
* @return $this * @return $this

View File

@ -62,7 +62,7 @@ class Block{
protected ?array $collisionBoxes = null; protected ?array $collisionBoxes = null;
/** /**
* @param string $name English name of the block type (TODO: implement translations) * @param string $name English name of the block type (TODO: implement translations)
*/ */
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){ public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
if(($idInfo->getVariant() & $this->getStateBitmask()) !== 0){ if(($idInfo->getVariant() & $this->getStateBitmask()) !== 0){

View File

@ -968,7 +968,7 @@ class BlockFactory{
* NOTE: If you are registering a new block type, you will need to add it to the creative inventory yourself - it * NOTE: If you are registering a new block type, you will need to add it to the creative inventory yourself - it
* will not automatically appear there. * will not automatically appear there.
* *
* @param bool $override Whether to override existing registrations * @param bool $override Whether to override existing registrations
* *
* @throws \RuntimeException if something attempted to override an already-registered block without specifying the * @throws \RuntimeException if something attempted to override an already-registered block without specifying the
* $override parameter. * $override parameter.

View File

@ -135,7 +135,7 @@ class Banner extends Spawnable{
} }
/** /**
* @param BannerPatternLayer[] $patterns * @param BannerPatternLayer[] $patterns
* *
* @phpstan-param list<BannerPatternLayer> $patterns * @phpstan-param list<BannerPatternLayer> $patterns
*/ */

View File

@ -26,7 +26,7 @@ namespace pocketmine\command;
interface CommandExecutor{ interface CommandExecutor{
/** /**
* @param string[] $args * @param string[] $args
*/ */
public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool; public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool;

View File

@ -201,7 +201,7 @@ class CraftingManager{
} }
/** /**
* @param Item[] $outputs * @param Item[] $outputs
*/ */
public function matchRecipe(CraftingGrid $grid, array $outputs) : ?CraftingRecipe{ public function matchRecipe(CraftingGrid $grid, array $outputs) : ?CraftingRecipe{
//TODO: try to match special recipes before anything else (first they need to be implemented!) //TODO: try to match special recipes before anything else (first they need to be implemented!)

View File

@ -46,15 +46,15 @@ class ShapedRecipe implements CraftingRecipe{
/** /**
* Constructs a ShapedRecipe instance. * Constructs a ShapedRecipe instance.
* *
* @param string[] $shape <br> * @param string[] $shape <br>
* Array of 1, 2, or 3 strings representing the rows of the recipe. * Array of 1, 2, or 3 strings representing the rows of the recipe.
* This accepts an array of 1, 2 or 3 strings. Each string should be of the same length and must be at most 3 * This accepts an array of 1, 2 or 3 strings. Each string should be of the same length and must be at most 3
* characters long. Each character represents a unique type of ingredient. Spaces are interpreted as air. * characters long. Each character represents a unique type of ingredient. Spaces are interpreted as air.
* @param Item[] $ingredients <br> * @param Item[] $ingredients <br>
* Char => Item map of items to be set into the shape. * Char => Item map of items to be set into the shape.
* This accepts an array of Items, indexed by character. Every unique character (except space) in the shape * This accepts an array of Items, indexed by character. Every unique character (except space) in the shape
* array MUST have a corresponding item in this list. Space character is automatically treated as air. * array MUST have a corresponding item in this list. Space character is automatically treated as air.
* @param Item[] $results List of items that this recipe produces when crafted. * @param Item[] $results List of items that this recipe produces when crafted.
* *
* Note: Recipes **do not** need to be square. Do NOT add padding for empty rows/columns. * Note: Recipes **do not** need to be square. Do NOT add padding for empty rows/columns.
*/ */

View File

@ -36,7 +36,8 @@ class ShapelessRecipe implements CraftingRecipe{
/** /**
* @param Item[] $ingredients No more than 9 total. This applies to sum of item stack counts, not count of array. * @param Item[] $ingredients No more than 9 total. This applies to sum of item stack counts, not count of array.
* @param Item[] $results List of result items created by this recipe. * @param Item[] $results List of result items created by this recipe.
*
* TODO: we'll want to make the type parameter mandatory in PM5 * TODO: we'll want to make the type parameter mandatory in PM5
*/ */
public function __construct(array $ingredients, array $results, ?ShapelessRecipeType $type = null){ public function __construct(array $ingredients, array $results, ?ShapelessRecipeType $type = null){

View File

@ -1598,7 +1598,7 @@ abstract class Entity{
/** /**
* @param Player[]|null $targets * @param Player[]|null $targets
* @param MetadataProperty[] $data Properly formatted entity data, defaults to everything * @param MetadataProperty[] $data Properly formatted entity data, defaults to everything
* *
* @phpstan-param array<int, MetadataProperty> $data * @phpstan-param array<int, MetadataProperty> $data
*/ */

View File

@ -35,9 +35,9 @@ class Effect{
use NotSerializable; use NotSerializable;
/** /**
* @param Translatable|string $name Translation key used for effect name * @param Translatable|string $name Translation key used for effect name
* @param Color $color Color of bubbles given by this effect * @param Color $color Color of bubbles given by this effect
* @param bool $bad Whether the effect is harmful * @param bool $bad Whether the effect is harmful
* @param bool $hasBubbles Whether the effect has potion bubbles. Some do not (e.g. Instant Damage has its own particles instead of bubbles) * @param bool $hasBubbles Whether the effect has potion bubbles. Some do not (e.g. Instant Damage has its own particles instead of bubbles)
*/ */
public function __construct( public function __construct(

View File

@ -36,7 +36,7 @@ class EffectInstance{
private Color $color; private Color $color;
/** /**
* @param int|null $duration Passing null will use the effect type's default duration * @param int|null $duration Passing null will use the effect type's default duration
*/ */
public function __construct(Effect $effectType, ?int $duration = null, int $amplifier = 0, bool $visible = true, bool $ambient = false, ?Color $overrideColor = null){ public function __construct(Effect $effectType, ?int $duration = null, int $amplifier = 0, bool $visible = true, bool $ambient = false, ?Color $overrideColor = null){
$this->effectType = $effectType; $this->effectType = $effectType;

View File

@ -52,7 +52,7 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
/** /**
* @param Block[] $blocks * @param Block[] $blocks
* @param float $yield 0-100 * @param float $yield 0-100
*/ */
public function __construct(Entity $entity, Position $position, array $blocks, float $yield){ public function __construct(Entity $entity, Position $position, array $blocks, float $yield){
$this->entity = $entity; $this->entity = $entity;

View File

@ -35,8 +35,8 @@ class CraftItemEvent extends Event implements Cancellable{
use CancellableTrait; use CancellableTrait;
/** /**
* @param Item[] $inputs * @param Item[] $inputs
* @param Item[] $outputs * @param Item[] $outputs
*/ */
public function __construct( public function __construct(
private CraftingTransaction $transaction, private CraftingTransaction $transaction,

View File

@ -34,7 +34,7 @@ interface Form extends \JsonSerializable{
/** /**
* Handles a form response from a player. * Handles a form response from a player.
* *
* @param mixed $data * @param mixed $data
* *
* @throws FormValidationException if the data could not be processed * @throws FormValidationException if the data could not be processed
*/ */

View File

@ -75,7 +75,7 @@ class Banner extends ItemBlockWallOrFloor{
} }
/** /**
* @param BannerPatternLayer[] $patterns * @param BannerPatternLayer[] $patterns
* *
* @phpstan-param list<BannerPatternLayer> $patterns * @phpstan-param list<BannerPatternLayer> $patterns
* *

View File

@ -564,7 +564,7 @@ class Item implements \JsonSerializable{
/** /**
* Compares an Item to this Item and check if they match. * Compares an Item to this Item and check if they match.
* *
* @param bool $checkDamage Whether to verify that the damage values match. * @param bool $checkDamage Whether to verify that the damage values match.
* @param bool $checkCompound Whether to verify that the items' NBT match. * @param bool $checkCompound Whether to verify that the items' NBT match.
*/ */
final public function equals(Item $item, bool $checkDamage = true, bool $checkCompound = true) : bool{ final public function equals(Item $item, bool $checkDamage = true, bool $checkCompound = true) : bool{

View File

@ -35,7 +35,7 @@ interface AdvancedNetworkInterface extends NetworkInterface{
/** /**
* Prevents packets received from the IP address getting processed for the given timeout. * Prevents packets received from the IP address getting processed for the given timeout.
* *
* @param int $timeout Seconds * @param int $timeout Seconds
*/ */
public function blockAddress(string $address, int $timeout = 300) : void; public function blockAddress(string $address, int $timeout = 300) : void;

View File

@ -28,7 +28,7 @@ use pocketmine\network\mcpe\protocol\ClientboundPacket;
interface PacketBroadcaster{ interface PacketBroadcaster{
/** /**
* @param NetworkSession[] $recipients * @param NetworkSession[] $recipients
* @param ClientboundPacket[] $packets * @param ClientboundPacket[] $packets
*/ */
public function broadcastPackets(array $recipients, array $packets) : void; public function broadcastPackets(array $recipients, array $packets) : void;

View File

@ -118,7 +118,7 @@ final class ItemTranslator{
} }
/** /**
* @param int[] $simpleMappings * @param int[] $simpleMappings
* @param int[][] $complexMappings * @param int[][] $complexMappings
* @phpstan-param array<string, int> $simpleMappings * @phpstan-param array<string, int> $simpleMappings
* @phpstan-param array<string, array<int, int>> $complexMappings * @phpstan-param array<string, array<int, int>> $complexMappings

View File

@ -1390,7 +1390,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
/** /**
* Returns whether the player can interact with the specified position. This checks distance and direction. * Returns whether the player can interact with the specified position. This checks distance and direction.
* *
* @param float $maxDiff defaults to half of the 3D diagonal width of a block * @param float $maxDiff defaults to half of the 3D diagonal width of a block
*/ */
public function canInteract(Vector3 $pos, float $maxDistance, float $maxDiff = M_SQRT3 / 2) : bool{ public function canInteract(Vector3 $pos, float $maxDistance, float $maxDiff = M_SQRT3 / 2) : bool{
$eyePos = $this->getEyePos(); $eyePos = $this->getEyePos();
@ -1916,9 +1916,9 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
/** /**
* Adds a title text to the user's screen, with an optional subtitle. * Adds a title text to the user's screen, with an optional subtitle.
* *
* @param int $fadeIn Duration in ticks for fade-in. If -1 is given, client-sided defaults will be used. * @param int $fadeIn Duration in ticks for fade-in. If -1 is given, client-sided defaults will be used.
* @param int $stay Duration in ticks to stay on screen for * @param int $stay Duration in ticks to stay on screen for
* @param int $fadeOut Duration in ticks for fade-out. * @param int $fadeOut Duration in ticks for fade-out.
*/ */
public function sendTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1) : void{ public function sendTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1) : void{
$this->setTitleDuration($fadeIn, $stay, $fadeOut); $this->setTitleDuration($fadeIn, $stay, $fadeOut);
@ -1959,8 +1959,8 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
/** /**
* Sets the title duration. * Sets the title duration.
* *
* @param int $fadeIn Title fade-in time in ticks. * @param int $fadeIn Title fade-in time in ticks.
* @param int $stay Title stay time in ticks. * @param int $stay Title stay time in ticks.
* @param int $fadeOut Title fade-out time in ticks. * @param int $fadeOut Title fade-out time in ticks.
*/ */
public function setTitleDuration(int $fadeIn, int $stay, int $fadeOut) : void{ public function setTitleDuration(int $fadeIn, int $stay, int $fadeOut) : void{
@ -2061,7 +2061,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
* Transfers a player to another server. * Transfers a player to another server.
* *
* @param string $address The IP address or hostname of the destination server * @param string $address The IP address or hostname of the destination server
* @param int $port The destination port, defaults to 19132 * @param int $port The destination port, defaults to 19132
* @param string $message Message to show in the console when closing the player * @param string $message Message to show in the console when closing the player
* *
* @return bool if transfer was successful. * @return bool if transfer was successful.
@ -2105,7 +2105,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
* *
* Note for internals developers: Do not call this from network sessions. It will cause a feedback loop. * Note for internals developers: Do not call this from network sessions. It will cause a feedback loop.
* *
* @param string $reason Shown to the player, usually this will appear on their disconnect screen. * @param string $reason Shown to the player, usually this will appear on their disconnect screen.
* @param Translatable|string|null $quitMessage Message to broadcast to online players (null will use default) * @param Translatable|string|null $quitMessage Message to broadcast to online players (null will use default)
*/ */
public function disconnect(string $reason, Translatable|string|null $quitMessage = null) : void{ public function disconnect(string $reason, Translatable|string|null $quitMessage = null) : void{
@ -2121,7 +2121,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
* @internal * @internal
* This method executes post-disconnect actions and cleanups. * This method executes post-disconnect actions and cleanups.
* *
* @param string $reason Shown to the player, usually this will appear on their disconnect screen. * @param string $reason Shown to the player, usually this will appear on their disconnect screen.
* @param Translatable|string|null $quitMessage Message to broadcast to online players (null will use default) * @param Translatable|string|null $quitMessage Message to broadcast to online players (null will use default)
*/ */
public function onPostDisconnect(string $reason, Translatable|string|null $quitMessage) : void{ public function onPostDisconnect(string $reason, Translatable|string|null $quitMessage) : void{

View File

@ -201,7 +201,7 @@ abstract class PluginBase implements Plugin, CommandExecutor{
} }
/** /**
* @param string[] $args * @param string[] $args
*/ */
public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool{ public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool{
return false; return false;

View File

@ -57,7 +57,7 @@ interface ResourcePack{
* Note that resource packs must **always** be in zip archive format for sending. * Note that resource packs must **always** be in zip archive format for sending.
* A folder resource loader may need to perform on-the-fly compression for this purpose. * A folder resource loader may need to perform on-the-fly compression for this purpose.
* *
* @param int $start Offset to start reading the chunk from * @param int $start Offset to start reading the chunk from
* @param int $length Maximum length of data to return. * @param int $length Maximum length of data to return.
* *
* @return string byte-array * @return string byte-array

View File

@ -58,7 +58,7 @@ class ResourcePackManager{
private array $encryptionKeys = []; private array $encryptionKeys = [];
/** /**
* @param string $path Path to resource-packs directory. * @param string $path Path to resource-packs directory.
*/ */
public function __construct(string $path, \Logger $logger){ public function __construct(string $path, \Logger $logger){
$this->path = $path; $this->path = $path;

View File

@ -187,7 +187,7 @@ abstract class AsyncTask extends \Threaded{
* {@link AsyncTask::onCompletion} is called. * {@link AsyncTask::onCompletion} is called.
* *
* @param mixed $progress The parameter passed to {@link AsyncTask#publishProgress}. It is serialize()'ed * @param mixed $progress The parameter passed to {@link AsyncTask#publishProgress}. It is serialize()'ed
* and then unserialize()'ed, as if it has been cloned. * and then unserialize()'ed, as if it has been cloned.
*/ */
public function onProgressUpdate($progress) : void{ public function onProgressUpdate($progress) : void{
@ -215,7 +215,7 @@ abstract class AsyncTask extends \Threaded{
* Objects stored in this storage can be retrieved using fetchLocal() on the same thread that this method was called * Objects stored in this storage can be retrieved using fetchLocal() on the same thread that this method was called
* from. * from.
* *
* @param mixed $complexData the data to store * @param mixed $complexData the data to store
*/ */
protected function storeLocal(string $key, $complexData) : void{ protected function storeLocal(string $key, $complexData) : void{
if(self::$threadLocalStorage === null){ if(self::$threadLocalStorage === null){

View File

@ -77,7 +77,7 @@ class AsyncWorker extends Worker{
* Saves mixed data into the worker's thread-local object store. This can be used to store objects which you * Saves mixed data into the worker's thread-local object store. This can be used to store objects which you
* want to use on this worker thread from multiple AsyncTasks. * want to use on this worker thread from multiple AsyncTasks.
* *
* @param mixed $value * @param mixed $value
*/ */
public function saveToThreadStore(string $identifier, $value) : void{ public function saveToThreadStore(string $identifier, $value) : void{
if(\Thread::getCurrentThread() !== $this){ if(\Thread::getCurrentThread() !== $this){

View File

@ -26,7 +26,7 @@ namespace pocketmine\scheduler;
final class BulkCurlTaskOperation{ final class BulkCurlTaskOperation{
/** /**
* @param string[] $extraHeaders * @param string[] $extraHeaders
* @param mixed[] $extraOpts * @param mixed[] $extraOpts
* @phpstan-param list<string> $extraHeaders * @phpstan-param list<string> $extraHeaders
* @phpstan-param array<int, mixed> $extraOpts * @phpstan-param array<int, mixed> $extraOpts
*/ */

View File

@ -108,8 +108,8 @@ class Config{
]; ];
/** /**
* @param string $file Path of the file to be loaded * @param string $file Path of the file to be loaded
* @param int $type Config type to load, -1 by default (detect) * @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 * @param mixed[] $default Array with the default values that will be written to the file if it did not exist
* @phpstan-param array<string, mixed> $default * @phpstan-param array<string, mixed> $default
*/ */
@ -493,7 +493,7 @@ class Config{
/** /**
* @param mixed[] $default * @param mixed[] $default
* @param mixed[] $data reference parameter * @param mixed[] $data reference parameter
* @phpstan-param array<string, mixed> $default * @phpstan-param array<string, mixed> $default
* @phpstan-param array<string, mixed> $data * @phpstan-param array<string, mixed> $data
* @phpstan-param-out array<string, mixed> $data * @phpstan-param-out array<string, mixed> $data

View File

@ -36,7 +36,7 @@ final class Git{
/** /**
* Returns the git hash of the currently checked out head of the given repository, or null on failure. * Returns the git hash of the currently checked out head of the given repository, or null on failure.
* *
* @param bool $dirty reference parameter, set to whether the repo has local changes * @param bool $dirty reference parameter, set to whether the repo has local changes
*/ */
public static function getRepositoryState(string $dir, bool &$dirty) : ?string{ public static function getRepositoryState(string $dir, bool &$dirty) : ?string{
if(Process::execute("git -C \"$dir\" rev-parse HEAD", $out) === 0 && $out !== false && strlen($out = trim($out)) === 40){ if(Process::execute("git -C \"$dir\" rev-parse HEAD", $out) === 0 && $out !== false && strlen($out = trim($out)) === 40){

View File

@ -141,9 +141,9 @@ class Internet{
* *
* @phpstan-template TErrorVar of mixed * @phpstan-template TErrorVar of mixed
* *
* @param int $timeout default 10 * @param int $timeout default 10
* @param string[] $extraHeaders * @param string[] $extraHeaders
* @param string|null $err reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation. * @param string|null $err reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occured during the operation.
* @phpstan-param list<string> $extraHeaders * @phpstan-param list<string> $extraHeaders
* @phpstan-param TErrorVar $err * @phpstan-param TErrorVar $err
* @phpstan-param-out TErrorVar|string $err * @phpstan-param-out TErrorVar|string $err
@ -165,7 +165,7 @@ class Internet{
* *
* @param string[]|string $args * @param string[]|string $args
* @param string[] $extraHeaders * @param string[] $extraHeaders
* @param string|null $err reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occurred during the operation. * @param string|null $err reference parameter, will be set to the output of curl_error(). Use this to retrieve errors that occurred during the operation.
* @phpstan-param string|array<string, string> $args * @phpstan-param string|array<string, string> $args
* @phpstan-param list<string> $extraHeaders * @phpstan-param list<string> $extraHeaders
* @phpstan-param TErrorVar $err * @phpstan-param TErrorVar $err
@ -187,7 +187,7 @@ class Internet{
* General cURL shorthand function. * General cURL shorthand function.
* NOTE: This is a blocking operation and can take a significant amount of time. It is inadvisable to use this method on the main thread. * NOTE: This is a blocking operation and can take a significant amount of time. It is inadvisable to use this method on the main thread.
* *
* @param float|int $timeout The maximum connect timeout and timeout in seconds, correct to ms. * @param float|int $timeout The maximum connect timeout and timeout in seconds, correct to ms.
* @param string[] $extraHeaders extra headers to send as a plain string array * @param string[] $extraHeaders extra headers to send as a plain string array
* @param array $extraOpts extra CURLOPT_* to set as an [opt => value] map * @param array $extraOpts extra CURLOPT_* to set as an [opt => value] map
* @param \Closure|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle. * @param \Closure|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle.

View File

@ -150,8 +150,8 @@ final class Process{
/** /**
* @param string $command Command to execute * @param string $command Command to execute
* @param string|null $stdout Reference parameter to write stdout to * @param string|null $stdout Reference parameter to write stdout to
* @param string|null $stderr Reference parameter to write stderr to * @param string|null $stderr Reference parameter to write stderr to
* @phpstan-param-out string $stdout * @phpstan-param-out string $stdout
* @phpstan-param-out string $stderr * @phpstan-param-out string $stderr
* *

View File

@ -115,7 +115,7 @@ class Random{
* Returns a random integer between $start and $end * Returns a random integer between $start and $end
* *
* @param int $start default 0 * @param int $start default 0
* @param int $end default 0x7fffffff * @param int $end default 0x7fffffff
*/ */
public function nextRange(int $start = 0, int $end = 0x7fffffff) : int{ public function nextRange(int $start = 0, int $end = 0x7fffffff) : int{
return $start + ($this->nextInt() % ($end + 1 - $start)); return $start + ($this->nextInt() % ($end + 1 - $start));

View File

@ -539,7 +539,7 @@ final class Utils{
* incompatible. * incompatible.
* *
* @param callable|CallbackType $signature Dummy callable with the required parameters and return type * @param callable|CallbackType $signature Dummy callable with the required parameters and return type
* @param callable $subject Callable to check the signature of * @param callable $subject Callable to check the signature of
* @phpstan-param anyCallable|CallbackType $signature * @phpstan-param anyCallable|CallbackType $signature
* @phpstan-param anyCallable $subject * @phpstan-param anyCallable $subject
* *

View File

@ -643,7 +643,7 @@ class World implements ChunkManager{
* Returns a list of players who are in the given filter and also using the chunk containing the target position. * Returns a list of players who are in the given filter and also using the chunk containing the target position.
* Used for broadcasting sounds and particles with specific targets. * Used for broadcasting sounds and particles with specific targets.
* *
* @param Player[] $allowed * @param Player[] $allowed
* @phpstan-param list<Player> $allowed * @phpstan-param list<Player> $allowed
* *
* @return array<int, Player> * @return array<int, Player>
@ -1634,8 +1634,8 @@ class World implements ChunkManager{
* Note: If you're using this for performance-sensitive code, and you're guaranteed to be supplying ints in the * Note: If you're using this for performance-sensitive code, and you're guaranteed to be supplying ints in the
* specified vector, consider using {@link getBlockAt} instead for better performance. * specified vector, consider using {@link getBlockAt} instead for better performance.
* *
* @param bool $cached Whether to use the block cache for getting the block (faster, but may be inaccurate) * @param bool $cached Whether to use the block cache for getting the block (faster, but may be inaccurate)
* @param bool $addToCache Whether to cache the block object created by this method call. * @param bool $addToCache Whether to cache the block object created by this method call.
*/ */
public function getBlock(Vector3 $pos, bool $cached = true, bool $addToCache = true) : Block{ public function getBlock(Vector3 $pos, bool $cached = true, bool $addToCache = true) : Block{
return $this->getBlockAt((int) floor($pos->x), (int) floor($pos->y), (int) floor($pos->z), $cached, $addToCache); return $this->getBlockAt((int) floor($pos->x), (int) floor($pos->y), (int) floor($pos->z), $cached, $addToCache);
@ -1647,7 +1647,7 @@ class World implements ChunkManager{
* Note for plugin developers: If you are using this method a lot (thousands of times for many positions for * Note for plugin developers: If you are using this method a lot (thousands of times for many positions for
* example), you may want to set addToCache to false to avoid using excessive amounts of memory. * example), you may want to set addToCache to false to avoid using excessive amounts of memory.
* *
* @param bool $cached Whether to use the block cache for getting the block (faster, but may be inaccurate) * @param bool $cached Whether to use the block cache for getting the block (faster, but may be inaccurate)
* @param bool $addToCache Whether to cache the block object created by this method call. * @param bool $addToCache Whether to cache the block object created by this method call.
*/ */
public function getBlockAt(int $x, int $y, int $z, bool $cached = true, bool $addToCache = true) : Block{ public function getBlockAt(int $x, int $y, int $z, bool $cached = true, bool $addToCache = true) : Block{
@ -1794,7 +1794,7 @@ class World implements ChunkManager{
* Tries to break a block using a item, including Player time checks if available * Tries to break a block using a item, including Player time checks if available
* It'll try to lower the durability if Item is a tool, and set it to Air if broken. * It'll try to lower the durability if Item is a tool, and set it to Air if broken.
* *
* @param Item $item reference parameter (if null, can break anything) * @param Item $item reference parameter (if null, can break anything)
* @phpstan-param-out Item $item * @phpstan-param-out Item $item
*/ */
public function useBreakOn(Vector3 $vector, Item &$item = null, ?Player $player = null, bool $createParticles = false) : bool{ public function useBreakOn(Vector3 $vector, Item &$item = null, ?Player $player = null, bool $createParticles = false) : bool{
@ -1896,8 +1896,8 @@ class World implements ChunkManager{
/** /**
* Uses a item on a position and face, placing it or activating the block * Uses a item on a position and face, placing it or activating the block
* *
* @param Player|null $player default null * @param Player|null $player default null
* @param bool $playSound Whether to play a block-place sound if the block was placed successfully. * @param bool $playSound Whether to play a block-place sound if the block was placed successfully.
*/ */
public function useItemOn(Vector3 $vector, Item &$item, int $face, ?Vector3 $clickVector = null, ?Player $player = null, bool $playSound = false) : bool{ public function useItemOn(Vector3 $vector, Item &$item, int $face, ?Vector3 $clickVector = null, ?Player $player = null, bool $playSound = false) : bool{
$blockClicked = $this->getBlock($vector); $blockClicked = $this->getBlock($vector);
@ -2092,8 +2092,8 @@ class World implements ChunkManager{
/** /**
* Returns the closest Entity to the specified position, within the given radius. * Returns the closest Entity to the specified position, within the given radius.
* *
* @param string $entityType Class of entity to use for instanceof * @param string $entityType Class of entity to use for instanceof
* @param bool $includeDead Whether to include entitites which are dead * @param bool $includeDead Whether to include entitites which are dead
* @phpstan-template TEntity of Entity * @phpstan-template TEntity of Entity
* @phpstan-param class-string<TEntity> $entityType * @phpstan-param class-string<TEntity> $entityType
* *

View File

@ -166,7 +166,7 @@ class WorldManager{
/** /**
* Loads a world from the data directory * Loads a world from the data directory
* *
* @param bool $autoUpgrade Converts worlds to the default format if the world's format is not writable / deprecated * @param bool $autoUpgrade Converts worlds to the default format if the world's format is not writable / deprecated
* *
* @throws WorldException * @throws WorldException
*/ */

View File

@ -164,8 +164,8 @@ class Chunk{
/** /**
* Sets the biome ID at the specified X/Z chunk block coordinates * Sets the biome ID at the specified X/Z chunk block coordinates
* *
* @param int $x 0-15 * @param int $x 0-15
* @param int $z 0-15 * @param int $z 0-15
* @param int $biomeId 0-255 * @param int $biomeId 0-255
*/ */
public function setBiomeId(int $x, int $z, int $biomeId) : void{ public function setBiomeId(int $x, int $z, int $biomeId) : void{

View File

@ -504,7 +504,7 @@ class LevelDB extends BaseWorldProvider implements WritableWorldProvider{
} }
/** /**
* @param CompoundTag[] $targets * @param CompoundTag[] $targets
*/ */
private function writeTags(array $targets, string $index, \LevelDBWriteBatch $write) : void{ private function writeTags(array $targets, string $index, \LevelDBWriteBatch $write) : void{
if(count($targets) > 0){ if(count($targets) > 0){

View File

@ -38,7 +38,7 @@ use function preg_match_all;
final class FlatGeneratorOptions{ final class FlatGeneratorOptions{
/** /**
* @param int[] $structure * @param int[] $structure
* @param mixed[] $extraOptions * @param mixed[] $extraOptions
* @phpstan-param array<int, int> $structure * @phpstan-param array<int, int> $structure
* @phpstan-param array<string, array<string, string>|true> $extraOptions * @phpstan-param array<string, array<string, string>|true> $extraOptions

View File

@ -58,10 +58,10 @@ final class GeneratorManager{
} }
/** /**
* @param string $class Fully qualified name of class that extends \pocketmine\world\generator\Generator * @param string $class Fully qualified name of class that extends \pocketmine\world\generator\Generator
* @param string $name Alias for this generator type that can be written in configs * @param string $name Alias for this generator type that can be written in configs
* @param \Closure $presetValidator Callback to validate generator options for new worlds * @param \Closure $presetValidator Callback to validate generator options for new worlds
* @param bool $overwrite Whether to force overwriting any existing registered generator with the same name * @param bool $overwrite Whether to force overwriting any existing registered generator with the same name
* *
* @phpstan-param \Closure(string) : ?InvalidGeneratorOptionsException $presetValidator * @phpstan-param \Closure(string) : ?InvalidGeneratorOptionsException $presetValidator
* *

View File

@ -208,8 +208,8 @@ class SkyLightUpdate extends LightUpdate{
/** /**
* Recalculates the heightmap for the block column at the specified X/Z chunk coordinates * Recalculates the heightmap for the block column at the specified X/Z chunk coordinates
* *
* @param int $x 0-15 * @param int $x 0-15
* @param int $z 0-15 * @param int $z 0-15
* @param \SplFixedArray|bool[] $directSkyLightBlockers * @param \SplFixedArray|bool[] $directSkyLightBlockers
* @phpstan-param \SplFixedArray<bool> $directSkyLightBlockers * @phpstan-param \SplFixedArray<bool> $directSkyLightBlockers
* *

View File

@ -57,7 +57,7 @@ class StupidJsonDecodeTest extends TestCase{
/** /**
* @dataProvider stupidJsonDecodeProvider * @dataProvider stupidJsonDecodeProvider
* *
* @param mixed $expect * @param mixed $expect
* *
* @throws \ReflectionException * @throws \ReflectionException
*/ */