phpstan: use PHP 8.0 as primary version

I'm using 8.0 for local development now, so having the phpstan configs targeted at 7.4 by default makes things inconvenient.
This commit is contained in:
Dylan K. Taylor
2021-07-26 14:34:47 +01:00
parent 3bbd088a09
commit 01fe497c49
15 changed files with 213 additions and 271 deletions

View File

@ -57,15 +57,24 @@ use const SOL_TCP;
class RCON{
/** @var Server */
private $server;
/** @var resource */
/**
* @var \Socket|resource
* @phpstan-var PhpSocket
*/
private $socket;
/** @var RCONInstance */
private $instance;
/** @var resource */
/**
* @var \Socket|resource
* @phpstan-var PhpSocket
*/
private $ipcMainSocket;
/** @var resource */
/**
* @var resource
* @phpstan-var PhpSocket
*/
private $ipcThreadSocket;
public function __construct(Server $server, string $password, int $port = 19132, string $interface = "0.0.0.0", int $maxClients = 50){

View File

@ -60,7 +60,10 @@ class RCONInstance extends Thread{
/** @var bool */
private $stop;
/** @var resource */
/**
* @var \Socket|resource
* @phpstan-var PhpSocket
*/
private $socket;
/** @var string */
private $password;
@ -68,14 +71,19 @@ class RCONInstance extends Thread{
private $maxClients;
/** @var \ThreadedLogger */
private $logger;
/** @var resource */
/**
* @var \Socket|resource
* @phpstan-var PhpSocket
*/
private $ipcSocket;
/** @var SleeperNotifier|null */
private $notifier;
/**
* @param resource $socket
* @param resource $ipcSocket
* @param \Socket|resource $socket
* @param \Socket|resource $ipcSocket
* @phpstan-param PhpSocket $socket
* @phpstan-param PhpSocket $ipcSocket
*/
public function __construct($socket, string $password, int $maxClients, \ThreadedLogger $logger, $ipcSocket, ?SleeperNotifier $notifier){
$this->stop = false;
@ -92,7 +100,8 @@ class RCONInstance extends Thread{
}
/**
* @param resource $client
* @param \Socket|resource $client
* @phpstan-param PhpSocket $client
*
* @return int|false
*/
@ -105,10 +114,11 @@ class RCONInstance extends Thread{
}
/**
* @param resource $client
* @param \Socket|resource $client
* @param int $requestID reference parameter
* @param int $packetType reference parameter
* @param string $payload reference parameter
* @phpstan-param PhpSocket $client
*
* @return bool
*/
@ -165,7 +175,10 @@ class RCONInstance extends Thread{
public function run(){
$this->registerClassLoader();
/** @var resource[] $clients */
/**
* @var \Socket[]|resource[] $clients
* @phpstan-var array<int, PhpSocket> $clients
*/
$clients = [];
/** @var bool[] $authenticated */
$authenticated = [];
@ -265,7 +278,8 @@ class RCONInstance extends Thread{
}
/**
* @param resource $client
* @param \Socket|resource $client
* @phpstan-param PhpSocket $client
*/
private function disconnectClient($client) : void{
socket_getpeername($client, $ip, $port);

View File

@ -196,7 +196,7 @@ class Internet{
* @param callable|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle.
* @phpstan-param array<int, mixed> $extraOpts
* @phpstan-param list<string> $extraHeaders
* @phpstan-param (callable(resource) : void)|null $onSuccess
* @phpstan-param (callable(PhpCurlHandle) : void)|null $onSuccess
*
* @return array a plain array of three [result body : string, headers : string[][], HTTP response code : int]. Headers are grouped by requests with strtolower(header name) as keys and header value as values
* @phpstan-return array{string, list<array<string, string>>, int}

View File

@ -454,7 +454,7 @@ class Utils{
* @param callable|null $onSuccess function to be called if there is no error. Accepts a resource argument as the cURL handle.
* @phpstan-param array<int, mixed> $extraOpts
* @phpstan-param list<string> $extraHeaders
* @phpstan-param (callable(resource) : void)|null $onSuccess
* @phpstan-param (callable(PhpCurlHandle) : void)|null $onSuccess
*
* @return array a plain array of three [result body : string, headers : string[][], HTTP response code : int]. Headers are grouped by requests with strtolower(header name) as keys and header value as values
* @phpstan-return array{string, list<array<string, string>>, int}