Modernize property declarations in src/world/generator

This commit is contained in:
Dylan K. Taylor 2022-04-28 13:16:21 +01:00
parent 46c504e529
commit ed2a239334
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
5 changed files with 14 additions and 28 deletions

View File

@ -34,11 +34,9 @@ use pocketmine\world\generator\populator\Populator;
use function count;
class Flat extends Generator{
/** @var Chunk */
private $chunk;
private Chunk $chunk;
/** @var Populator[] */
private $populators = [];
private array $populators = [];
private FlatGeneratorOptions $options;

View File

@ -26,11 +26,9 @@ namespace pocketmine\world\generator;
use function exp;
final class Gaussian{
/** @var int */
public $smoothSize;
public int $smoothSize;
/** @var float[][] */
public $kernel = [];
public array $kernel = [];
public function __construct(int $smoothSize){
$this->smoothSize = $smoothSize;

View File

@ -37,7 +37,7 @@ final class GeneratorManager{
* @var GeneratorManagerEntry[] name => classname mapping
* @phpstan-var array<string, GeneratorManagerEntry>
*/
private $list = [];
private array $list = [];
public function __construct(){
$this->addGenerator(Flat::class, "flat", \Closure::fromCallable(function(string $preset) : ?InvalidGeneratorOptionsException{

View File

@ -31,7 +31,7 @@ final class ThreadLocalGeneratorContext{
* @var self[]
* @phpstan-var array<int, self>
*/
private static $contexts = [];
private static array $contexts = [];
public static function register(self $context, int $worldId) : void{
self::$contexts[$worldId] = $context;
@ -45,19 +45,11 @@ final class ThreadLocalGeneratorContext{
return self::$contexts[$worldId] ?? null;
}
/** @var Generator */
private $generator;
/** @var int */
private $worldMinY;
/** @var int */
private $worldMaxY;
public function __construct(Generator $generator, int $worldMinY, int $worldMaxY){
$this->generator = $generator;
$this->worldMinY = $worldMinY;
$this->worldMaxY = $worldMaxY;
}
public function __construct(
private Generator $generator,
private int $worldMinY,
private int $worldMaxY
){}
public function getGenerator() : Generator{ return $this->generator; }

View File

@ -30,16 +30,14 @@ use pocketmine\world\biome\UnknownBiome;
use pocketmine\world\generator\noise\Simplex;
abstract class BiomeSelector{
/** @var Simplex */
private $temperature;
/** @var Simplex */
private $rainfall;
private Simplex $temperature;
private Simplex $rainfall;
/**
* @var Biome[]|\SplFixedArray
* @phpstan-var \SplFixedArray<Biome>
*/
private $map = null;
private \SplFixedArray $map = null;
public function __construct(Random $random){
$this->temperature = new Simplex($random, 2, 1 / 16, 1 / 512);