Modernize private property declarations in Threaded classes

I previously avoided this due to being unsure of the effects; however, it's clear that we already use typed properties on Threaded things in other places anyway, and the only known issues are with uninit properties, and arrays.
This commit is contained in:
Dylan K. Taylor
2022-05-17 22:42:18 +01:00
parent d4b7f66e15
commit df3a69dcb7
9 changed files with 37 additions and 62 deletions

View File

@ -42,39 +42,33 @@ class ProcessLoginTask extends AsyncTask{
private const CLOCK_DRIFT_MAX = 60;
/** @var string */
private $chain;
/** @var string */
private $clientDataJwt;
private string $chain;
/**
* @var string|null
* Whether the keychain signatures were validated correctly. This will be set to an error message if any link in the
* keychain is invalid for whatever reason (bad signature, not in nbf-exp window, etc). If this is non-null, the
* keychain might have been tampered with. The player will always be disconnected if this is non-null.
*/
private $error = "Unknown";
private ?string $error = "Unknown";
/**
* @var bool
* Whether the player is logged into Xbox Live. This is true if any link in the keychain is signed with the Mojang
* root public key.
*/
private $authenticated = false;
/** @var bool */
private $authRequired;
/** @var string|null */
private $clientPublicKey = null;
private bool $authenticated = false;
private ?string $clientPublicKey = null;
/**
* @param string[] $chainJwts
* @phpstan-param \Closure(bool $isAuthenticated, bool $authRequired, ?string $error, ?string $clientPublicKey) : void $onCompletion
*/
public function __construct(array $chainJwts, string $clientDataJwt, bool $authRequired, \Closure $onCompletion){
public function __construct(
array $chainJwts,
private string $clientDataJwt,
private bool $authRequired,
\Closure $onCompletion
){
$this->storeLocal(self::TLS_KEY_ON_COMPLETION, $onCompletion);
$this->chain = igbinary_serialize($chainJwts);
$this->clientDataJwt = $clientDataJwt;
$this->authRequired = $authRequired;
}
public function onRun() : void{