added SplFixedArray generics for phpstan 0.12.9

This commit is contained in:
Dylan K. Taylor 2020-02-05 11:57:37 +00:00
parent 32d6ea0fba
commit 3f7e7352fb
10 changed files with 49 additions and 9 deletions

View File

@ -391,6 +391,7 @@ class BlockFactory{
/**
* @internal
* @phpstan-return \SplFixedArray<Block>
*/
public static function getBlockStatesArray() : \SplFixedArray{
return self::$fullList;

View File

@ -46,7 +46,10 @@ abstract class BaseInventory implements Inventory{
protected $name;
/** @var string */
protected $title;
/** @var \SplFixedArray|(Item|null)[] */
/**
* @var \SplFixedArray|(Item|null)[]
* @phpstan-var \SplFixedArray<Item|null>
*/
protected $slots;
/** @var Player[] */
protected $viewers = [];

View File

@ -43,7 +43,10 @@ use function trim;
*/
class ItemFactory{
/** @var \SplFixedArray */
/**
* @var \SplFixedArray
* @phpstan-var \SplFixedArray<Item>
*/
private static $list = null;
/**

View File

@ -94,7 +94,10 @@ class Enchantment{
public const SLOT_ELYTRA = 0x4000;
public const SLOT_TRIDENT = 0x8000;
/** @var \SplFixedArray|Enchantment[] */
/**
* @var \SplFixedArray|Enchantment[]
* @phpstan-var \SplFixedArray<Enchantment>
*/
protected static $enchantments;
public static function init() : void{

View File

@ -25,7 +25,10 @@ namespace pocketmine\item\enchantment;
class EnchantmentList{
/** @var \SplFixedArray|EnchantmentEntry[] */
/**
* @var \SplFixedArray|EnchantmentEntry[]
* @phpstan-var \SplFixedArray<EnchantmentEntry>
*/
private $enchantments;
public function __construct(int $size){

View File

@ -247,7 +247,10 @@ class Level implements ChunkManager, Metadatable{
/** @var Vector3 */
private $temporalVector;
/** @var \SplFixedArray */
/**
* @var \SplFixedArray
* @phpstan-var \SplFixedArray<Block>
*/
private $blockStates;
/** @var int */
@ -1038,6 +1041,9 @@ class Level implements ChunkManager, Metadatable{
unset($this->chunkCache[Level::chunkHash($chunkX, $chunkZ)]);
}
/**
* @phpstan-return \SplFixedArray<Block>
*/
public function getRandomTickedBlocks() : \SplFixedArray{
return $this->randomTickBlocks;
}

View File

@ -49,7 +49,10 @@ abstract class Biome{
public const MAX_BIOMES = 256;
/** @var Biome[]|\SplFixedArray */
/**
* @var Biome[]|\SplFixedArray
* @phpstan-var \SplFixedArray<Biome>
*/
private static $biomes;
/** @var int */

View File

@ -72,7 +72,10 @@ class Chunk{
/** @var int */
protected $height = Chunk::MAX_SUBCHUNKS;
/** @var \SplFixedArray|SubChunkInterface[] */
/**
* @var \SplFixedArray|SubChunkInterface[]
* @phpstan-var \SplFixedArray<SubChunkInterface>
*/
protected $subChunks;
/** @var EmptySubChunk */
@ -86,7 +89,10 @@ class Chunk{
/** @var Entity[] */
protected $entities = [];
/** @var \SplFixedArray|int[] */
/**
* @var \SplFixedArray|int[]
* @phpstan-var \SplFixedArray<int>
*/
protected $heightMap;
/** @var string */
@ -784,6 +790,7 @@ class Chunk{
/**
* @return \SplFixedArray|SubChunkInterface[]
* @phpstan-return \SplFixedArray<SubChunkInterface>
*/
public function getSubChunks() : \SplFixedArray{
return $this->subChunks;

View File

@ -34,7 +34,10 @@ abstract class BiomeSelector{
/** @var Simplex */
private $rainfall;
/** @var Biome[]|\SplFixedArray */
/**
* @var Biome[]|\SplFixedArray
* @phpstan-var \SplFixedArray<Biome>
*/
private $map = null;
public function __construct(Random $random){

View File

@ -247,6 +247,10 @@ abstract class Noise{
return $result;
}
/**
* @return \SplFixedArray|float[]
* @phpstan-return \SplFixedArray<float>
*/
public function getFastNoise1D(int $xSize, int $samplingRate, int $x, int $y, int $z) : \SplFixedArray{
if($samplingRate === 0){
throw new \InvalidArgumentException("samplingRate cannot be 0");
@ -271,6 +275,10 @@ abstract class Noise{
return $noiseArray;
}
/**
* @return \SplFixedArray|float[][]
* @phpstan-return \SplFixedArray<\SplFixedArray<float>>
*/
public function getFastNoise2D(int $xSize, int $zSize, int $samplingRate, int $x, int $y, int $z) : \SplFixedArray{
assert($samplingRate !== 0, new \InvalidArgumentException("samplingRate cannot be 0"));