mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
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:
@ -39,20 +39,18 @@ class PrepareEncryptionTask extends AsyncTask{
|
||||
|
||||
private static ?\OpenSSLAsymmetricKey $SERVER_PRIVATE_KEY = null;
|
||||
|
||||
/** @var string */
|
||||
private $serverPrivateKey;
|
||||
private string $serverPrivateKey;
|
||||
|
||||
/** @var string|null */
|
||||
private $aesKey = null;
|
||||
/** @var string|null */
|
||||
private $handshakeJwt = null;
|
||||
/** @var string */
|
||||
private $clientPub;
|
||||
private ?string $aesKey = null;
|
||||
private ?string $handshakeJwt = null;
|
||||
|
||||
/**
|
||||
* @phpstan-param \Closure(string $encryptionKey, string $handshakeJwt) : void $onCompletion
|
||||
*/
|
||||
public function __construct(string $clientPub, \Closure $onCompletion){
|
||||
public function __construct(
|
||||
private string $clientPub,
|
||||
\Closure $onCompletion
|
||||
){
|
||||
if(self::$SERVER_PRIVATE_KEY === null){
|
||||
$serverPrivateKey = openssl_pkey_new(["ec" => ["curve_name" => "secp384r1"]]);
|
||||
if($serverPrivateKey === false){
|
||||
@ -62,7 +60,6 @@ class PrepareEncryptionTask extends AsyncTask{
|
||||
}
|
||||
|
||||
$this->serverPrivateKey = igbinary_serialize(openssl_pkey_get_details(self::$SERVER_PRIVATE_KEY));
|
||||
$this->clientPub = $clientPub;
|
||||
$this->storeLocal(self::TLS_KEY_ON_COMPLETION, $onCompletion);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user