Skip to content

Commit

Permalink
Remove @phpstan- prefix from phpdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Muqsit committed Feb 13, 2023
1 parent bb195a0 commit 005db01
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
final class ClosureCommandExecutor implements CommandExecutor{

/**
* @param Closure $executor
*
* @phpstan-param Closure(CommandSender, Command, string, string[]) : bool $executor
* @param Closure(CommandSender, Command, string, string[]) : bool $executor
*/
public function __construct(
private Closure $executor
Expand Down
19 changes: 5 additions & 14 deletions src/muqsit/tebex/handler/due/TebexDueCommandsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ final class TebexDueCommandsHandler{

/**
* @param string $game_type
* @param Closure $on_match
* @param Closure(Player, TebexDuePlayerHolder) : void $on_match
* @return TebexDuePlayerList
*
* @phpstan-param Closure(Player, TebexDuePlayerHolder) : void $on_match
*/
private static function getListFromGameType(string $game_type, Closure $on_match) : TebexDuePlayerList{
return new TebexDuePlayerList(match($game_type){
Expand Down Expand Up @@ -92,9 +90,7 @@ public function __construct(
}

/**
* @param Closure|null $callback
*
* @phpstan-param Closure(int) : void $callback
* @param (Closure(int) : void)|null $callback
*/
public function markAllAsExecuted(?Closure $callback = null) : void{
$this->plugin->getApi()->getDuePlayersList(TebexResponseHandler::onSuccess(function(TebexDuePlayersInfo $result) use($callback) : void{
Expand Down Expand Up @@ -147,9 +143,7 @@ public function getList() : TebexDuePlayerList{
}

/**
* @param Closure|null $callback
*
* @phpstan-param Closure(int, int) : void $callback
* @param (Closure(int, int) : void)|null $callback
*/
public function refresh(?Closure $callback = null) : void{
$this->offline_commands_handler->check(function(int $offline_cmds_count) use($callback) : void{
Expand All @@ -162,11 +156,8 @@ public function refresh(?Closure $callback = null) : void{
}

/**
* @param Closure|null $reschedule_condition
* @param Closure|null $callback
*
* @phpstan-param Closure() : bool $reschedule_condition
* @phpstan-param Closure(int) : void $callback
* @param (Closure() : bool)|null $reschedule_condition
* @param (Closure(int) : void)|null $callback
*/
public function checkDuePlayers(?Closure $reschedule_condition = null, ?Closure $callback = null) : void{
$this->plugin->getApi()->getDuePlayersList(TebexResponseHandler::onSuccess(function(TebexDuePlayersInfo $result) use($reschedule_condition, $callback) : void{
Expand Down
12 changes: 3 additions & 9 deletions src/muqsit/tebex/handler/due/TebexDueOfflineCommandsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ public function __construct(Loader $plugin, TebexHandler $handler, int $check_pe
}

/**
* @param Closure|null $callback
*
* @phpstan-param Closure(int) : void $callback
* @param (Closure(int) : void)|null $callback
*/
public function check(?Closure $callback = null) : void{
$this->plugin->getApi()->getQueuedOfflineCommands(TebexResponseHandler::onSuccess(function(TebexQueuedOfflineCommandsInfo $info) use($callback) : void{
Expand All @@ -47,9 +45,7 @@ public function check(?Closure $callback = null) : void{
}

/**
* @param Closure|null $callback
*
* @phpstan-param Closure(int) : void $callback
* @param (Closure(int) : void)|null $callback
*/
public function markAllAsExecuted(?Closure $callback = null) : void{
$this->plugin->getApi()->getQueuedOfflineCommands(TebexResponseHandler::onSuccess(function(TebexQueuedOfflineCommandsInfo $info) use($callback) : void{
Expand Down Expand Up @@ -85,9 +81,7 @@ private function onFetchDueOfflineCommands(TebexQueuedOfflineCommandsInfo $info)

/**
* @param TebexQueuedOfflineCommand $command
* @param Closure $callback
*
* @phpstan-param Closure(bool) : void $callback
* @param Closure(bool) : void $callback
*/
private function executeCommand(TebexQueuedOfflineCommand $command, Closure $callback) : void{
$delay = $command->getConditions()->getDelay();
Expand Down
22 changes: 4 additions & 18 deletions src/muqsit/tebex/handler/due/playerlist/TebexDuePlayerList.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,18 @@

final class TebexDuePlayerList{

/**
* @var TebexDuePlayerHolder[]
*
* @phpstan-var array<int, TebexDuePlayerHolder>
*/
/** @var array<int, TebexDuePlayerHolder> */
private array $tebex_due_players_by_id = []; // indexes pending customers by TebexPlayerId => TebexDuePlayerHolder

/**
* @var int[]
*
* @phpstan-var array<string, int>
*/
/** @var array<string, int> */
private array $tebex_due_players_by_index = []; // indexes pending customers by TebexDuePlayerList::$indexer => TebexPlayerId

/**
* @var TebexPlayerSession[]
*
* @phpstan-var array<string, TebexPlayerSession>
*/
/** @var array<string, TebexPlayerSession> */
private array $online_players = []; // indexes online players on the server by TebexDuePlayerList::$indexer => TebexPlayerSession

/**
* @param Closure $on_match
* @param Closure(Player, TebexDuePlayerHolder) : void $on_match
* @param PlayerIndexer $indexer
*
* @phpstan-param Closure(Player, TebexDuePlayerHolder) : void $on_match
*/
public function __construct(
private PlayerIndexer $indexer,
Expand Down
8 changes: 2 additions & 6 deletions src/muqsit/tebex/handler/due/session/TebexPlayerSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ public function destroy() : void{
/**
* @param TebexQueuedOnlineCommand $command
* @param TebexDuePlayer $due_player
* @param Closure $callback
*
* @phpstan-param Closure(bool) : void $callback
* @param Closure(bool) : void $callback
*/
public function executeOnlineCommand(TebexQueuedOnlineCommand $command, TebexDuePlayer $due_player, Closure $callback) : void{
$conditions = $command->getConditions();
Expand All @@ -61,10 +59,8 @@ public function executeOnlineCommand(TebexQueuedOnlineCommand $command, TebexDue
* @param TebexQueuedOnlineCommand $command
* @param TebexDuePlayer $due_player
* @param int $delay
* @param Closure $callback
* @param Closure(bool) : void $callback
* @return bool
*
* @phpstan-param Closure(bool) : void $callback
*/
private function scheduleCommandForDelay(TebexQueuedOnlineCommand $command, TebexDuePlayer $due_player, int $delay, Closure $callback) : bool{
if(isset($this->delayed_online_command_handlers[$id = $command->getId()])){
Expand Down
15 changes: 4 additions & 11 deletions src/muqsit/tebex/thread/TebexThread.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@

final class TebexThread extends Thread{

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

private static int $handler_ids = 0;
Expand Down Expand Up @@ -66,12 +62,9 @@ public function __construct(Logger $logger, SleeperNotifier $notifier, string $s
}

/**
* @param TebexRequest $request
* @param TebexResponseHandler $handler
*
* @phpstan-template TTebexResponse of \muqsit\tebexapi\connection\response\TebexResponse
* @phpstan-param TebexRequest<TTebexResponse> $request
* @phpstan-param TebexResponseHandler<TTebexResponse> $handler
* @template TTebexResponse of TebexResponse
* @param TebexRequest<TTebexResponse> $request
* @param TebexResponseHandler<TTebexResponse> $handler
*/
public function push(TebexRequest $request, TebexResponseHandler $handler) : void{
$handler_id = ++self::$handler_ids;
Expand Down

0 comments on commit 005db01

Please sign in to comment.