Modernize private property declarations in src/network

This commit is contained in:
Dylan K. Taylor
2022-05-17 21:22:33 +01:00
parent cd016bedce
commit 6eac2ea7a5
31 changed files with 154 additions and 340 deletions

View File

@ -51,32 +51,16 @@ use function is_array;
* Handles the initial login phase of the session. This handler is used as the initial state.
*/
class LoginPacketHandler extends PacketHandler{
/** @var Server */
private $server;
/** @var NetworkSession */
private $session;
/**
* @var \Closure
* @phpstan-var \Closure(PlayerInfo) : void
*/
private $playerInfoConsumer;
/**
* @var \Closure
* @phpstan-var \Closure(bool, bool, ?string, ?string) : void
*/
private $authCallback;
/**
* @phpstan-param \Closure(PlayerInfo) : void $playerInfoConsumer
* @phpstan-param \Closure(bool $isAuthenticated, bool $authRequired, ?string $error, ?string $clientPubKey) : void $authCallback
*/
public function __construct(Server $server, NetworkSession $session, \Closure $playerInfoConsumer, \Closure $authCallback){
$this->session = $session;
$this->server = $server;
$this->playerInfoConsumer = $playerInfoConsumer;
$this->authCallback = $authCallback;
}
public function __construct(
private Server $server,
private NetworkSession $session,
private \Closure $playerInfoConsumer,
private \Closure $authCallback
){}
public function handleLogin(LoginPacket $packet) : bool{
if(!$this->isCompatibleProtocol($packet->protocol)){