mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Modernize property declarations in src/utils
This commit is contained in:
parent
de12b701ac
commit
0e7e776862
@ -74,23 +74,19 @@ class Config{
|
||||
* @var mixed[]
|
||||
* @phpstan-var array<string, mixed>
|
||||
*/
|
||||
private $config = [];
|
||||
private array $config = [];
|
||||
|
||||
/**
|
||||
* @var mixed[]
|
||||
* @phpstan-var array<string, mixed>
|
||||
*/
|
||||
private $nestedCache = [];
|
||||
private array $nestedCache = [];
|
||||
|
||||
/** @var string */
|
||||
private $file;
|
||||
/** @var int */
|
||||
private $type = Config::DETECT;
|
||||
/** @var int */
|
||||
private $jsonOptions = JSON_PRETTY_PRINT | JSON_BIGINT_AS_STRING;
|
||||
private string $file;
|
||||
private int $type = Config::DETECT;
|
||||
private int $jsonOptions = JSON_PRETTY_PRINT | JSON_BIGINT_AS_STRING;
|
||||
|
||||
/** @var bool */
|
||||
private $changed = false;
|
||||
private bool $changed = false;
|
||||
|
||||
/** @var int[] */
|
||||
public static $formats = [
|
||||
|
@ -61,12 +61,12 @@ use const SCANDIR_SORT_NONE;
|
||||
|
||||
final class Filesystem{
|
||||
/** @var resource[] */
|
||||
private static $lockFileHandles = [];
|
||||
private static array $lockFileHandles = [];
|
||||
/**
|
||||
* @var string[]
|
||||
* @phpstan-var array<string, string>
|
||||
*/
|
||||
private static $cleanedPaths = [
|
||||
private static array $cleanedPaths = [
|
||||
\pocketmine\PATH => self::CLEAN_PATH_SRC_PREFIX
|
||||
];
|
||||
|
||||
|
@ -24,26 +24,15 @@ declare(strict_types=1);
|
||||
namespace pocketmine\utils;
|
||||
|
||||
final class InternetRequestResult{
|
||||
|
||||
/**
|
||||
* @var string[][]
|
||||
* @phpstan-var list<array<string, string>>
|
||||
*/
|
||||
private $headers;
|
||||
/** @var string */
|
||||
private $body;
|
||||
/** @var int */
|
||||
private $code;
|
||||
|
||||
/**
|
||||
* @param string[][] $headers
|
||||
* @phpstan-param list<array<string, string>> $headers
|
||||
*/
|
||||
public function __construct(array $headers, string $body, int $code){
|
||||
$this->headers = $headers;
|
||||
$this->body = $body;
|
||||
$this->code = $code;
|
||||
}
|
||||
public function __construct(
|
||||
private array $headers,
|
||||
private string $body,
|
||||
private int $code
|
||||
){}
|
||||
|
||||
/**
|
||||
* @return string[][]
|
||||
|
@ -35,17 +35,10 @@ class Random{
|
||||
public const Z = 521288629;
|
||||
public const W = 88675123;
|
||||
|
||||
/** @var int */
|
||||
private $x;
|
||||
|
||||
/** @var int */
|
||||
private $y;
|
||||
|
||||
/** @var int */
|
||||
private $z;
|
||||
|
||||
/** @var int */
|
||||
private $w;
|
||||
private int $x;
|
||||
private int $y;
|
||||
private int $z;
|
||||
private int $w;
|
||||
|
||||
/** @var int */
|
||||
protected $seed;
|
||||
|
@ -60,8 +60,7 @@ abstract class Terminal{
|
||||
public static string $COLOR_WHITE = "";
|
||||
public static string $COLOR_MINECOIN_GOLD = "";
|
||||
|
||||
/** @var bool|null */
|
||||
private static $formattingCodes = null;
|
||||
private static ?bool $formattingCodes = null;
|
||||
|
||||
public static function hasFormattingCodes() : bool{
|
||||
if(self::$formattingCodes === null){
|
||||
|
@ -105,10 +105,8 @@ final class Utils{
|
||||
public const OS_BSD = "bsd";
|
||||
public const OS_UNKNOWN = "other";
|
||||
|
||||
/** @var string|null */
|
||||
private static $os;
|
||||
/** @var UuidInterface|null */
|
||||
private static $serverUniqueId = null;
|
||||
private static ?string $os;
|
||||
private static ?UuidInterface $serverUniqueId = null;
|
||||
|
||||
/**
|
||||
* Returns a readable identifier for the given Closure, including file and line.
|
||||
|
@ -30,28 +30,16 @@ use function preg_match;
|
||||
* Manages PocketMine-MP version strings, and compares them
|
||||
*/
|
||||
class VersionString{
|
||||
/** @var string */
|
||||
private $baseVersion;
|
||||
/** @var string */
|
||||
private $suffix;
|
||||
|
||||
/** @var int */
|
||||
private $major;
|
||||
/** @var int */
|
||||
private $minor;
|
||||
/** @var int */
|
||||
private $patch;
|
||||
|
||||
/** @var int */
|
||||
private $build;
|
||||
/** @var bool */
|
||||
private $development = false;
|
||||
|
||||
public function __construct(string $baseVersion, bool $isDevBuild = false, int $buildNumber = 0){
|
||||
$this->baseVersion = $baseVersion;
|
||||
$this->development = $isDevBuild;
|
||||
$this->build = $buildNumber;
|
||||
private int $major;
|
||||
private int $minor;
|
||||
private int $patch;
|
||||
private string $suffix;
|
||||
|
||||
public function __construct(
|
||||
private string $baseVersion,
|
||||
private bool $isDevBuild = false,
|
||||
private int $buildNumber = 0
|
||||
){
|
||||
preg_match('/^(\d+)\.(\d+)\.(\d+)(?:-(.*))?$/', $this->baseVersion, $matches);
|
||||
if(count($matches) < 4){
|
||||
throw new \InvalidArgumentException("Invalid base version \"$baseVersion\", should contain at least 3 version digits");
|
||||
@ -77,10 +65,10 @@ class VersionString{
|
||||
|
||||
public function getFullVersion(bool $build = false) : string{
|
||||
$retval = $this->baseVersion;
|
||||
if($this->development){
|
||||
if($this->isDevBuild){
|
||||
$retval .= "+dev";
|
||||
if($build && $this->build > 0){
|
||||
$retval .= "." . $this->build;
|
||||
if($build && $this->buildNumber > 0){
|
||||
$retval .= "." . $this->buildNumber;
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,11 +92,11 @@ class VersionString{
|
||||
}
|
||||
|
||||
public function getBuild() : int{
|
||||
return $this->build;
|
||||
return $this->buildNumber;
|
||||
}
|
||||
|
||||
public function isDev() : bool{
|
||||
return $this->development;
|
||||
return $this->isDevBuild;
|
||||
}
|
||||
|
||||
public function __toString() : string{
|
||||
|
Loading…
x
Reference in New Issue
Block a user