mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 20:14:31 +00:00
add native return types to closures (for phpstan)
This commit is contained in:
@@ -740,7 +740,7 @@ class NetworkSession{
|
||||
* @phpstan-param \Closure(int $chunkX, int $chunkZ) : void $onCompletion
|
||||
*/
|
||||
public function startUsingChunk(int $chunkX, int $chunkZ, \Closure $onCompletion) : void{
|
||||
Utils::validateCallableSignature(function(int $chunkX, int $chunkZ){}, $onCompletion);
|
||||
Utils::validateCallableSignature(function(int $chunkX, int $chunkZ) : void{}, $onCompletion);
|
||||
|
||||
$world = $this->player->getLocation()->getWorld();
|
||||
assert($world !== null);
|
||||
@@ -797,7 +797,7 @@ class NetworkSession{
|
||||
}
|
||||
|
||||
public function syncPlayerList() : void{
|
||||
$this->sendDataPacket(PlayerListPacket::add(array_map(function(Player $player){
|
||||
$this->sendDataPacket(PlayerListPacket::add(array_map(function(Player $player) : PlayerListEntry{
|
||||
return PlayerListEntry::createAdditionEntry($player->getUniqueId(), $player->getId(), $player->getDisplayName(), SkinAdapterSingleton::get()->toSkinData($player->getSkin()), $player->getXuid());
|
||||
}, $this->server->getOnlinePlayers())));
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ class CompressBatchPromise{
|
||||
public function onResolve(\Closure ...$callbacks) : void{
|
||||
$this->checkCancelled();
|
||||
foreach($callbacks as $callback){
|
||||
Utils::validateCallableSignature(function(CompressBatchPromise $promise){}, $callback);
|
||||
Utils::validateCallableSignature(function(CompressBatchPromise $promise) : void{}, $callback);
|
||||
}
|
||||
if($this->result !== null){
|
||||
foreach($callbacks as $callback){
|
||||
|
@@ -63,7 +63,7 @@ class ResourcePacksPacketHandler extends PacketHandler{
|
||||
}
|
||||
|
||||
public function setUp() : void{
|
||||
$resourcePackEntries = array_map(static function(ResourcePack $pack){
|
||||
$resourcePackEntries = array_map(static function(ResourcePack $pack) : ResourcePackInfoEntry{
|
||||
//TODO: more stuff
|
||||
return new ResourcePackInfoEntry($pack->getPackId(), $pack->getPackVersion(), $pack->getPackSize(), "", "", "", false);
|
||||
}, $this->resourcePackManager->getResourceStack());
|
||||
@@ -109,7 +109,7 @@ class ResourcePacksPacketHandler extends PacketHandler{
|
||||
|
||||
break;
|
||||
case ResourcePackClientResponsePacket::STATUS_HAVE_ALL_PACKS:
|
||||
$stack = array_map(static function(ResourcePack $pack){
|
||||
$stack = array_map(static function(ResourcePack $pack) : ResourcePackStackEntry{
|
||||
return new ResourcePackStackEntry($pack->getPackId(), $pack->getPackVersion(), ""); //TODO: subpacks
|
||||
}, $this->resourcePackManager->getResourceStack());
|
||||
|
||||
|
@@ -41,9 +41,9 @@ class CommandData{
|
||||
* @param CommandParameter[][] $overloads
|
||||
*/
|
||||
public function __construct(string $name, string $description, int $flags, int $permission, ?CommandEnum $aliases, array $overloads){
|
||||
(function(array ...$overloads){
|
||||
(function(array ...$overloads) : void{
|
||||
foreach($overloads as $overload){
|
||||
(function(CommandParameter ...$parameters){})(...$overload);
|
||||
(function(CommandParameter ...$parameters) : void{})(...$overload);
|
||||
}
|
||||
})(...$overloads);
|
||||
$this->name = $name;
|
||||
|
Reference in New Issue
Block a user