Replace Closure::fromCallable() usages with first-class callables

PHP 8.1 <3
This commit is contained in:
Dylan K. Taylor
2023-07-19 13:34:42 +01:00
parent fba51e3bf9
commit 537721fe7d
7 changed files with 16 additions and 19 deletions

View File

@ -108,7 +108,7 @@ class InventoryManager{
private NetworkSession $session
){
$this->containerOpenCallbacks = new ObjectSet();
$this->containerOpenCallbacks->add(\Closure::fromCallable([self::class, 'createContainerOpen']));
$this->containerOpenCallbacks->add(self::createContainerOpen(...));
$this->add(ContainerIds::INVENTORY, $this->player->getInventory());
$this->add(ContainerIds::OFFHAND, $this->player->getOffHandInventory());

View File

@ -225,13 +225,13 @@ class NetworkSession{
$this->logger->setPrefix($this->getLogPrefix());
$this->manager->markLoginReceived($this);
},
\Closure::fromCallable([$this, "setAuthenticationStatus"])
$this->setAuthenticationStatus(...)
));
}
protected function createPlayer() : void{
$this->server->createPlayer($this, $this->info, $this->authenticated, $this->cachedOfflinePlayerData)->onCompletion(
\Closure::fromCallable([$this, 'onPlayerCreated']),
$this->onPlayerCreated(...),
function() : void{
//TODO: this should never actually occur... right?
$this->logger->error("Failed to create player");