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

@ -79,23 +79,16 @@ class ChunkCache implements ChunkListener{
}
}
/** @var World */
private $world;
/** @var Compressor */
private $compressor;
/** @var CompressBatchPromise[] */
private $caches = [];
private array $caches = [];
/** @var int */
private $hits = 0;
/** @var int */
private $misses = 0;
private int $hits = 0;
private int $misses = 0;
private function __construct(World $world, Compressor $compressor){
$this->world = $world;
$this->compressor = $compressor;
}
private function __construct(
private World $world,
private Compressor $compressor
){}
/**
* Requests asynchronous preparation of the chunk at the given coordinates.

View File

@ -54,7 +54,7 @@ final class CraftingDataCache{
* @var CraftingDataPacket[]
* @phpstan-var array<int, CraftingDataPacket>
*/
private $caches = [];
private array $caches = [];
public function getCache(CraftingManager $manager) : CraftingDataPacket{
$id = spl_object_id($manager);

View File

@ -34,11 +34,6 @@ use function file_get_contents;
class StaticPacketCache{
use SingletonTrait;
/** @var BiomeDefinitionListPacket */
private $biomeDefs;
/** @var AvailableActorIdentifiersPacket */
private $availableActorIdentifiers;
/**
* @phpstan-return CacheableNbt<\pocketmine\nbt\tag\CompoundTag>
*/
@ -55,10 +50,10 @@ class StaticPacketCache{
);
}
public function __construct(BiomeDefinitionListPacket $biomeDefs, AvailableActorIdentifiersPacket $availableActorIdentifiers){
$this->biomeDefs = $biomeDefs;
$this->availableActorIdentifiers = $availableActorIdentifiers;
}
public function __construct(
private BiomeDefinitionListPacket $biomeDefs,
private AvailableActorIdentifiersPacket $availableActorIdentifiers
){}
public function getBiomeDefs() : BiomeDefinitionListPacket{
return $this->biomeDefs;