fixup some formatting issues

This commit is contained in:
Dylan K. Taylor 2019-06-18 14:12:37 +01:00
parent bb675ac99b
commit 9df2ca3655
4 changed files with 9 additions and 9 deletions

View File

@ -46,10 +46,10 @@ class CallbackInventoryChangeListener implements InventoryChangeListener{
public static function onAnyChange(\Closure $onChange) : self{
return new self(
static function(Inventory $inventory, int $unused) use($onChange) : void{
static function(Inventory $inventory, int $unused) use ($onChange) : void{
$onChange($inventory);
},
static function(Inventory $inventory) use($onChange) : void{
static function(Inventory $inventory) use ($onChange) : void{
$onChange($inventory);
}
);

View File

@ -98,7 +98,7 @@ class ChunkCache implements ChunkListener{
$chunkZ,
$this->world->getChunk($chunkX, $chunkZ),
$this->caches[$chunkHash],
function() use($chunkX, $chunkZ){
function() use ($chunkX, $chunkZ){
$this->world->getLogger()->error("Failed preparing chunk $chunkX $chunkZ, retrying");
$this->restartPendingRequest($chunkX, $chunkZ);

View File

@ -449,7 +449,7 @@ class NetworkSession{
* @param bool $notify
*/
public function disconnect(string $reason, bool $notify = true) : void{
$this->tryDisconnect(function() use($reason, $notify){
$this->tryDisconnect(function() use ($reason, $notify){
if($this->player !== null){
$this->player->disconnect($reason, null, $notify);
}
@ -467,7 +467,7 @@ class NetworkSession{
* @throws \UnsupportedOperationException
*/
public function transfer(string $ip, int $port, string $reason = "transfer") : void{
$this->tryDisconnect(function() use($ip, $port, $reason){
$this->tryDisconnect(function() use ($ip, $port, $reason){
$this->sendDataPacket(TransferPacket::create($ip, $port), true);
$this->disconnect($reason, false);
if($this->player !== null){
@ -484,7 +484,7 @@ class NetworkSession{
* @param bool $notify
*/
public function onPlayerDestroyed(string $reason, bool $notify = true) : void{
$this->tryDisconnect(function() use($reason, $notify){
$this->tryDisconnect(function() use ($reason, $notify){
$this->doServerDisconnect($reason, $notify);
});
}
@ -510,7 +510,7 @@ class NetworkSession{
* @param string $reason
*/
public function onClientDisconnect(string $reason) : void{
$this->tryDisconnect(function() use($reason){
$this->tryDisconnect(function() use ($reason){
if($this->player !== null){
$this->player->disconnect($reason, null, false);
}
@ -742,7 +742,7 @@ class NetworkSession{
ChunkCache::getInstance($this->player->getWorld())->request($chunkX, $chunkZ)->onResolve(
//this callback may be called synchronously or asynchronously, depending on whether the promise is resolved yet
function(CompressBatchPromise $promise) use($chunkX, $chunkZ, $onCompletion){
function(CompressBatchPromise $promise) use ($chunkX, $chunkZ, $onCompletion){
if(!$this->isConnected()){
return;
}

View File

@ -356,7 +356,7 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
/** @var CommandEnum[] $enums */
$enums = [];
$addEnumFn = static function(CommandEnum $enum) use(&$enums, &$enumIndexes, &$enumValueIndexes){
$addEnumFn = static function(CommandEnum $enum) use (&$enums, &$enumIndexes, &$enumValueIndexes){
if(!isset($enumIndexes[$enum->getName()])){
$enums[$enumIndexes[$enum->getName()] = count($enumIndexes)] = $enum;
}