Skip to content

Commit

Permalink
Remove @phpstan- prefix from PHPDoc types
Browse files Browse the repository at this point in the history
  • Loading branch information
Muqsit committed Jun 2, 2023
1 parent b95ae75 commit 68141e8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 45 deletions.
20 changes: 4 additions & 16 deletions src/BlockHorizons/PerWorldPlayer/player/PlayerInstance.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,10 @@ final class PlayerInstance{
/** @var PlayerWorldData[] */
private array $world_data = [];

/**
* @var Closure[][]
*
* @phpstan-var array<string, array<int, Closure(PlayerWorldData) : void>>
*/
/** @var array<string, array<int, Closure(PlayerWorldData) : void>> */
private array $world_data_callbacks = [];

/**
* @var Closure[]
*
* @phpstan-var array<Closure() : void>
*/
/** @var array<Closure() : void> */
private array $on_locks_release = [];

public function __construct(Loader $loader, Player $player){
Expand Down Expand Up @@ -79,9 +71,7 @@ public function isLocked() : bool{
}

/**
* @param Closure $callback
*
* @phpstan-param Closure() : void $callback
* @param Closure() : void $callback
*/
public function waitForUnlock(Closure $callback) : void{
if($this->isLocked()){
Expand All @@ -94,9 +84,7 @@ public function waitForUnlock(Closure $callback) : void{

/**
* @param WorldInstance $world
* @param Closure $callback
*
* @phpstan-param Closure(PlayerWorldData) : void $callback
* @param Closure(PlayerWorldData) : void $callback
*/
public function loadWorldData(WorldInstance $world, Closure $callback) : void{
if(isset($this->world_data[$name = $world->getName()])){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ final class BundleManager{
private array $bundled_worlds = [];

/**
* @param mixed[] $bundled_worlds_configuration
*
* @phpstan-param array<string, array<string>> $bundled_worlds_configuration
* @param array<string, array<string>> $bundled_worlds_configuration
*/
public function __construct(array $bundled_worlds_configuration){
/**
Expand Down
20 changes: 6 additions & 14 deletions src/BlockHorizons/PerWorldPlayer/world/data/PlayerWorldData.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@ public static function empty() : PlayerWorldData{
}

/**
* @param Item[] $armor
* @param Item[] $inventory
* @param Item[] $ender
* @param array<int, Item> $armor
* @param array<int, Item> $inventory
* @param array<int, Item> $ender
* @return self
*
* @phpstan-param array<int, Item> $armor
* @phpstan-param array<int, Item> $inventory
* @phpstan-param array<int, Item> $ender
*/
public static function emptyWithInventory(array $armor, array $inventory, array $ender) : PlayerWorldData{
return new self($armor, $inventory, $ender, 20.0, [], Server::getInstance()->getGamemode(), 0, 20.0, 0.0, 5.0);
Expand Down Expand Up @@ -59,20 +55,16 @@ public static function fromPlayer(Player $player) : PlayerWorldData{
}

/**
* @param Item[] $armor_inventory
* @param Item[] $inventory
* @param Item[] $ender_inventory
* @param array<int, Item> $armor_inventory
* @param array<int, Item> $inventory
* @param array<int, Item> $ender_inventory
* @param float $health
* @param EffectInstance[] $effects
* @param GameMode $gamemode
* @param int $experience
* @param float $food
* @param float $exhaustion
* @param float $saturation
*
* @phpstan-param array<int, Item> $armor_inventory
* @phpstan-param array<int, Item> $inventory
* @phpstan-param array<int, Item> $ender_inventory
*/
public function __construct(
public array $armor_inventory,
Expand Down
10 changes: 2 additions & 8 deletions src/BlockHorizons/PerWorldPlayer/world/data/SaveDataManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@

final class SaveDataManager{

/**
* @var Closure[]
*
* @phpstan-var array<string, Closure(PlayerWorldData $data, Player $player) : void>
*/
/** @var array<string, Closure(PlayerWorldData $data, Player $player) : void> */
private array $injectors = [];

public function __construct(Loader $loader){
Expand Down Expand Up @@ -52,9 +48,7 @@ public function __construct(Loader $loader){

/**
* @param string $identifier
* @param Closure $injector
*
* @phpstan-param Closure(PlayerWorldData $data, Player $player) : void $injector
* @param Closure(PlayerWorldData $data, Player $player) : void $injector
*/
private function registerInjector(string $identifier, Closure $injector) : void{
$this->injectors[$identifier] = $injector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ interface WorldDatabase{
*
* @param WorldInstance $world
* @param Player $player
* @param Closure $onLoad
* @phpstan-param Closure(PlayerWorldData $data) : void $onLoad
* @param Closure(PlayerWorldData $data) : void $onLoad
*/
public function load(WorldInstance $world, Player $player, Closure $onLoad) : void;

Expand All @@ -28,8 +27,7 @@ public function load(WorldInstance $world, Player $player, Closure $onLoad) : vo
* @param Player $player
* @param PlayerWorldData $data
* @param int $cause what triggered the save.
* @param Closure $onSave
* @phpstan-param Closure(bool $success) : void $onSave
* @param Closure(bool $success) : void $onSave
*/
public function save(WorldInstance $world, Player $player, PlayerWorldData $data, int $cause, Closure $onSave) : void;

Expand Down

0 comments on commit 68141e8

Please sign in to comment.