added missing @var property types (reported by phpstan)

This commit is contained in:
Dylan K. Taylor
2020-01-09 14:13:54 +00:00
parent cda3e6f4dc
commit 1eedac87b2
63 changed files with 190 additions and 1 deletions

View File

@ -31,12 +31,19 @@ use function array_fill;
use function assert;
abstract class Noise{
/** @var int[] */
protected $perm = [];
/** @var float */
protected $offsetX = 0;
/** @var float */
protected $offsetY = 0;
/** @var float */
protected $offsetZ = 0;
/** @var int */
protected $octaves = 8;
/** @var float */
protected $persistence;
/** @var float */
protected $expansion;
public static function floor($x) : int{

View File

@ -26,6 +26,7 @@ namespace pocketmine\level\generator\noise;
use pocketmine\utils\Random;
class Perlin extends Noise{
/** @var int[][] */
public static $grad3 = [
[1, 1, 0], [-1, 1, 0], [1, -1, 0], [-1, -1, 0],
[1, 0, 1], [-1, 0, 1], [1, 0, -1], [-1, 0, -1],

View File

@ -34,18 +34,31 @@ use function sqrt;
* http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
*/
class Simplex extends Perlin{
/** @var float */
protected static $SQRT_3;
/** @var float */
protected static $SQRT_5;
/** @var float */
protected static $F2;
/** @var float */
protected static $G2;
/** @var float */
protected static $G22;
/** @var float */
protected static $F3;
/** @var float */
protected static $G3;
/** @var float */
protected static $F4;
/** @var float */
protected static $G4;
/** @var float */
protected static $G42;
/** @var float */
protected static $G43;
/** @var float */
protected static $G44;
/** @var int[][] */
protected static $grad4 = [[0, 1, 1, 1], [0, 1, 1, -1], [0, 1, -1, 1], [0, 1, -1, -1],
[0, -1, 1, 1], [0, -1, 1, -1], [0, -1, -1, 1], [0, -1, -1, -1],
[1, 0, 1, 1], [1, 0, 1, -1], [1, 0, -1, 1], [1, 0, -1, -1],
@ -54,6 +67,8 @@ class Simplex extends Perlin{
[-1, 1, 0, 1], [-1, 1, 0, -1], [-1, -1, 0, 1], [-1, -1, 0, -1],
[1, 1, 1, 0], [1, 1, -1, 0], [1, -1, 1, 0], [1, -1, -1, 0],
[-1, 1, 1, 0], [-1, 1, -1, 0], [-1, -1, 1, 0], [-1, -1, -1, 0]];
/** @var int[][] */
protected static $simplex = [
[0, 1, 2, 3], [0, 1, 3, 2], [0, 0, 0, 0], [0, 2, 3, 1], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [1, 2, 3, 0],
[0, 2, 1, 3], [0, 0, 0, 0], [0, 3, 1, 2], [0, 3, 2, 1], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [1, 3, 2, 0],
@ -63,6 +78,8 @@ class Simplex extends Perlin{
[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0],
[2, 0, 1, 3], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [3, 0, 1, 2], [3, 0, 2, 1], [0, 0, 0, 0], [3, 1, 2, 0],
[2, 1, 0, 3], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [3, 1, 0, 2], [0, 0, 0, 0], [3, 2, 0, 1], [3, 2, 1, 0]];
/** @var float */
protected $offsetW;