Skip to content

Commit

Permalink
Narrow down array php-doc types
Browse files Browse the repository at this point in the history
  • Loading branch information
Muqsit committed Feb 5, 2024
1 parent e658592 commit 500fe45
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/muqsit/tebex/handler/TebexHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class TebexHandler{

private TebexDueCommandsHandler $due_commands_handler;

/** @var int[]|null */
/** @var list<int>|null */
private ?array $command_ids = null;

private int $pending_commands_batch_counter = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ function(CommandSender $sender, Command $command, string $label, array $args) :

$this->registerSubCommand(new TebexSubCommand("refresh", "Refresh offline and online command queues", new ClosureCommandExecutor(
function(CommandSender $sender, Command $command, string $label, array $args) : bool{
/** @var array<int, CommandSender>|null $command_senders_force_check */
static $command_senders_force_check = null;
if($command_senders_force_check === null){
/** @var CommandSender[] $command_senders_force_check */
$command_senders_force_check = [];
$this->handler->getDueCommandsHandler()->refresh(static function(int $offline_commands, int $online_players) use(&$command_senders_force_check) : void{
if($command_senders_force_check !== null){
Expand All @@ -101,9 +101,9 @@ function(CommandSender $sender, Command $command, string $label, array $args) :

$this->registerSubCommand(new TebexSubCommand("dropall", "Drop all queued commands", new ClosureCommandExecutor(
function(CommandSender $sender, Command $command, string $label, array $args) : bool{
/** @var array<int, CommandSender>|null $command_senders_dropall */
static $command_senders_dropall = null;
if($command_senders_dropall === null){
/** @var CommandSender[] $command_senders_dropall */
$command_senders_dropall = [];
$this->handler->getDueCommandsHandler()->markAllAsExecuted(static function(int $marked) use(&$command_senders_dropall) : void{
if($command_senders_dropall !== null){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ final class TebexDueOfflineCommandsHandler{
readonly private Logger $logger;
readonly private TebexHandler $handler;

/** @var int[] */
/** @var array<int, int> */
private array $delayed = [];

public function __construct(Loader $plugin, TebexHandler $handler, int $check_period = 60 * 20){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function onPlayerQuit(Player $player) : void{
}

/**
* @return TebexDuePlayerHolder[]
* @return array<int, TebexDuePlayerHolder>
*/
public function getAll() : array{
return $this->tebex_due_players_by_id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static function init(Loader $plugin) : void{
self::$scheduler = $plugin->getScheduler();
}

/** @var DelayedOnlineCommandHandler[] */
/** @var array<int, DelayedOnlineCommandHandler> */
private array $delayed_online_command_handlers = [];

public function __construct(
Expand Down
2 changes: 1 addition & 1 deletion src/muqsit/tebex/thread/TebexThread.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

final class TebexThread extends Thread{

/** @var TebexResponseHandler<TebexResponse>[] */
/** @var array<int, TebexResponseHandler<TebexResponse>> */
private static array $handlers = [];

private static int $handler_ids = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/muqsit/tebex/thread/TebexThreadPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class TebexThreadPool{

readonly public SleeperHandlerEntry $sleeper_handler_entry;

/** @var TebexThread[] */
/** @var array<int, TebexThread> */
private array $workers = [];

private float $latency = 0.0;
Expand Down

0 comments on commit 500fe45

Please sign in to comment.